rsalz@bbn.com (Rich Salz) (03/18/89)
Submitted-by: Dan Heller <island!argv@sun.com> Posting-number: Volume 18, Issue 39 Archive-name: mush6.4/part17 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 17 (of 19)." # Contents: mush.1.3 # Wrapped by rsalz@papaya.bbn.com on Mon Mar 13 19:25:23 1989 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'mush.1.3' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'mush.1.3'\" else echo shar: Extracting \"'mush.1.3'\" \(49215 characters\) sed "s/^X//" >'mush.1.3' <<'END_OF_FILE' Xand is reset each time the command X.BR cd Xis called. XIt is referenced each time X.B pwd Xis called and may be used as any other shell variable. X.TP X.B date_received X(Boolean) XWhen message headers are printed, the date is normally shown is Xthe time and date the sender sent the message. If this variable Xis set, then the date displayed is the date received. X.sp XWhen sorting messages by date, this variable is queried to determine Xwhether the messages should be sorted by date sent or date received. X.sp X\fBWarning:\fR For mailers that store messages \fIwithout\fR a line Xthat starts with \*QFrom \*U, this option does nothing. X.TP X.B dead X(String) XFile to use instead of dead.letter when interrupted mail is saved. XFor more information, see the variable X.B nosave. X.TP X.B dot X(Boolean) XAccepts a `.' on a line by itself, in addition to `^D', to terminate messages. X.TP X.B editor X(String) XEditor to use when \*Q~e\*U is specified. XDefault is the value of the variable X.BR visual . X.TP X.B escape X(Character) XWhen composing a mail message (not in an editor), and the X.B escape Xcharacter is the first character on the line, the next character Xis examined and a corresponding function associated with that X.I "escape command" Xis executed. XSee X.B "tilde escapes" Xfor more information. X.TP X.B folder X(String) XThe folder variable is set to a path where folders are kept. X\&~/Mail is the default value. X.TP X.B fortune X(Boolean/string) XIf fortune is set, a random fortune is appended to the end of Xall outgoing mail using the X.IR UNIX (TM) Xcommand X.B /usr/games/fortune X(may vary from system to system). XIf fortune is set to something that starts with Xa `\-', then it is interpreted as a flag to fortune (e.g., \*Q\-o\*U). XIf X.B fortune Xstarts with a `/', then the program described by Xthe string is executed (thus not doing fortune at all, if you want). XBy default, X.I "fortune \-s" X(short fortunes) is used. X.TP X.B fortunates X(String) XWhen fortunes are added to messages, sometimes it is desireable to Xmake sure that only a selected group of people get a fortune since Xcertain people may not understand the messages at the end of your Xmail. Therefore, you can set a list of addresses (either pure addresses Xor aliases that are expanded to addresses) to be the only people who Xreceive fortunes if one is to be appended. Therefore, Xif the To: and Cc: lines contain only address listed in this string Xvariable, then a fortune is appended to the message. XIf those lists contain names that are not on the fortunates Xlist, then no fortune is added. XThis cannot be overriden; using the Xtilde command \*Q~F\*U does not force a fortune to be added unless the Xindividuals on the recipient list are all included in the fortunates Xlist. The list is made up of addresses or aliases separated by spaces or Xcommas. X.I "NOTE: fortune must be set in order for fortunates to work." X.TP X.B hdr_format X(String) XThis variable controls the format of the headers displayed by the X.B headers Xcommand and in the curses and graphics modes. XThe format style of this variable string is similar to printf in C. XWhen printing the information, the variable is evaluated and each Xcharacter in the string is echoed unless a `%' character is Xencountered. XIf one is found, the following string substitutions are made: X.sp X.in +2 X.nf X.ta 0.5i X%a address of the author X%c number of characters (bytes) in the message X%f entire \*QFrom:\*U field (author) X%l number of lines in the message X%i the message-id (may not be present) X%n name of the author X%s subject of the message X%t \*QTo:\*U field (recipients) X%d entire date of the message X%T the time only of the message X%N the day number of the month of the message X%W the day of the week (Sun, Mon, etc.) X%M the month name of the message X%Y the year of the message X%y the last two digits of %Y X\\n a newline X\\t a tab X.fi X.in -2 X.sp XA field width specifier may be used in all options. XThus, \*Q%20f\*U will print the Xfirst 20 characters of the from line. XNo matter what the formatting string, the message number Xfollowed by a `>' (for current message) is printed. X.sp XThe \*Qaddress\*U and \*Qname\*U of the author Xare extracted from the \*QFrom:\*U field of the message. XThe name may be given in parentheses and Xthe rest of the line is the address, or the address is given in angle Xbrackets (`<' and `>') and the rest of the line is the name. XSometimes the address is the only thing on the line, Xin which case the name and address are the same. X.sp X.TP X.B history X(Numeric) XThis variable is set to the number of commands the shell interface Xwill remember. It is just like the history variable used in X.I csh. XIf unset, the last command can always be referenced, but none other. X.TP X.B hold X(Boolean) XNormally, on termination of mail, read messages are saved in Xyour mbox (except those marked as preserved). XSetting X.B hold Xprevents this from happening, Xand messages remain in /usr/spool/mail/user. XThis does not apply to folders, obviously. X.TP X.B home X(String) XThis variable describes the user's home directory. XThe variable is initialized to the value of the environment variable HOME, Xbut can be modified at any time during the X.I Mush Xsession. XThe home directory is the same directory where temporary Xfiles are kept for editing and so forth. XIf the home directory cannot be found or read/write access is denied, an Xalternate directory, typically /tmp, is used. X.TP X.B hostname X(String) XThis is the name of your computer. Currently, its sole usage is to Xcompose a correct \*QFrom:\*U line for use with Mail Transport Agents Xthat do not create this header automatically. This will aid the Xrecipients of your mail in replying to your messages. X.sp XNote: the user should not have to set Xthis variable since it should be set automatically by the system. However, Xit may happen that the system's hostname cannot be queried and the user may Xhave to set this variable manually. X.TP X.B ignore_bang X(Boolean) XIf set, X.I Mush Xwill ignore the `!' character as a history reference. X.TP X.B ignoreeof X(Boolean/string) XIf set, `^D' will not exit from X.IR Mush . XIf set to a string, that string is executed as a command Xwhen `^D' is typed. XThis does not effect termination of messages under the X.B mail Xand X.B reply Xcommands. X.TP X.B indent_str X(String) XWhen including messages into the text of a letter you are editing, Xeach line of the messages is preceded by the value of X.BR indent_str . XIf it is unset, the message body is indented by the string \*Q> \*U. XSee also the variables X.B pre_indent_str Xand X.BR post_indent_str . X.TP X.B in_reply_to X(String) XThis variable may be set to a string that will complete the Xheader \*QIn-Reply-To:\*U. XThe format of this string is identical to the options for the variable X.BR hdr_format . X.sp XFor example, if the user were to respond to a message Xfrom Dan Heller that was sent on October 21, 1987, at 10:39pm, with X.B in_reply_to Xset to the string X.nf X.in +2 X.sp X%n's message as of %d. X.sp X.ti -2 Xthe header line X.sp XIn-Reply-To: Dan Heller's message as of Oct 21, 1987, 10:39pm. X.in-2 X.fi X.sp Xwould be added to the message. X.TP X.B keepsave X(Boolean) XIf set, the commands X.B save Xand X.B write Xwill X.I not Xmark messages for deletion. X.TP X.B known_hosts X(String) XUsed in conjunction with the variable X.BR auto_route , Xthis variable is set to a list of hosts, separated by spaces, tabs, Xand/or commas, and describes Xthe hosts with whom you know your machine shares UUCP connections. XWhen replying to mail, many times you will see that the return path Xconstructed will have hostnames that your site could call, but instead Xthe mail has been routed through a number of different machines first. X.sp XFor example, if you respond to mail that would mail to the path X.sp X.ti +2 Xunicom!pixar!root X.sp Xbut your know your machine already calls pixar, then sending the mail Xto unicom first is unnecessary. XIf you have set your known_hosts string to include pixar in its list, Xthe resulting address would look like X.sp X.ti +2 Xpixar!root X.sp XAlso see the command X.B replyall Xfor more information on constructing correct return addresses. X.TP X.B lister X(String) XDefault arguments to the \*Qls\*U command for printing the Xcontents of a directory. X.TP X.B logfile X(String) XSet to a filename which logs the headers of outgoing messages. The message Xbody of the message is not logged as it is for the X.B record Xfilename. The logfile can be read as a folder to scan for the fact that Xmessages have been sent. If \fBlogfile\fR and \fBrecord\fR are both set, Xthen the logfile and the record files will match exactly. In this case, Xthe record file can be quickly scanned by scanning the log file instead. X.sp XIf set, but not to a string, the log file defaults to ~/mail.log. X.TP X.B mbox X(String) XSet to the pathname of a file you'd like mush to use as the default Xholder for read mail. XThe default is ~/mbox. X.TP X.B metoo X(Boolean) XWhen replying to mail, you are normally deleted from the list of Xrecipients. XIf metoo is set, you remain on the list. XSee the X.B alternates Xcommand Xfor information on determining whether or not you're even on the list. X.TP X.B mil_time X(Boolean) XWhenever the time is displayed in a message header or in the prompt, Xit can be displayed in either 12-hour am/pm format, or in 24 hour Xmilitary time format. XThe default is the 12 hour format, but can be Xreset to use the 24 hour format by setting this variable. X.TP X.B newline X(Boolean/string) XIf set, carriage returns are ignored. XIf set to a string, that string is executed as a command when a Xcarriage return is typed. XOtherwise, carriage return prints the next undeleted message. X.TP X.B no_expand X(Boolean) XWhen a X.I Mush Xalias is used to reference a list of addresses, the list is expanded on Xthe To: and Cc: lines to indicate the complete list of all the recipients of Xthe message. XWhen no_expand is set, aliases are not expanded and the headers Xreflect the same information as typed by the user. X.TP X.B no_hdrs X(Boolean) XIf set, this variable tells X.I Mush Xnot to include your personalized mail headers in messages. XThis does not unset your headers, it just disables them. X.TP X.B no_reverse X(Boolean) XIn curses mode and in the tool mode, reverse video is not used to indicate the X.I "current message" Xif this variable is set. XIn the tool mode, if reverse video is not in use, Xtext is displayed in \*Qbold\*U. X.TP X.B nonobang X(Boolean) XIf this variable is set, history references that don't match anything will Xbe left unexpanded, rather than generating error messages. XThis is useful if you want argument referencing in cmd expansions, but do Xnot want to remember to escape every `!' you type in UUCP addresses. XIt is also recommended for use with curses mode, because history is not Xkept for line mode escapes from that interface. X.TP X.B nosave X(Boolean) XWhen composing a letter, the user can terminate the letter without sending Xit by using the tidle escape \*Q~q\*U or by sending two \*Qinterrupt\*U Xsignals. XWhen the message is terminated, a copy of it is saved to the Xfile \*Qdead.letter\*U in the user's home directory or to the file described Xby the variable X.BR dead . XIf the variable X.B nosave Xis set, then a backup copy of the message will not be saved. X.TP X.B pager X(String) XIf a message is longer than the number of lines that the variable X.B crt Xis set to, then this program is executed to view a message. XIf the user does not have this variable set, the user's environment PAGER Xis checked. XIf this isn't set, then the default value for pager (set up Xby the system manager) is used. XThis may or may not be the internal pager. XTo use the internal pager, you may set the variable pager to X.I internal Xor to a null string. X.TP X.B pre_indent_str X(String) XIf this variable is set, when including the body of a message into an outgoing Xmail message (using the \-i option to X.I reply Xor X.IR mail , Xor when using the \*Q~i\*U escape), Xa line preceding the first line of Xincluded text is printed using the string value of the variable. XThis string uses the same printf style formatting characters as the X.B hdr_format Xvariable. XFor example, you could set X.B pre_indent_str Xas follows: X.sp X.ti +2 Xset pre_indent_str = '[In the message entitled "%s", on %7d\\n %n writes:]' X.sp XYou can then include a message body using \*Q~i\*U, and you might Xget something like this: X.sp X.in +2 X.nf X[In the message entitled "This is a test.", on Jan 19, X Dan Heller writes:] X> This is a test message to show how X> pre_indent_str might be used. X.ti -2 X.sp X.fi XThis example assumes that the string value of X.B indent_str Xis not set. X.TP X.B post_indent_str X(String) XThis variable has the same function as X.B pre_indent_str Xexcept that the string is inserted into the message body X.I after Xthe text of the included message rather than before. XThe purpose of this variable is to complement the string described by Xthe variables X.B pre_indent_str Xand X.BR indent_str . XFor example, X.sp X.in +2 X.nf Xset pre_indent_str = "/*" Xset indent_str = " * " Xset post_indent_str = " */" X.sp X.ti -2 XAn included message might look something like this: X.sp X/* X * This is a test message to show how X * post_indent_str and pre_indent_str X * can work together with indent_str. X */ X.fi X.in -2 X.TP X.B printer X(String) XUsed to set the default printer for the lpr command. X.TP X.B print_cmd X(String) XThis string should describe a X.IR UNIX (TM) Xcommand other than "lpr" for sending Xmessages to the line printer. XSome people may choose to use a device independent Xtroff style program, but virtually any UNIX command will suffice. XCommon usage might include: X.sp X.ti +2 Xset print_cmd = 'ptroff \-ms \-Plp' X.ti +2 Xlpr .\-$ X.sp XThis command would send all messages from the current message to the last Xmessage through the ptroff command, supplying the appropriate arguments. X.TP X.B prompt X(String) XYou can set your prompt to tell you many different pieces of information. XBy default, the prompt is set to the string X.sp X.ti +2 X\*QMsg %m of %t: \*U X.sp XIf you have 10 messages and your current message is 5, then your prompt Xwould look like: X.sp X.ti +2 XMsg 5 of 10: X.sp XThe string value that prompt is set to will be printed as your prompt. XIf the string contains a `%', then that character is Xignored, the next character is evaluated and an appropriate Xvalue is printed in its place: X.sp X.nf X.in +2 X.ta 0.5i X%F full path name of the current folder X%f name of the current folder (tail of %F) X%m \*Qcurrent message\*U number X%t total number of messages X%n number of \*Qnew\*U messages X%u number of unread messages X%d number of deleted messages X%T current time (hours and seconds) X%N today's date (Number of the day in the month) X%W weekday name (Sun, Mon, Tue, ...) X%M current month X%Y this year X%y last two digits of %Y X\\n a newline X\\t a tab X.fi X.in -2 X.TP X.B quiet X(Boolean) XIf set, the currently running version of X.I Mush Xis not printed on startup. X.TP X.B realname X(String) XSet to the name of the user. The name is initialized to the value of Xthe environment variable X.B NAME Xupon invocation of the program. XIf that isn't set, then the name is gotten from the password file if Xavailable. If this variable wants to be reset or changed after the Xprogram has started, the user should issue the command: X.sp X.ti +2 Xset realname = "Your name here" X.TP X.B record X(String) XSet to the name of a file to record all outgoing mail. XThis should be a full pathname or the current directory is searched. XThe pathname may begin with `+' (indicating the user's ~/Mail directory Xor the value of the X.B folder Xvariable) or with a `~' (or \*Q~user\*U) Xindicating the user's home directory. X.TP X.B reply_to_hdr X(String) XWhen replying to mail, X.I Mush Xsearches for return paths from the message by searching for Xthe message headings \*QReply-to\*U, \*QReturn-path\*U, and \*QFrom:\*U, Xin that order. XIf none are found, then the first line of the Xmessage created by the delivery system is parsed and the address Xgiven there is used. This special message header is created by most Xmail delivery programs, but not all of them (MMDF, for one). This line Xis called the X.B From_ Xheader because it is a colon-less header, but contains the return address Xof the author of the message. XIf the variable X.B reply_to_hdr Xis set to a list of headers (delimited by spaces or commas), then that list Xis searched. If none of the headers listed in the variable exist Xin the message, then a warning message is printed and the default Xheaders are used. The special case From_ header can be specified Xas one of the headers to search for. X.sp X.nf X.ti +2 Xset reply_to_hdr = "sender reply-to return-path from_" X.fi X.sp XThis example shows that mush will search for (in order), the Xheaders listed in the reply_to_hdr variable. If one header isn't Xfound, then mush looks for the next in the list. If none of the Xheaders in the list are found, the default headers (mentioned Xabove) are searched. The last header listed in the example is Xthe special "From " header. XAlso see the X.B reply Xcommand. X.TP X.B save_empty X(Boolean) XNormally, when all messages in a folder are deleted and the user updates Xthe folder or changes to a new folder, the empty folder is deleted. X.B save_empty Xprevents the folder from being deleted and it is left zero length. XNote: the main system mailbox is never deleted, even when empty. X.TP X.B screen X(Numeric) XMay be set to the number of message headers to display at a time in the Xline and curses modes. X.TP X.B screen_win X(Numeric) XMay be set to the number of message headers to display in the tool mode. XA subwindow is created for message headers, and its size is large Xenough to hold $screen_win headers. X.TP X.B sendmail X(String) XIf set, the program and arguments described by this variable will Xbe executed to actually deliver mail sent by X.I Mush. X.TP X.B show_deleted X(Boolean) XIf true, deleted message headers are displayed along with Xother messages (`*' indicates a deleted message) for the \fBheaders\fR Xcommand. Also, deleted messages can be displayed using any command which Xdisplays a message. XIn curses mode, this variable is ignored and deleted messages are always Xdisplayed with other messages to facilitate undeleting messages. X.TP X.B show_hdrs X(String) XSet to a list (space and/or comma separated) of headers that are to be the Xonly headers displayed when viewing a message. XThis variable disables the headers suppressed by the X.B ignore Xcommand. XFor example, X.sp X.ti +2 Xset show_hdrs = \*Qfrom date subject to cc\*U X.sp Xwill only display the headers X.B From: Date: Subject: To: Cc: Xin their entirety. X.TP X.B sort X(Boolean/string) XThe value of this variable is the same as the arguments to the X.B sort Xcommand. XThis variable is used for the initialization file to presort Xmail in the system mailbox upon entering mush. XSee the COMMANDS section for more information. X.TP X.B squeeze X(Boolean) XWhenever messages are read, piped, or saved, if this variable is set, Xall consecutive blank lines are squeezed into one blank line. X.TP X.B tmpdir X(String) XThis variable describes the path to use as the directory Xfor all tempfiles that X.I Mush Xuses. By default, the user's home directory is used. If that Xcannot be accessed, a directory writable by all is used (typically, /tmp). XIf \fBtmpdir\fR is set, then it is used first. X.TP X.B thisfolder X(Read-only string) XThe full path name of the current mailbox. XThis variable cannot be modified or displayed by the X.B set Xcommand; its value changes whenever a new folder is entered with the X.B folder Xcommand. XDuring sourcing of the initialization files, X.B thisfolder Xis not set, because the current folder has not yet been read. XIf you refer to \*Q$thisfolder\*U in an initialization file X.RI ( e.g. , X.IR .mushrc ), Xbe sure to do so inside an \*Qif $?thisfolder\*U test. X.TP X.B toplines X(Numeric) XThe number of lines of a message to print when the X.B top Xcommand is issued. If unset, $crt lines are printed. XNote that the message body only is printed when using the X.B top Xcommand; message headers are not counted as lines since they are not displayed. X.TP X.B unix X(Boolean) XIf set, commands that are not X.I Mush Xcommands are considered to be X.IR UNIX (TM) Xcommands. XThis removes the inconvenience of requiring the user to do Xshell escapes to do quick X.I UNIX Xcommands. XFor systems that support job control, SIGTSTP will stop the entire shell as Xwell as the process being executed. XWhen SIGCONT is delivered, both will receive the Xsignal and the shell will continue to wait for the job to finish. X.sp XDue to the lack of real job control, input/output redirection and UNIX command Xpiping, this mode of the shell is not intended to be used as a login shell. X.sp XIf a X.I Mush Xcommand conflicts with a X.I UNIX Xcommand, use the command X.B sh Xto force execution as a shell command or use the full pathname of the command X(e.g. starting with a '/'). X.sp X.BR Warning : X.I "Be aware that Mush pipes transmit message lists, NOT TEXT." XYou cannot pipe the output of X.I UNIX Xcommands to or from X.I Mush Xcommands or other X.I UNIX Xcommands with the X.I Mush Xpipe mechanism. You can, however, pipe mush commands to a final UNIX Xcommand (see the \fBpipe\fR command for more information). XUNIX commands should be simple commands without pipes or metacharacters. X.sp XThis feature is not available for the graphics (tool-based) mode. X.TP X.B verbose X(Boolean) XPasses verbose flag to mail delivery systems when sending mail. X.TP X.B verify X(Boolean) XWhen through editing messages, just before sending, X.B verify Xwill ask you if you want to send, continue editing, or abort the Xwhole message altogether. X.TP X.B visual X(String) XMay be set to the visual editor to use when ~v is specified. XDefault is vi. XThe visual editor is invoked by the \-e arguments to the Xcommands, X.B respond Xand X.BR mail . X.TP X.B warning X(Boolean) XIf set, warning messages are printed when: X.in +4 X.ti -2 X\(bu a command line alias (\*Qcmd\*U) looks like a command. X.br XFor example, X.ti +2 Xcmd mail 'set fortune; \\mail' X.ti +2 Xcmd respond 'unset fortune; \\respond;' X.ti -2 X\(bu a variable is set differently from its default value. X.br XFor example, if the escape character is set to something other Xthat the tilde (~), then a warning message will be printed. X.ti -2 X\(bu a date format from a message is unknown. X.br XThe date of a message is taken from the \fBDate:\f header. XIf the date on that header is unknown, other headers are searched for a Xvalid date format until a legal one is found. XThis date may not be Xcorrect in that it was the date the message was received, not sent. X.in -4 X.sp XThe intent is so that users who are used to their own environments Xwill be aware of changes in other environments should they be forced Xto use them. XThere may also be warning messages of failed routines Xor assertions that are not fatal enough to interrupt normal running Xof the program. X.TP X.B wrap X(Boolean) XNormally, when the last message is deleted, the current message Xpointer remains pointing to the last message and the user is done Xreviewing his mail. XIf the X.B wrap Xvariable is set, the current message pointer will wrap around to the Xbeginning of the user's messages again to the next undeleted message. XThis also applies to the X.B next Xcommand. X.TP X.B wrapcolumn X(Numeric) XMay be set to a column number at which line wrap will occur when Xcomposing messages. XIf set, but given no value, column 78 will be assumed. XWhen X.I Mush Xis able to determine the number of columns on your screen, it will Xenforce a maximum value for X.B wrapcolumn Xof two less than that number of columns. XLine wrapping can be disabled either by unsetting X.B wrapcolumn Xor by setting it with the explicit value of 0 (zero). X.sp XLine wrapping occurs only at whitespace (spaces or tabs). XLines containing no whitespace to the left of the specified column Xwill not be wrapped. XIf mush was started with the \-e option (echo mode), line wrapping Xcannot be done. X.SH MACROS XMacros are available in several different modes in X.IR Mush . X.I "Curses mode macros" Xare created by using the X.B bind Xcommand with the special function X.B macro X(or by using X.BR bind-macro , Xwhich is synonymous). XThese macros are effective only when the curses interface is active. X.I "Line mode macros" Xare created with the X.B map Xcommand, and are effective only in the line-oriented command interface. XFinally, X.I "composition mode macros" Xare created with the X.B map! Xcommand, and are effective only when composing mail messages. XMacros are not available in the X.I tool Xmode; see, however, the X.B fkey Xcommand. XLine and composition mode macros are also nonfunctional when mush is Xstarted with the \-e (echo) option. X.PP XIn general, macros consist of two parts: a X.I "key sequence" Xand an X.IR expansion . XThe X.B "key sequence" Xis the character or string of characters which, when typed in the Xappropriate mode, is recognized by X.I Mush Xas a reference to a macro. XThe X.B expansion Xpart of a macro is the string that will actually be \*Qseen\*U by X.I Mush Xwhen the key sequence is recognized. XMacros are like an interactive search-and-replace function; Xif a key sequence appears in the input, the associated expansion is Xsubstituted in its place. XThus, if you create a macro whose key sequence is \*Q^X^W\*U (control-X Xcontrol-W) and whose expansion is \*Qsave\*U, then when you hold down the Xcontrol key and type the two characters `x' and `w', the effect will be Xas if you had actually typed the four characters `s', `a', `v' and `e'. XThis is called \*Qexpanding\*U the macro. XMore detailed examples of macros will be presented in the subsections Xfor each mode in which macros can be used. X.PP XKey sequences are usually made up of control characters or special Xstrings of characters generated by \*Qfunction keys,\*U Xbut may in fact be almost any string the user desires. XKeys that generate a signal or an end-of-file from the keyboard X(for example, on BSD systems, control-Z generates a TSTP signal and Xcontrol-D generates an end-of-file) can never appear Xin key sequences, and macros in line or composition modes cannot X.I begin Xwith a newline, control-D, or any of the editing keys X(erase, word-erase, line-erase, etc.). XOtherwise, there are no restrictions. XIt should be kept in mind, however, that for the line and composition Xmodes, key sequences should be unusual characters or combinations of Xcharacters, not individual lower-case letters. XIf common characters or strings are used for key sequences, much Xconfusion can result when typing commands or messages. XThis is not important in the curses mode. X.PP XIn the line and composition modes, a X.I timeout Xis used for key recognition; that is, once the first character of the Xkey sequence has been typed, the succeeding characters must be typed Xafter it relatively quickly, or X.I Mush Xwill fail to recognize them as a continuous sequence. XIt is for this reason that key sequences are usually either very short, Xor are strings that are automatically generated by pressing a special Xkey on the terminal. XOn the other hand, the timeout can be used intentionally to prevent a Xmacro from being expanded; simply type the first character of the macro, Xthen wait for it to echo before typing the next. XThis does not work in curses mode, because curses macros Xnever \*Qtime out.\*U X.PP XIn any mode, macros are X.IR recursive ; Xthat is, if the X.I "key sequence" Xof one macro appears in the X.I expansion Xof another macro (or even of the same macro), the second key sequence Xwill be recognized when the first macro is expanded, and this new key Xsequence will also be expanded. XGreat care should be taken when creating macros to be certain that Xrecursive expansions do not happen unintentionally. XExpansion can be prevented in line or composition modes by using a X.I literal-next Xcharacter. X.PP XLiteral-next characters may be used from the keyboard or imbedded Xin expansions. XIn either case, they prevent the next character Xfrom being interpreted as part of a key sequence. X.I Mush Xrecognizes the literal-next character from the tty settings of the Xterminal, if the \*Qnew\*U BSD-style device driver is available; Xotherwise, `^V' (control-V) is recognized as a literal-next. XNote that, if you have a tty literal-next character, Xthen when typing you will need to type X.I two Xof them in order to send one to mush; this is because the tty Xdriver consumes the first one. XIt is not necessary to use two literal-nexts in macro expansions Xunless you wish to cause the second literal-next to be literal. X.PP XBackslash can be used as a literal-next when typing, and can Xsometimes be used as a literal-next in expansions; but use it Xwith caution, because it also introduces escape sequences X(see \*QMacro syntax,\*U below). XThere is no literal-next mechanism for curses mode. X.PP XA macro will always abort whenever X.I any Xcommand called by the macro returns an error. XThis includes recursive expansions, so no matter how often a macro has Xrecurred, it will be terminated completely. XErrors in curses mode include illegal cursor movements, such as up from Xthe top of the screen or down from the last message. X.PP X.BR "Macro syntax" . X.PP XA special sytax is provided for specifying control characters and other Xnon-printing characters in macro key sequences and expansions. XThis syntax is the same as that for bindings, discussed in the XCURSES INTERFACE section; it can be summarized as: X.ta 1.25i X.in +2 X.nf X\\CX control-X (where X is any capital letter) X\\E the escape character X\\n a newline (other C-style escapes also work) X.fi X.in -2 X.sp XThus, to create a line mode macro for control-X control-W, as in the Xexample above, the command would be X.sp X.ti +4 Xmap '\\CX\\CW' save X.PP XAlso provided is a syntax for executing functions from within macros. XThere are two special functions that are effective in all modes; Xthese are X.I getstr Xand X.IR getline . XBoth of these functions interrupt expansion of the current macro, Xand wait for a newline-terminated string to be entered from the Xstandard input. XThis input string is inserted into the macro expansion. XThe functions differ in that X.B getline Xretains the newline character (carriage-return) at the end of the Xinput string, whereas X.B getstr Xstrips off the newline (one must still be typed to terminate input). XThese functions can be executed by surrounding their name with Xsquare brackets X.RB ( [ , X.BR ] ); Xfor example, X.sp X.ti +4 Xmap '\\CX\\CW' save [getline] X.sp Xcreates a line mode macro, which is expanded when control-X control-W is Xtyped, and which displays \*Qsave\*U followed by a space and then waits Xfor the user to type a line of input; the input line will be used as the Xarguments to the save command. X.PP XAddtional functions are currently available only in the curses mode. XHowever, the syntax of enclosing the function name in square brackets Xapplies to all functions, regardless of mode. XNote that X.I ONLY Xthe function name can appear in the brackets; no whitespace is allowed. X.PP X.BR "Curses mode macros" . X.PP XMacros in curses mode are the most versatile, because they can access the Xfull range of curses commands quickly and easily. XEvery character that appears in the expansion part of a curses mode macro Xcan reference a curses command or another macro. XLike other curses functions, curses mode macros are created with the X.B bind Xcommand. XFor example, to sort your messages by date and then send the most recent Xone to the printer, you could use X.sp X.ti +4 Xbind @ macro 'od$|' X.sp XWhen the `@' key is typed, this macro first invokes sort X(`o' from the default bindings) and instructs it to use date (d) Xfor sorting; it then moves the current-message pointer to the last Xmessage ($) and prints that message (|). X.PP XAdmittedly, the above macro is somewhat cryptic, and is dependent upon Xthe bindings for sort, last-msg, and lpr being set to the defaults. XIt would be better, and possibly more understandable, to refer to the Xdesired curses functions without using their key bindings. XTo allow this, the \*Q[function]\*U syntax described above may be used Xin curses mode macros to reference curses functions. XThe only function that is prohibited from appearing in the \*Q[\|]\*U Xis the special X.I macro Xfunction, which cannot be called when it has no binding. XThe example macro can therefore be rewritten as X.sp X.ti +4 Xbind @ macro [sort]d[last-msg][lpr] X.sp XSuch references to curses functions may be made only in curses mode Xmacros, and are effective only when mush is actually in curses mode. XThat may sound strange, but the most common use of curses macros is Xto quickly perform functions that require an escape to the line mode. XFor example, although there is a variation of the curses mode X.I mail Xfunction that will prompt for additional flags, there is no function Xto prompt for flags to be passed to X.IR reply . XA macro can easily be created to provide this: X.sp X.ti +4 Xbind R macro '[line-mode]reply ' X.sp XThis macro binds `R' to perform an escape to line mode and type Xthe string \*Qreply\*U followed by a space. XMacro expansion then ends, leaving it up to the user to supply Xflags to the command or to backspace over it if a different command X(or none) is desired. XOf course, the macro could also have provided some default arguments: X.sp X.ti +4 Xbind R macro '[line-mode]reply \-ei ' X.PP XNote that, if the X.B getline Xor X.B getstr Xfunction is used in a line-mode escape, it is not possible to Xerase the text that is typed before the X.IR get ; Xthat is, if the macro had been X.sp X.ti +4 Xbind R macro '[line-mode]reply \-ei [getline]' X.sp Xthen the user would be forced to use the \-ei flags. X.PP X.BR "Line mode macros" . X.PP XLine mode macros combine some of the convenience of single-keystroke Xcommands with the versatility of the line-oriented text interface. XAs has been noted, the choice of characters for line mode key sequences Xshould be made carefully, so as not to interfere with normal typing. XLine mode macros are created with the X.B map Xcommand; for example, suppose you frequently forward messages to a Xfriend named \*Qfred.\*U You could create a macro to do this: X.sp X.ti +4 Xmap '\\CF' 'mail \-f . fred\\n' X.sp XThis macro causes the single keystroke `^F' (control-F) to forward Xthe current message to \*Qfred.\*U Note the newline Xcharacter \*Q\\n\*U at the end of the expansion; Xthis causes the command to be executed immediately, Xwithout you having to type a carriage-return. X.PP XThe expansion part of a line mode macro will echo to the screen when Xit is expanded, so you can see what the macro is doing. XYou can therefore use parts of the expansion as a \*Qprompt.\*U In Xthe above example, suppose you wished to enter a message list rather Xthan always forwarding the current message. XChange the macro to: X.sp X.ti +4 Xmap '\\CF' 'mail \-f [getstr] fred\\n' X.sp XThis version of the macro prints \*Qmail \-f\*U and a space, then waits Xfor a newline-terminated string from the standard input. XThe newline is stripped, and the string is used as the message list Xpassed to the \*Qmail \-f\*U command. XThe address \*Qfred\*U is also passed to X.BR mail , Xso the messages in the list are forwarded to fred. X.PP XIf you want to be able to \*Qchange your mind\*U after starting a Xline mode macro, you must leave the \*Q\\n\*U out of the expansion. XWithout the newline, the macro will not be executed immediately, so Xyou have a chance erase the line (or part of it) and type Xsomething different. XRemember that the X.B getline Xfunction keeps the newline in the string it gets, so if you don't Xwant a newline to appear, you must use X.BR getstr . XWhen using the X.I get Xfunctions, you should also remember that you can X.I never Xbackspace past the \*Qbeginning\*U of a X.BR getline , Xand you can backspace past the beginning of a X.B getstr Xonly after the get has been completed. X.PP XWhen the X.B getstr Xfunction is used in line mode macros, X.I Mush Xwill reprint the current input line so you can see what the whole Xthing looks like, but will not redisplay the line mode prompt X(see the entry for X.B prompt Xin the VARIABLES section for information on what the Xprompt looks like). XDon't let this worry you. XThe input line is also reprinted when X.B getline Xis used, but the newline in the input string usually results in a Xnew prompt being displayed. X.PP X.IR NOTE : XLine mode macros are not available when using the line-mode escape Xfunction in curses mode. XIt is necessary to escape all the way to line mode (that is, leave Xcurses mode by typing carriage-return at the `:' prompt) in order Xto access line mode macros. XThis is to prevent possible confusion when similar macros exist Xin both line and curses modes. X.PP X.BR "Composition mode macros" . X.PP XComposition mode macros are very similar to line mode macros, and Xprovide a \*Qpower typing\*U function when composing messages. XFor example, you might want to have the word \*Qpercent\*U inserted Xinto your message whenever you hit the `%' key: X.sp X.ti +4 Xmap! % percent X.sp XAnother use is to simulate the indentation features of editors. XFor example, you might X.sp X.ti +4 Xmap! '\\CT' '\ \ \ \ ' X.sp X(where the expansion is four spaces, enclosed in single quotes). XThis macro causes four spaces to be inserted into the message whenever Xcontrol-T is typed. X.PP XCompositon mode macros can also be used to execute X.I tilde-escapes X(see the GENERAL USAGE section for a list of these). XFor example, you could create a macro to invoke the editor: X.sp X.ti +4 Xmap! '\\CE' '\\n~v\\n' X.sp XWhen control-E is typed, this macro prints a newline (to be sure that Xthe tilde-escape is the first thing on a line), then types \*Q~v\*U Xfollowed by another newline, to start the editor. XSimilar macros can be created for other tilde-escapes. X.PP X.BR "Mixed mode macros" . X.PP XIt is not normally possible to mix macros among the different modes. XHowever, once expansion has begun, it is interrupted only by an error Xor by the appearance of one of the special X.I get Xfunctions. XIt is therefore possible to have a macro expansion which causes Xthe mode to change before the expansion has completed. XIn this case, recursive expansions will apply to the new mode. XSuppose we are using a variation of the editor-starting macro shown Xabove for composition mode: X.sp X.ti +4 Xmap! '\\CE' '\\n~v emacs\\n' X.sp XThis macro causes the \*Qemacs\*U editor to be started when control-E Xis typed in composition mode. XWe can now create a line mode macro that makes use of this Xcomposition mode macro: X.sp X.ti +4 Xmap '#' 'reply \-i [getline]~t[getline]\\CE' X.sp XWhen the `#' key is pressed in line mode, this macro will Xprint \*Qreply \-i\*U and wait for a message list, then enter Xcomposition mode (by executing the X.B reply Xcommand). XIn composition mode, it will display the To: line X(the \*Q~t\*U escape) and wait for other addresses to be added. XFinally, it will recursively expand the control-E macro, to Xstart editing the message with emacs. X.PP XAs can be seen from this example, the X.I Mush Xmacro facility is very powerful. XBe very careful not to accidentally expand recursive macros, Xespecially when using macros that change modes. XWhen testing new macros, it is a good idea to start mush in X.I read-only Xmode (the \-r command line flag) to be sure that messages are Xnot lost or altered. X.PP X.BR "Getting rid of macros" . X.PP XIt is not necessary to delete a macro in order to redefine it. XNew expansions for existing key sequences will automatically replace Xthe old expansions. XIf it is necessary to remove a macro completely, the commands X.BR unbind , X.B unmap Xand X.B unmap! Xcan be used to remove curses mode, line mode, and composition mode Xmacros, respectively. XRemember to use a backslash or other literal-next character to prevent Xthe expansion of line mode macros when using these commands, especially X.BR unmap . X.SH "MAIL ADDRESSES" XWhenever a command that requires a user address or set of addresses Xis specified X.RB ( mail , X.BR reply , X.BR alias , X.BR etc ) Xthe addresses given must be separated by commas. XMost casual users specify addresses that contain no comments or whitespace. XThe simplest addresses are just the login names of the users you wish to send Xyour message to: X.sp X.ti +2 X\fBmail\fR fred barney wilma betty X.sp XIn these cases, X.I Mush Xcan figure out that they are separate addresses and Xinsert commas between addresses automatically. X.sp X.ti +2 XTo: fred, barney, wilma, betty X.sp XAddresses may also contain `!', `@' and `%' characters which are used Xto separate hostnames and the final user name from each other. XThis is primarily used to mail to users on other machines. XUUCP addresses are specified as X.sp X.ti +2 Xhost1!host2!user X.sp Xwhere there may be as many hosts as necessary to route the message Xto the recipient user. XHere, the user's account is on \*Qhost2\*U Xand that machine is connected to \*Qhost1\*U. X.I Domain Xaddresses (also called Arpanet, RFC822, and \*Qfully qualified\*U addresses) Xare specified as X.sp X.ti +2 Xuser@host.domain X.ti +2 Xuser%host2.domain@host1 X.sp Xwhere \*Qdomain\*U is a domain name such as \*Q.berkeley.edu\*U or \*Q.com\*U. XAs in the first example, the user is on \*Qhost2\*U, but that machine talks Xto \*Qhost1\*U. XIt is beyond the scope of this document to discuss in detail the ramifications Xof internetwork mailing. XMore information can be obtained through your system manager. X.PP X.I Mush Xunderstands addresses containing a comment field. XComment fields do not affect the destination address of mail being sent. XThese fields are purely for Xhuman legibility and may be specified according to the following constraints: X.sp XAnything within angle brackets is an address; whatever is outside of the Xaddress is considered a comment: X.sp X.ti +2 XDan Heller <sun!island!argv> X.ti +2 XDan Heller <argv%island@sun.com> X.sp XAnything that has parentheses is a comment; whatever is outside of the Xparentheses is considered the address: X.sp X.ti +2 Xsun!island!argv (Dan Heller) X.ti +2 Xargv%island@sun.com (Dan Heller) X.sp XDouble quotes (") are treated just like parentheses: X.sp X.ti +2 X"Dan Heller" sun!island!argv X.ti +2 X"Dan Heller" island!argv@sun.com X.sp XIf the comment is to contain a comma, the first case above may not be used; Xyou must use either the parenthesis or double-quote cases. X.sp X.ti +2 Xfred@flintstone.bed.rock (Fred Flintstone, Cave Man) X.sp XIf the comment contains unbalanced quotes, unpredictable results may occur X(Mush won't deliver the mail). X.sp XSince the angle brackets have the highest precedence, quotes or parentheses Xmay be used in conjunction with one another. X.sp X.ti +2 XYabba Dabba Doo (Fred Flintstone) <fred> X.ti +2 XScoobie "Doobie" Doo <scooby@shaggys.mystery.machine> X.PP XMultiple addresses may appear on a line: X.sp X.in +2 Xisland!argv@sun.com argv@garp.mit.edu dheller X.in -2 X.sp XBecause there is no indication of comments (parenthesis, angle bracket, Xor quotes), it is assumed that these are separate addresses and mush will Xinsert commas between these addresses accordingly. XIt is for this reason that the user is encouraged to explicitly insert Xcommas between all mail addresses and not depend on the automation of comma Xinsertion to correctly separate addresses from one another. X.PP XMail aliases may contain addresses of the form described above. X.sp X.nf X.in +2 X.ta 1.5i Xalias george George Jetson <george@spacely.space.sprockets> Xalias jane Jane Jetson <jane@sky-high.appts> Xalias group george, jane X.in -2 X.fi X.sp XYou can mail using the alias as an address and it will be expanded Xaccordingly. XYou cannot, however, reference an alias and specify a Xcomment or another address at the same time. X.sp X.ti +2 XTo: The Jetsons <group> X.sp XThe alias \*Qgroup\*U will not be expanded because the angle brackets Xcauses it to be considered as another address entirely. X.SH FILES X.nf X.ta 2.0i X/usr/spool/mail/* Directory for incoming mail X~/Mail Default \fBfolder\fR directory X~/mbox File where old mail is saved X~/.mushrc File giving initial \fIMush\fR commands X~/.mailrc Alternate initialization file X~/.edXXXXXXX Temporary for file for outgoing messages X~/.mushXXXXXX Temporary mail file (copy of current folder) X.fi X.PP XTemporary files that are created by the program are always Xcreated with read/write access to the owner only; group and other Xpermissions are never set. XThis is also true for the /usr/spool/mail/* files. XAll other files created by the user via commands internal or external Xto the program have permissions set by the user's default umask. XIf the umask is reset within the program, the mask remains Xintact even after exiting. XRemember to set the variable X.B unix Xbefore attempting to set the umask value. X.PP XIf your system is using Sun Microsystem's NFS, take special note to Xread the manual page for mount(1). XFilesystems mounted for read/write Xaccess should be mounted as \*Qhard\*U NFS mounts or you may lose Xmailboxes during a timeout during a write or update. X.PP XFilesystems that use RFS still have bugs to be ironed out in the way Xof owners and permissions concerning utime(2). X.SH "SEE ALSO" X.IR Mail (1), X.IR binmail (1), X.IR csh (1), X.IR aliases (5), X.IR mount (1), X.IR mailaddr (7), X.IR sendmail (8), X.IR printf (3), X.IR execl (3), X.IR umask (1), X.IR utime (2). X.SH AUTHOR XThe original X.I Mush Xwas written entirely by Dan Heller. XCode to support macros, line wrapping, and some other miscellaneous Xdetails, was written by Bart Schaefer, who gets his name in print Xbecause he updated and proofread this manual. XNumerous others have supplied valuable suggestions Xand assorted bits and pieces. X.PP Xargv@spam.istc.sri.com sun!island!argv X.SH DISCLAIMERS X.I Mush Xcontains no X.IR UNIX (TM) Xsources and never has. XIt is also not a modified version of any other mail user agent. XSimilarities Xwith any other mailer may have been designed for compatibility reasons. X.PP X.I UNIX Xis a trademark of AT&T. X.PP XThe Flintstones and The Jetsons are trademarks of Hannah-Barbara Inc. X.SH BUGS XThe curses interface uses the curses library. XThe routines from the library that are used are the most basic and simple Xso as to avoid possible bugginess that Xdifferent versions of UNIX might have. XHowever, one unavoidable problem is the reverse video mode. XDepending on your terminal, Xthe termcap entry for it, and the version of curses you are running, Xthe reverse video may makes things worse than desired. XIn such situations, the user should set the variable X.B no_reverse Xto not get reverse video. X\&`^R' may still be entered at runtime in the curses Xinterface to toggle reverse video. X.PP XIf the program is already running and the system [later] has to swap Xand there is no swap space left, there may be problems. XOne such problem is sending mail. XIf this happens, then sending mail Xwill fail and a segmentation fault from the spawned/forked child will occur Xunless the -v flag was given to mail. XThe unsent letter will not be removed from the editing file ($home/.edXXXXXX) Xand may be recovered. X.PP XMany functions available to the line oriented mode (shell mode) Xare not available to the tool mode. XFor example, X.B pick Xmay not be directly accessed although experienced users may find that Xtyping pick commands within single backquotes in the \*Qrange\*U panel item Xin the header window will indeed pick messages. XThis is mostly for selecting the \*Qdelete range\*U item Xor the middle mouse button icon in the header panel. X.PP XShell escapes (of any kind) may not be called from Xthe tool/graphics mode. XThe reason for this is that there is no tty X.I window Xto run commands from. XIt is impossible to determine whether or not the user wants to run an Xinteractive program or not, so it is best to disallow its usage all together. XThe experienced window user Xcan figure out how to really do shell layers from within the tool mode. X.PP XToggling from the curses mode to the line mode to get the full Xfunctionality of the shell/line mode is unfortunately necessary Xin the name of \*Quser friendliness.\*U XMostly, this is only necessary Xfor piping of commands and using the pick command. X.PP XThe function keys and their ability to X.I work Xhas been variable depending on the version of SunWindows/SunView Xyour Sun Workstation has. From time to time, it works, but when it Xdoesn't, it seems to be related to other user or system definable Xdot-files or whatever. XI hardly use them, so I haven't had a chance Xto really debug that part much. XMy experiences have shown them to Xwork in Sun versions 2.0, 2.2, and 3.3, but not any other version. X.PP XWhen using X.B vi Xin the tool/graphics mode, periodically the window will be one Xline \*Qshort.\*U XThat is, scrolling will be off by one line and you may Xhave to redraw the window (using \*Qz.\*U in vi) to get it in sync again. XThis is a known problem with SunWindows, but Sun refuses to fix it Xas SunWindows are \*Qobsolete.\*U X.PP XWhen running on full filesystems, X.I Mush Xmay complain or not even run since it needs temporary space with which Xto work. XInstead of finding new filesystems on its own, X.I Mush Xleaves this task up to the user. XThe workaround is to set the variable X.B tmpdir Xin the initialization file to be a writable place in a filesystem that Xhas enough disk space. X.PP XMost of the other known and documented bugs Xare in the supplied README file accompanying the source. XOf course, the source is an excellent place to look as most known bugs are Xdocumented right in the source code. XA good way to track suspicious bugs is to use the X.B debug Xcommand, but note that Xthis command is very difficult to use in curses mode. END_OF_FILE if test 49215 -ne `wc -c <'mush.1.3'`; then echo shar: \"'mush.1.3'\" unpacked with wrong size! fi # end of 'mush.1.3' fi echo shar: End of archive 17 \(of 19\). cp /dev/null ark17isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 19 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.