⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mhook.rf

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 RF
字号:
.\"	@(MHWARNING).\" @(#)$Id: mhook.rf,v 1.1 90/07/20 09:41:36 sharpe Exp Locker: sharpe $.SC MHOOK 1.NAmhook \- MH receive\-mail hooks.SY$HOME/\&.maildelivery@BEGIN: MHMTS.ds SL \fIpost\fR.ds ZS slocal@END: MHMTS@BEGIN: MMDFIMTS.ds SL \fIslocal\fR.ds ZS slocal@END: MMDFIMTS@BEGIN: MMDFIIMTS.ds SL the local channel.ds ZS mmdfII@END: MMDFIIMTS@BEGIN: SENDMTS.ds SL \fIslocal\fR.ds ZS slocal@END: SENDMTS.ti .5i@(MHETCPATH)/rcvdist\%[\-form\ formfile]\%[switches\ for\ \fIpostproc\fR]address\ ...\%[\-help].ti .5i@(MHETCPATH)/rcvpackfile\%[\-help].ti .5i@(MHETCPATH)/rcvtty\%[command]\%[\-form\ formatfile]\%[\-format\ string]\%[\-bell] \%[\-nobell]\%[\-newline] \%[\-nonewline]\%[\-biff]\%[\-help].DEA receive\-mail hook is a program that is run whenever you receive amail message.You do \fBNOT\fR invoke the hook yourself,@BEGIN: MHMTSrather the hook is invoked on your behalf by \fIMH\fR.@END: MHMTS@BEGIN: MMDFIMTSrather the hook is invoked on your behalf by \fIMMDF\fRwhen you (symbolically) link @(MHETCPATH)/slocal to the filebin/rcvmail in your home directory.@END: MMDFIMTS@BEGIN: MMDFIIMTSrather the hook is invoked on your behalf by \fIMMDF\fR.@END: MMDFIIMTS@BEGIN: SENDMTSrather the hook is invoked on your behalf by \fISendMail\fR,when you include the line.nf.in +.5i    \*(lq| @(MHETCPATH)/slocal -user $USER\*(rq.in -.5i.fiin your \&.forward file in your home directory.@END: SENDMTSThe \fI\&.maildelivery\fR file,which is an ordinary ASCII file,controls how local delivery is performed.This file is read by \*(SL..if '\*(ZS'slocal' \{\The format of each line in the \fI\&.maildelivery\fR file is.ti +.5i\fBfield pattern action result string\fRwhere.in +.5i.ti -.25i\fBfield\fR:.brThe name of a field that is to be searched for a pattern.This is any field in the headers of the message that might be present.In addition, the following special fields are also defined:.in +.25i\fIsource\fR: the out\-of\-band sender information.br\fIaddr\fR: the address that was used to cause delivery to the recipient.br\fIdefault\fR: this matches \fIonly\fR if the message hasn't been delivered yet.br\fI*\fR: this always matches.in -.25i.ti -.25i\fBpattern\fR:.brThe sequence of characters to match in the specified field.Matching is case\-insensitive but not RE\-based..ti -.25i\fBaction\fR:.brThe action to take to deliver the message.This is one of.in +.5i.ti -.5i\fIfile\fR or \fI>\fR:.brAppend the message to the file named by \fBstring\fR.The standard maildrop delivery process is used.If the message can be appended to the file,then this action succeeds.When writing to the file,a new field is added:.ti +.5iDelivery\-Date:\ datewhich indicates the date and time that message was appended to the file..ti -.5i\fIpipe\fR or \fI|\fR:.brPipe the message as the standard input to the command named by \fBstring\fR,using the Bourne shell \fIsh\fR\0(1) to interpret the string.Prior to giving the string to the shell,it is expanded with the following built\-in variables:.in +.25i$(sender): the return address for the message.br$(address): the address that was used to cause delivery to the recipient.br$(size): the size of the message in bytes.br$(reply\-to): either the \*(lqReply\-To:\*(rq or \*(lqFrom:\*(rq fieldof the message.br$(info): miscellaneous out\-of\-band information.in -.25iWhen a process is invoked, its environment is:the user/group id:s are set to recipient's id:s;the working directory is the recipient's directory;the umask is 0077;the process has no /dev/tty;the standard input is set to the message;the standard output and diagnostic output are set to /dev/null;all other file\-descriptors are closed;the envariables \fB$USER\fR, \fB$HOME\fR, \fB$SHELL\fR are setappropriately,and no other envariables exist.The process is given a certain amount of time to execute.If the process does not exit within this limit,the process will be terminated with extreme prejudice.The amount of time is calculated as ((size x 60) + 300) seconds,where size is the number of bytes in the message.The exit status of the process is consulted in determining the success of theaction.An exit status of zero means that the action succeeded.Any other exit status (or abnormal termination) means that the action failed.In order to avoid any time limitations,you might implement a process that began by \fIforking\fR.The parent would return the appropriate value immediately,and the child could continue on,doing whatever it wanted for as long as it wanted.This approach is somewhat risky if the parent is going to return anexit status of zero.If the parent is going to return a non\-zero exit status,then this approach can lead to quicker delivery into your maildrop..ti -.5i\fIqpipe\fR or \fI<caret>\fR:.brSimilar to \fIpipe\fR,but executes the command directly,after built\-in variable expansion,without assistance from the shell..ti -.5i\fIdestroy\fR:.brThis action always succeeds..in -.5i.ti -.25i\fBresult\fR:.brIndicates how the action should be performed:.in +.5i.ti -.5i\fIA\fR:.brPerform the action.If the action succeeds, then the message is considered delivered..ti -.5i\fIR\fR:.brPerform the action.Regardless of the outcome of the action,the message is not considered delivered..ti -.5i\fI?\fR:.brPerform the action only if the message has not been delivered.If the action succeeds, then the message is considered delivered..ti -.5i\fIN\fR:.brPerform the action only if the message has not been deliveredand the previous action succeeded.If this action succeeds, then the message is considered delivered..in -.5i.in -.5iThe file is always read completely,so that several matches can be made and several actions can be taken.The \fI\&.maildelivery\fR file must be owned either by the user or by root,and must be writable only by the owner.If the \fI\&.maildelivery\fR file can not be found,or does not perform an action which delivers the message,then the file @(MHETCPATH)/maildelivery is read according to the same rules.This file must be owned by the root and must be writable only by the root.If this file can not be foundor does not perform an action which delivers the message,then standard delivery to the user's maildrop, @(MHDROPLOC), is performed.Arguments in the \fI\&.maildelivery\fR file are separated by white\-space orcomma.Since double\-quotes are honored,these characters may be included in a single argument by enclosing theentire argument in double\-quotes.A double\-quote can be included by preceeding it with a backslash.To summarize, here's an example:.nf.in +.5i.ta \w'default  'u +\w'uk-mmdf-workers  'u +\w'action  'u +\w'result  'u#\fIfield\fR	\fIpattern\fR	\fIaction\fR	\fIresult\fR	\fIstring\fR# lines starting with a '#' are ignored, as are blank lines## file mail with mmdf2 in the \*(lqTo:\*(rq line into file mmdf2.logTo	mmdf2	file	A	mmdf2.log# Messages from mmdf pipe to the program err-message-archiveFrom	mmdf	pipe	A	err-message-archive# Anything with the \*(lqSender:\*(rq address \*(lquk-mmdf-workers\*(rq# file in mmdf2.log if not filed alreadySender	uk-mmdf-workers	file	?	mmdf2.log# \*(lqTo:\*(rq unix \- put in file unix-newsTo	Unix	>	A	unix-news# if the address is jpo=mmdf \- pipe into mmdf-redistaddr	jpo=mmdf	|	A	mmdf-redist# if the address is jpo=ack \- send an acknowledgement copy backaddr	jpo=ack	|	R	\*(lqresend\0\-r\0$(reply-to)\*(rq# anything from steve \- destroy!From	steve	destroy	A	\-# anything not matched yet \- put into mailboxdefault	\-	>	?	mailbox# always run rcvalert*	\-	|	R	rcvalert.re.in -.5i.fi.\}.if '\*(ZS'mmdfII' \{\See \fImaildelivery\fR\0(5) for the details..\}Four programs are currently standardly available,\fIrcvdist\fR (redistribute incoming messages to additional recipients),\fIrcvpack\fR (save incoming messages in a \fIpackf\fR'd file),and \fIrcvtty\fR (notify user of incoming messages).The fourth program,\fIrcvstore\fR\0(1) is described separately.They all reside in the \fI@(MHETCPATH)/\fR directory.The \fIrcvdist\fR program will resend a copy of the message to all of theaddresses listed on its command line.It uses the format string facility described in \fImh\-format\fR\0(5).The \fIrcvpack\fR program will append a copy of the message to the file listedon its command line.Its use is obsoleted by the \fI\&.maildelivery\fR.The \fIrcvtty\fR program executes the named file with the message as itsstandard input,and writes the resulting output on your terminal.If no file is specified, or is bogus, etc.,then \fIrcvtty\fR will instead write a one\-line scan listing.Either the `\-form\ formatfile' or `\-format\ string' option may be used to override the default output format (see \fImh\-format\fP\0(5)).A newline is output before the message output, and the terminal bell is rungafter the output.  The `\-nonewline' and `\-nobell' optionswill inhibit these functions.Normally, \fIrcvtty\fP obeyswrite permission as granted by \fImesg\fP\0(1).With the `\-biff' option, \fIrcvtty\fP will obey the notificationstatus set by \fIbiff\fP\0(1).If the terminal access daemon (TTYD) is available on your system,then \fIrcvtty\fR will give its output to the daemon for outputinstead of writing on the user's terminal..Fi^@(MHETCPATH)/mtstailor~^tailor file^$HOME/\&.maildelivery~^The file controlling local delivery^@(MHETCPATH)/maildelivery~^Rather than the standard file.Sa.if '\*(ZS'slocal' \{\rcvstore (1), mh\-format(5).\}.if '\*(ZS'mmdfII' \{\rcvstore (1), maildelivery(5), mh\-format(5).\}.CoNone.if '\*(ZS'slocal' \{\.HiFor compatibility with older versions of \fIMH\fR,if \fIslocal\fR can't find the user's \fI\&.maildelivery\fR file,it will attempt to execute an old\-style rcvmail hook in the user's $HOMEdirectory.In particular,it will first attempt to execute.ti +.5i\&.mh\(rureceive file maildrop directory userfailing that it will attempt to execute.ti +.5i$HOME/bin/rcvmail user file senderbefore giving up and writing to the user's maildrop.In addition,whenever a hook or process is invoked,file\-descriptor three (3) is set to the message in addition to the standardinput.@BEGIN: MMDFIMTSIn addition to an exit status of zero,the \fIMMDF\fR values \fIRP_MOK\fR (32) and \fIRP_OK\fR (9)mean that the message has been fully delivered.All other non\-zero exit status,including abnormal termination,is interpreted as the \fIMMDF\fR value \fIRP_MECH\fR (200),which means \*(lquse an alternate route\*(rq(deliver the message to the maildrop).@END: MMDFIMTS.\}.BuOnly two return codes are meaningful, others should be..if '\*(ZS'mmdfII' \{\Versions of \fIMMDF\fR with the \fImaildelivery\fR mechanism aren'tentirely backwards\-compatible with earlier versions.If you have an old\-style hook, the best you can do is to have a one\-line\fI\&.maildelivery\fR file:.ti +.15idefault \- pipe A \*(lqbin/rcvmail $(address) $(info) $(sender)\*(rq.\}.En

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -