[comp.mail.misc] Mush 5.9 diffs/new source

dheller@cory.Berkeley.EDU (Dan Heller) (11/07/87)

Here is a summary of the fixes/enhancements made to the Mail User's Shell
posted to comp.sources.unix a few weeks ago.  You can obtain a copy before
the diffs get posted by anonymous ftp to spam.istc.sri.com.  The release
there is 5.9, but the next major (posted) release will be 6.0 (pending
last minute bug reports).  One of the major changes is support for system V
compatibility.  These changes are mostly based by SunOS's claim to be
compatible with system V.  If you can't ftp to spam, but would like a
copy of the diffs in "tarmail" format, you can mail me here or at 
island!argv@ucbcad.berkeley.edu.  Remember, to use tarmail, you need
atob and compress.

The categories beflow are: makefiles and compiler flags, curses changes,
suntools (toolmode) changes, and misc enhancements.

New makefile, compiler flags, system-dependent library support:

    System V machines that aren't XENIX should use the makefile.sys.v makefile.
    The old makefile.sys.v has been moved to makefile.xenix. System-V people
    who aren't xenix may note -DUSG in the makefile.  USG is defined in 
    curses.h but is required to be in the makefile if compiling without the
    curses libraries.  It should be in the makefile anyway so you never have
    to worry about it.

    Some systems have regcmp/regex as their regular expression matching
    routines while others have re_comp/re_exec -- If you have regcmp,
    then you must have -DREGCMP in the makefile you're using. If you have
    both sets of routines, take a pick.

    Machines that use mail transfer agents that *do not* use a colon-less
    "From " line as a message separator should #define in config.h the string
    MSG_SEPARATOR.  Since this string is usually control characters, you
    need to specify actual ascii values for those characters.  Users of MMDF,
    for example, should define this to be "\001\001\001\001" since mmdf uses
    4 control-A's to separate messages.  This message separator assumes that
    there is a carriage return at the end of the string.  Systems that use
    sendmail need not concern themselves with this define.

System V:
    New functions:
	lock_file() /* returns -1 if can't lock */
	close_lock() /* unlocks and calls fclose */
    These functions also support BSD, xenix and sys-v.

    Support for termio functionality.  Macros in mush.h have been modified
    to provide for echo/cbreak modes to depending on the compiler flags:
    CURSES and SYSV/BSD/USG.  There are 6 different possible cases here.

    Problem with xenix/sys-v getting the "name" from a "From:" field since
    char pointer and char arrays are different sizes.  (hdrs.c, compose_hdr())

Misc:
    Mush now understands 'well-formed' addresses.  A well-formed address
    consists of tokens of the form:

    $path
    $path (Name or comment here)
    Name or comment <$path>
    "Name or comment" $path

    Each well formed address must be separated by commas.  Without a
    separating comma, addresses may be considered as comments of other
    addresses.  A common mistake:

    Dan Heller <island!argv@sun.com> user@foo.com

    user@foo.com will be considered as part of the comment in the first
    address since comments can be separated:

    Dan <island!argv@sun.com> Heller

    Mush will attempt to separated commas for you if it can figure it out:

    Dan Heller <island!argv@sun.com>, user@foo.bar user2@where.ever root

    Here, it's clear that after the first address (separated by a comma),
    there are no more "comment" fields because there are no comment chars.
    So, any whitespace will have commas inserted:

    Dan Heller <island!argv@sun.com>, user@foo.bar, user2@where.ever, root

    Of course, aliases follow the same rules.  Example mush commands:

    alias dan Dan Heller <island!argv@sun.com>
    alias frank Frank <frank@frankensun.com>
    mail dan frank     <- user command.
    To: dan, frank     <- note comma inserted automatically.
    Subject:

    If there is an error in an address (unbalanced brackets, parenthesis,
    quotes), parsing stops immediately and unpredictable results may occur.
    Usually, there is no change in the address, but not guaranteed.

    Tokens which expand to aliases may not have comments accompanying them:

    alias group fred, wilma, barney, betty
    To: group (The Flintstone Gang)

    This is illegal -- An alias may reference other aliases or addresses
    which have comments in them, but the alias expressed in a header field
    may not contain comments.  See the man page for more information.

    Add right justification in hdr_format format string field similar
    to printf style formatting.  Example:
    set hdr_format = '%S %-25n %7d (%l) "%s"'
    will produce a header format such that the name of the author is
    right justified 25 positions, 7 chars of the date is printed, the
    number of lines in the message and the subject surrounded by quotes.
    (hdrs.c)

    Saveopts now warns if file already exists; you must confirm overwrite.

    New variable called "wrap" has been added.  When the last message is
    deleted, next "current" message is usually the next undeleted message.
    If wrap is not set, then the curent message remains at the end of the
    list of messages.  Similarly, if "next" ('n', CR) is specified, wrapping
    to the beginning of the list only happens if the variable is set.

    "cdpath" added.  This is like csh's but note you can't use ()'s to
    set the path -- use quotes: (").  When the cd command is issued,
    if there is no cdpath set, then the directory mentioned is cd'ed to.
    If there is a cdpath and the pathname given is not a full pathname,
    then each element in the cdpath is searched for the directory specified.
    Recommend putting "." first in cdpath if one is used.

    "varargs" now used in print.c to provide support for machine that
    do not stack arguments compatible with vax/68000/etc... These machines
    are Pyramids, Sun4's and more... (print.c)

    "sendmail" -- if set, this program is used instead of the default Mail 
    Transfer Agent defined as MAIL_DELIVERY in config.h ... If used, the
    default flags -i and -m are not passed along to the MTA, so any flags
    which are necessary for the MTA should be included in the sendmail
    variable's string value.

    The temporary file used to type in messages is now _closed_ before
    invoking an editor or pager.  This is for gnuemacs users or users of
    other editors which insist on no other references to that file be open.

    New date format added (dates.c).

    Using job control (^Z/fg) which in the headers portion of a message
    (e.g. "To: ") would cause mush to be confused about what state the program
    is in and would inadvertently show a prompt (user's $prompt) even
    tho it was executing the right code (prompting for the To: line). This
    has been fixed so that the prompt isn't given, but the To: line will
    not be reprompted.

    Mailing to users from the command line and ^C-ing while in the To: or
    Subject: prompt would just report an interrupt and not abort the message;
    it now exits.(hdrs.c, set_header())

    If the user's home dir isn't writeable, or permissions changed during
    runtime, mush changes to ALTERNATE_HOME and tries again rather than just
    returning an error message.  If the alternate home also fails, an error
    is printed and the function aborted.
	(main.c, mail.c, start_file())

    When updating a folder, ignored headers are now copied back regardless
    of the variable, "alwaysignore". This is necessary because the user may
    ignore headers that are required to be read when reading in a folder.
	 (msgs.c, copy_msg())

    New command line argument: -u [user]
    /usr/spool/mail/user is used as the current folder. If "user" isn't
    specified, /usr/spool/mail/root is used.

    If -r (readonly) flag is given on the command line or to the folder/update
    commands, the folder (or spoolfile) is opened readonly and the mail is
    *not* copied into a temporary buffer.  This speeds up IO dramatically in
    systems with slow drives.

    The variable fixaddr has been removed and the auto_route feature has
    been modified to route uucp mail thru the host of the author of the
    message being replied to as well as removing redundant hostnames such as:
    host1!host2!host1!user -> host1!user

Curses:
    In curses mode, line-mode commands which contain pipes,
    :pick -s pattern | save folder
    segmentation fault on the command that follows such commands.
    The next command to execute thinks that piping is on causing a segmentation
    fault trying to reference the non-existent message list.  Fixed by
    resetting the DO_PIPE/IS_PIPE flags to off in the cmd_line() routine.
	(misc.c, cmd_line())

    Quitting now goes to the bottom of the screen rather than moving
    down one line [as well as other quit-related update bugs]
	(curses.c, case C_QUIT:)

    Updating (^U) now redraws the screen right if you weren't on the
    first "screenful" of messages. (curses.c, case C_UPDATE)

    's' (save) command wasn't saving to mbox on no input (CR).  It tried
    to save to "" which maps to "." which is a directory.  (curses.c)

    The bug causing the GOTO command to inifinite loop if there were 0
    or 1 messages in the folder if invoked by selecting a digit key has
    been fixed.  The manual entry for how the goto command works has a
    more detailed description and sites an example for effective usage.
    Due to its versatility, there can be some screen updating problems
    if the user specifies a message list which contains a command that
    produces any "stdout" type output.  Normally, this shouldn't happen,
    because most commands which are used to "search for messages" will
    not output anything if they are being "piped".  If the user wishes
    to specify a command that produces output (like echo) then the screen
    will not be updated correctly (use ^L to redraw).  See the updated
    man page entry for deatils on the above.

Tool mode:
    Trying to start tool in icon mode sometimes aborts with segementation
    fault.  This is caused by the window size being 0 and the message
    trying to be written to the empty window.  The routine which tries to
    output each line of the message to the window is recursive. If the line
    wraps because of the window's width being less than the length of the
    line, Addstr() finds the position in the line which wraps and calls
    itself recursively passing the remainder of the string.  The size of
    0 means that Addstr is calling itself at the the beginning of the string
    all the time.  The fix is in copy_msg where it checks to see if the
    window is large enough to attempt printing the message.(msgs.c, copy_msg())

    When changing folders, if there are no messages in the new folder,
    the last read message was still displayed leaving the user somewhat
    confused.  If there are no messages, the window is cleared. (folders.c)

    To be consistent with the other two interfaces, both delete and
    backspace will backspace if in type-in mode. (rite.c)

    When returning from using the editor, the window displaying the letter
    being composed would contain what the letter looked like before the editor
    was invoked.  This has been fixed by printing out the last part of the
    letter up to the size of the window available.
			...dan