home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume28 / mush / patch04b < prev    next >
Text File  |  1992-02-23  |  54KB  |  1,899 lines

  1. Newsgroups: comp.sources.misc
  2. From: bart@zigzag.z-code.com (Bart Schaefer)
  3. Subject:  v28i068:  mush - Mail User's Shell, Patch04b/2
  4. Message-ID: <1992Feb24.033819.12932@sparky.imd.sterling.com>
  5. X-Md4-Signature: df73ebc2fcce81daa2ff599e817b4448
  6. Date: Mon, 24 Feb 1992 03:38:19 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: bart@zigzag.z-code.com (Bart Schaefer)
  10. Posting-number: Volume 28, Issue 68
  11. Archive-name: mush/patch04b
  12. Environment: UNIX
  13. Patch-To: mush: Volume 18, Issue 58-79
  14.  
  15. This is Part 02 of Official Patch #4 for Mush 7.2.  To apply this patch,
  16. save this message to a file in your mush source directory and type:
  17.  
  18.     patch -N -p1 < file
  19.  
  20. See Part 01 for a description of the changes in this patch.  You can apply
  21. the two parts in any order, but you must apply both parts before applying
  22. the additional Apollo patches that are included in Part 01.
  23.  
  24. Prereq: 7.2.3"
  25. *** 7.2.3/mush.1    Wed May 22 23:29:51 1991
  26. --- 7.2.4/mush.1    Sun Feb  2 14:35:12 1992
  27. ***************
  28. *** 10,16 ****
  29.   .if n .ds - --
  30.   .if t .ds - \(em
  31.   .nh
  32. ! .TH MUSH 1 "May 22, 1991" "Version 7.2.3"
  33.   .SH NAME
  34.   The Mail User's Shell \- Shell for electronic mail.
  35.   .SH SYNOPSIS
  36. --- 10,16 ----
  37.   .if n .ds - --
  38.   .if t .ds - \(em
  39.   .nh
  40. ! .TH MUSH 1 "Feb 2, 1992" "Version 7.2.4"
  41.   .SH NAME
  42.   The Mail User's Shell \- Shell for electronic mail.
  43.   .SH SYNOPSIS
  44. ***************
  45. *** 578,583 ****
  46. --- 578,584 ----
  47.   .BR pager ,
  48.   environment PAGER, or the default pager set up by the system administrator.
  49.   This may be the internal pager.
  50. + To completely disable paging, set pager to \*QNONE\*U.
  51.   .TP
  52.   ~q
  53.   Quit message; save in ~/dead.letter if
  54. ***************
  55. *** 3057,3063 ****
  56.   If it is set, but has no value, the first \*QFrom\ \*U line is used
  57.   regardless of what headers the author's message contains.
  58.   The \*QFrom\ \*U line may be specified explicitly as an item in the
  59. ! list of reply-to headers by specifying the header \*Q\fBFrom_\fB\*U.
  60.   See the VARIABLES section for more information about
  61.   .B reply_to_hdr.
  62.   .sp
  63. --- 3058,3064 ----
  64.   If it is set, but has no value, the first \*QFrom\ \*U line is used
  65.   regardless of what headers the author's message contains.
  66.   The \*QFrom\ \*U line may be specified explicitly as an item in the
  67. ! list of reply-to headers by specifying the header \*Q\fBFrom_\fR\*U.
  68.   See the VARIABLES section for more information about
  69.   .B reply_to_hdr.
  70.   .sp
  71. ***************
  72. *** 3220,3226 ****
  73.   mail \-i $reports boss
  74.   .sp
  75.   This command sends mail to \*Qboss\*U and includes the text of all the
  76. ! messages held in the \fIreports\fP variable.
  77.   .TP
  78.   .BR sh " [command]"
  79.   Invokes an interactive version of the shell.
  80. --- 3221,3227 ----
  81.   mail \-i $reports boss
  82.   .sp
  83.   This command sends mail to \*Qboss\*U and includes the text of all the
  84. ! messages held in the \fIreports\fR variable.
  85.   .TP
  86.   .BR sh " [command]"
  87.   Invokes an interactive version of the shell.
  88. ***************
  89. *** 3486,3492 ****
  90.   command are always ignored.
  91.   Normally, ignored headers are not ignored when sending messages to
  92.   the printer, when interpolating messages into letters with ~f or ~I,
  93. ! when the `P' or `T' command is given (see the \fBprint\f command),
  94.   or with the \-I flag to the
  95.   .B mail
  96.   or
  97. --- 3487,3493 ----
  98.   command are always ignored.
  99.   Normally, ignored headers are not ignored when sending messages to
  100.   the printer, when interpolating messages into letters with ~f or ~I,
  101. ! when the `P' or `T' command is given (see the \fBprint\fR command),
  102.   or with the \-I flag to the
  103.   .B mail
  104.   or
  105. ***************
  106. *** 3664,3670 ****
  107.   See the MAIL ADDRESSES section for more detailed information
  108.   about legal mail addresses.
  109.   .sp
  110. ! Note that the -r flag to \fBreply\fR and \fRreplyall\fR overrides the
  111.   value of \fBauto_route\fR.
  112.   .TP
  113.   .B autosign
  114. --- 3665,3671 ----
  115.   See the MAIL ADDRESSES section for more detailed information
  116.   about legal mail addresses.
  117.   .sp
  118. ! Note that the -r flag to \fBreply\fR and \fBreplyall\fR overrides the
  119.   value of \fBauto_route\fR.
  120.   .TP
  121.   .B autosign
  122. *** 7.2.3/addrs.c    Thu May 16 18:28:22 1991
  123. --- 7.2.4/addrs.c    Wed Nov 13 00:53:20 1991
  124. ***************
  125. *** 654,660 ****
  126.       if (*str)
  127.           *b++ = ',', *b++ = ' ', *b = '\0';
  128.       } while (*str);
  129. !     for (b--; b > start && (*b == ',' || isspace(*b)); b--)
  130.       *b = 0;
  131.       (void) strcpy(start, buf);
  132.   }
  133. --- 654,660 ----
  134.       if (*str)
  135.           *b++ = ',', *b++ = ' ', *b = '\0';
  136.       } while (*str);
  137. !     for (b--; b > buf && (*b == ',' || isspace(*b)); b--)
  138.       *b = 0;
  139.       (void) strcpy(start, buf);
  140.   }
  141. *** 7.2.3/bind.c    Thu May 16 18:28:25 1991
  142. --- 7.2.4/bind.c    Sat Dec  7 16:51:57 1991
  143. ***************
  144. *** 292,300 ****
  145.       /* Subtract ret and iscurses to signal output */
  146.       return help(0, unbind? name+2 : name, cmd_help) - ret - iscurses;
  147.   
  148. -     if (iscurses)
  149. -     on_intr();
  150.       if (unbind) {
  151.       if (!*argv) {
  152.           char savec = complete;
  153. --- 292,297 ----
  154. ***************
  155. *** 302,312 ****
  156.           print("%s what? ", name);
  157.           len = Getstr(buf, sizeof buf, 0);
  158.           complete = savec;
  159. !         if (len <= 0) {
  160. !         if (iscurses)
  161. !             off_intr();
  162.           return -1;
  163. -         }
  164.           rawstr = m_xlate(buf);
  165.       } else
  166.           rawstr = m_xlate(*argv);
  167. --- 299,306 ----
  168.           print("%s what? ", name);
  169.           len = Getstr(buf, sizeof buf, 0);
  170.           complete = savec;
  171. !         if (len <= 0)
  172.           return -1;
  173.           rawstr = m_xlate(buf);
  174.       } else
  175.           rawstr = m_xlate(*argv);
  176. ***************
  177. *** 314,321 ****
  178.           (void) ctrl_strcpy(ascii, rawstr, TRUE);
  179.           print("\"%s\" isn't bound to a command.\n", ascii);
  180.       }
  181. -     if (iscurses)
  182. -         off_intr();
  183.       return ret;
  184.       }
  185.       if (argv && *argv) {
  186. --- 308,313 ----
  187. ***************
  188. *** 341,348 ****
  189.           print("\"%s\" isn't mapped.\n", ascii);
  190.           else
  191.           print("\"%s\" isn't bound to a command.\n", ascii);
  192. -         if (iscurses)
  193. -         off_intr();
  194.           return ret;
  195.       }
  196.       } else {
  197. --- 333,338 ----
  198. ***************
  199. *** 361,379 ****
  200.           add_to_ret = !c_macro(name, NULL, *map_list);
  201.           else
  202.           add_to_ret = !c_bind(NULL, *map_list);
  203. -         if (iscurses)
  204. -         off_intr();
  205.           /* signal CTND_CMD if there was output */
  206.           return ret - add_to_ret;
  207.       }
  208. !     if (len < 0) {
  209. !         if (iscurses)
  210. !         off_intr();
  211.           return ret;
  212. -     }
  213.       rawstr = m_xlate(string);
  214.       (void) ctrl_strcpy(ascii, rawstr, TRUE);
  215.       }
  216.       /* if a binding was given on the command line */
  217.       if (argv && *argv && !map)
  218.       if (is_bind_macro)
  219. --- 351,368 ----
  220.           add_to_ret = !c_macro(name, NULL, *map_list);
  221.           else
  222.           add_to_ret = !c_bind(NULL, *map_list);
  223.           /* signal CTND_CMD if there was output */
  224.           return ret - add_to_ret;
  225.       }
  226. !     if (len < 0)
  227.           return ret;
  228.       rawstr = m_xlate(string);
  229.       (void) ctrl_strcpy(ascii, rawstr, TRUE);
  230.       }
  231. +     if (iscurses)
  232. +     on_intr();
  233.       /* if a binding was given on the command line */
  234.       if (argv && *argv && !map)
  235.       if (is_bind_macro)
  236. *** 7.2.3/command2.c    Thu May 16 18:28:34 1991
  237. --- 7.2.4/command2.c    Sun Dec 15 10:03:34 1991
  238. ***************
  239. *** 56,62 ****
  240.   char **argv;
  241.   {
  242.       register char *p;
  243. !     char buf[128];
  244.   
  245.       if (*++argv && !strcmp(*argv, "-?"))
  246.       return help(0, "shell", cmd_help);
  247. --- 56,62 ----
  248.   char **argv;
  249.   {
  250.       register char *p;
  251. !     char buf[BUFSIZ];
  252.   
  253.       if (*++argv && !strcmp(*argv, "-?"))
  254.       return help(0, "shell", cmd_help);
  255. ***************
  256. *** 196,201 ****
  257. --- 196,202 ----
  258.   
  259.       if (argv && argv[1] && !strcmp(argv[1], "-?"))
  260.       return help(0, "stty", cmd_help);
  261. +     echo_on();
  262.       turnon(glob_flags, ECHO_FLAG);
  263.       execute(argv);
  264.       if (save_echo)
  265. *** 7.2.3/commands.c    Thu May 16 18:28:38 1991
  266. --- 7.2.4/commands.c    Wed Nov 13 01:25:17 1991
  267. ***************
  268. *** 302,308 ****
  269.       register FILE    *mail_fp = NULL_FILE;
  270.       register char     *file = NULL, *mode, firstchar = **argv, *tmp = ".";
  271.       int         msg_number, force = 0, by_subj = 0, by_author = 0;
  272. !     char        buf[MAXPATHLEN];
  273.       long         flg = 0;
  274.   
  275.       while (*++argv)
  276. --- 302,308 ----
  277.       register FILE    *mail_fp = NULL_FILE;
  278.       register char     *file = NULL, *mode, firstchar = **argv, *tmp = ".";
  279.       int         msg_number, force = 0, by_subj = 0, by_author = 0;
  280. !     char        buf[MAXPATHLEN], fbuf[MAXPATHLEN];
  281.       long         flg = 0;
  282.   
  283.       while (*++argv)
  284. ***************
  285. *** 350,356 ****
  286.       print("%s is a directory\n", file);
  287.       return -1;
  288.       }
  289. !     file = tmp;
  290.       if (force || Access(file, F_OK))
  291.       mode = "w", force = 0;
  292.       else
  293. --- 350,356 ----
  294.       print("%s is a directory\n", file);
  295.       return -1;
  296.       }
  297. !     file = strcpy(fbuf, tmp); /* getpath() called again later, save result */
  298.       if (force || Access(file, F_OK))
  299.       mode = "w", force = 0;
  300.       else
  301. ***************
  302. *** 549,555 ****
  303.       path = getpath(buf, &x);
  304.       if (x != 1 || chdir(path) == -1) {
  305.           err = errno;
  306. !         if (cdpath) {
  307.           char c;
  308.           if (p2 = any(cdpath, " \t:"))
  309.               c = *p2, *p2 = 0;
  310. --- 549,555 ----
  311.       path = getpath(buf, &x);
  312.       if (x != 1 || chdir(path) == -1) {
  313.           err = errno;
  314. !         if (cdpath && *cdpath) {
  315.           char c;
  316.           if (p2 = any(cdpath, " \t:"))
  317.               c = *p2, *p2 = 0;
  318. ***************
  319. *** 558,566 ****
  320.               *p2 = c;
  321.           while (cdpath && (isspace(*cdpath) || *cdpath == ':'))
  322.               cdpath++;
  323. !         }
  324.       }
  325. !     } while (err && cdpath && *cdpath);
  326.       if (err)
  327.       error(p);
  328.       set_cwd();
  329. --- 558,567 ----
  330.               *p2 = c;
  331.           while (cdpath && (isspace(*cdpath) || *cdpath == ':'))
  332.               cdpath++;
  333. !         } else
  334. !         break;
  335.       }
  336. !     } while (err);
  337.       if (err)
  338.       error(p);
  339.       set_cwd();
  340. *** 7.2.3/config.h-dist    Thu May 16 19:51:21 1991
  341. --- 7.2.4/config.h-dist    Sun Feb  2 14:03:44 1992
  342. ***************
  343. *** 135,158 ****
  344.   #endif /* M_XENIX */
  345.   #endif /* MMDF */
  346.   
  347.   /* If your mailer does not understand commas between addresses, you should
  348.    * define NO_COMMAS.  This includes pre-3.0 smail and default MTAs used on
  349.    * xenix, and sys-v systems.
  350. !  * This does NOT apply to MMDF or sendmail, in most cases.
  351.    */
  352.   #ifdef SUN_4_1        /* SunOS 4.1 has warped sendmail.cf */
  353.   #define NO_COMMAS /**/
  354. ! #endif /* SUN_4_1
  355.   
  356.   /*
  357. !  * Most RFC822 compliant mailers (sendmail) will add the headers From:
  358.    * and Date: on outgoing mail.  If the user or UA sends these headers,
  359. !  * most MTAs will not append them automatically.  However, there are
  360. !  * certain MTAs which will not allow this -- these "picky mailers" will
  361. !  * precede such headers with a '>' and make the headers very ugly and
  362. !  * somewhat redundant or contradictory.  It is advisable to set this
  363. !  * *UNLESS* your MTA is not RFC822 compiant -- therefore you should NOT
  364. !  * set this (xenix, sys-v).
  365.    */
  366.   /* #define PICKY_MAILER /**/
  367.   
  368. --- 135,180 ----
  369.   #endif /* M_XENIX */
  370.   #endif /* MMDF */
  371.   
  372. + #ifdef HOMEMAIL
  373. + #define MAILFILE    "Mailbox"    /* or whatever */
  374. + #else /* HOMEMAIL */
  375. + #ifndef MAILDIR
  376. + #if defined(SYSV) && !defined(SVR4)
  377. + #define MAILDIR        "/usr/mail"
  378. + #else /* BSD || SVR4 */
  379. + #define MAILDIR        "/usr/spool/mail"
  380. + #endif /* SYSV && !SVR4 */
  381. + #endif /* MAILDIR */
  382. + #endif /* HOMEMAIL */
  383.   /* If your mailer does not understand commas between addresses, you should
  384.    * define NO_COMMAS.  This includes pre-3.0 smail and default MTAs used on
  385.    * xenix, and sys-v systems.
  386. !  * This does NOT apply to MMDF or sendmail, in most cases.  SunOS 4.1 as
  387. !  * shipped needs this, but note that if you are allowing mush to default
  388. !  * to SUN_4_1 (see the end of this file) you won't get this.
  389.    */
  390.   #ifdef SUN_4_1        /* SunOS 4.1 has warped sendmail.cf */
  391.   #define NO_COMMAS /**/
  392. ! #endif /* SUN_4_1 */
  393.   
  394.   /*
  395. !  * Most RFC822-compliant mailers (sendmail) will add the headers From:
  396.    * and Date: on outgoing mail.  If the user or UA sends these headers,
  397. !  * such MTAs will generally use the headers as the user or UA set them.
  398. !  * Mailers that are not RFC822-compliant sometimes fail to add these
  399. !  * headers at all, so the UA must supply them.  Mush normally does so.
  400. !  *
  401. !  * However, there are certain MTAs which will insist on adding new From:
  402. !  * and Date: headers.  These "picky mailers" may remove the user or UA 
  403. !  * From: and Date: headers, or they may leave them but insert a leading
  404. !  * '>', which makes the headers very ugly and redundant or contradictory.
  405. !  * PICKY_MAILER prevents mush from adding From: or Date:, so the MTA can.
  406. !  *
  407. !  * Many RFC822-compliant mailers are "picky", including certain sendmail
  408. !  * configurations.  It is advisable to set PICKY_MAILER *UNLESS* your MTA
  409. !  * is known not to be RFC822 compiant (xenix, older sys-v) or can be
  410. !  * counted on to pass through user-defined headers without modification.
  411.    */
  412.   /* #define PICKY_MAILER /**/
  413.   
  414. ***************
  415. *** 169,176 ****
  416.    */
  417.   /* #define GETWD    /**/
  418.   
  419. ! #ifdef HOMEMAIL
  420. ! #define MAILFILE    "Mailbox"    /* or whatever */
  421. ! #else /* HOMEMAIL */
  422. ! #define MAILDIR        "/usr/spool/mail"
  423. ! #endif /* HOMEMAIL */
  424. --- 191,250 ----
  425.    */
  426.   /* #define GETWD    /**/
  427.   
  428. ! /* If your system has the BSD-style directory routines (opendir/readdir),
  429. !  * define DIRECTORY.  This happens automatically in glob.h for BSD.
  430. !  */
  431. ! #ifdef SVR4
  432. ! #define DIRECTORY
  433. ! #endif /* SVR4 */
  434. ! /* If your system has the POSIX "utimbuf" structure for utime(2),
  435. !  * define POSIX_UTIME.  You may have to change <sys/utime.h> to <utime.h>
  436. !  * in mush.h.
  437. !  */
  438. ! #if defined(SVR4) && !defined(sun)
  439. ! #define POSIX_UTIME
  440. ! #endif /* SVR4 && !sun */
  441. ! /* The remainder of this file attempt to automatically supply some sanity.
  442. !  * You shouldn't need to change this part unless your system is really odd.
  443. !  */
  444. ! #ifdef BSD
  445. ! #    undef SYSV /* Sorry, can't do both BSD and SYSV */
  446. ! #    undef SVR4
  447. ! #    undef SVR3
  448. ! #    undef SVR2
  449. ! #endif /* BSD */
  450. ! #if defined(SUNTOOL) || defined(SUN_3_5) || defined(SUN_4_0) || defined(SUN_4_1)
  451. ! #if !defined(BSD) && !defined(SYSV)
  452. ! #    define BSD /* default to BSD */
  453. ! #endif /* !BSD && !SYSV */
  454. ! #if !defined(SUN_3_5) && !defined(SUN_4_0)
  455. ! #    ifndef SUN_4_1
  456. ! #        define SUN_4_1 /* default to sun 4.1 */
  457. ! #    endif /* SUN_4_1 */
  458. ! #    define SUN_4_0 /* 4.0 stuff needed too */
  459. ! #endif /* !SUN_3_5 && !SUN_4_0 */
  460. ! #ifdef SUN_4_0
  461. ! #    undef SUN_3_5
  462. ! #    undef SIGRET
  463. ! #    define SIGRET void
  464. ! #endif /* SUN_4_0 */
  465. ! #endif /* SUNTOOL || SUN_3_5 || SUN_4_0 || SUN_4_1 */
  466. ! #ifdef SVR4
  467. ! #    undef SVR3
  468. ! #    undef SYSV
  469. ! #    define SYSV
  470. ! #else
  471. ! #ifdef SYSV
  472. ! #    undef SVR3
  473. ! #    ifndef SVR2
  474. ! #        define SVR3
  475. ! #    endif /* SVR2 */
  476. ! #endif /* SYSV */
  477. ! #endif /* SVR4 */
  478. ! #ifdef SVR3
  479. ! #    undef SYSV
  480. ! #    define SYSV
  481. ! #endif /* SVR3 */
  482. *** 7.2.3/curses.c    Thu May 16 18:28:46 1991
  483. --- 7.2.4/curses.c    Wed Jan 29 23:52:31 1992
  484. ***************
  485. *** 538,543 ****
  486. --- 538,544 ----
  487.           c = Getstr(file, COLS-22, 0);
  488.           off_intr();
  489.           if (c > 0) {
  490. +             int do_up = 0;
  491.               if (!strcmp(file, "?")) {
  492.               clr_bot_line();
  493.               iscurses = 0;
  494. ***************
  495. *** 552,564 ****
  496.                * then we need to reset the updatability of current folder
  497.                */
  498.               c = (ison(glob_flags, DO_UPDATE))? TRUE : FALSE;
  499. !             if (strcmp(file, "-?")) {
  500. !             redo = 1; /* so vrfy_update() won't quit */
  501. !             (void) vrfy_update(&redo);
  502.               }
  503.               move(LINES-1, 0), refresh();
  504. !             if (cmd_line(sprintf(buf, "folder ! -N %s", file),
  505. !                  msg_list) == -1) {
  506.               if (c) /* remember state of updatability of folder */
  507.                   turnon(glob_flags, DO_UPDATE);
  508.               if (ison(glob_flags, CNTD_CMD))
  509. --- 553,565 ----
  510.                * then we need to reset the updatability of current folder
  511.                */
  512.               c = (ison(glob_flags, DO_UPDATE))? TRUE : FALSE;
  513. !             if (strcmp(file, "-?") != 0) {
  514. !             redo = -1; /* so vrfy_update() won't update or quit */
  515. !             do_up = vrfy_update(&redo);
  516.               }
  517.               move(LINES-1, 0), refresh();
  518. !             if (cmd_line(sprintf(buf, "folder %s -N %s",
  519. !                     do_up? "" : "!", file), msg_list) == -1) {
  520.               if (c) /* remember state of updatability of folder */
  521.                   turnon(glob_flags, DO_UPDATE);
  522.               if (ison(glob_flags, CNTD_CMD))
  523. ***************
  524. *** 789,794 ****
  525. --- 790,797 ----
  526.           putchar('\n');
  527.           return 0;
  528.       }
  529. +     if (*redo < 0)
  530. +         return 1;
  531.       } else if (*redo)
  532.       return 1;
  533.       if (cmd_line(strcpy(buf, *redo? "update" : "quit"), msg_list) != -1
  534. *** 7.2.3/digestify    Thu May  3 12:39:52 1990
  535. --- 7.2.4/digestify    Mon Dec 16 10:59:23 1991
  536. ***************
  537. *** 1,6 ****
  538. ! #! ../bin/mush -F!
  539.   #
  540.   # Mush digestifier.  Makes a folder or a list of messages into a digest.
  541.   #
  542.   # A "digest" is a collection of E-mail messages bundled together into a
  543.   # single message for ease of redistribution.  The individual messages
  544. --- 1,10 ----
  545. ! #! /bin/csh -f
  546.   #
  547.   # Mush digestifier.  Makes a folder or a list of messages into a digest.
  548. + #
  549. + if ! $?thisfolder then
  550. +     exec mush -F! $0 $*
  551. + endif
  552.   #
  553.   # A "digest" is a collection of E-mail messages bundled together into a
  554.   # single message for ease of redistribution.  The individual messages
  555. *** 7.2.3/execute.c    Sun Oct 21 19:24:32 1990
  556. --- 7.2.4/execute.c    Thu Jan 30 00:11:31 1992
  557. ***************
  558. *** 1,13 ****
  559.   /* execute.c     (c) copyright    10/28/86 (Dan Heller) */
  560.   
  561.   #include "mush.h"
  562. ! #ifdef BSD
  563.   #include <sys/wait.h>
  564.   #else
  565.   #ifndef SYSV
  566.   #include <wait.h>
  567.   #endif /* SYSV */
  568. ! #endif /* BSD */
  569.   
  570.   #ifdef lint
  571.   #include <sys/resource.h>
  572. --- 1,13 ----
  573.   /* execute.c     (c) copyright    10/28/86 (Dan Heller) */
  574.   
  575.   #include "mush.h"
  576. ! #if defined(BSD) || defined(IRIX4)
  577.   #include <sys/wait.h>
  578.   #else
  579.   #ifndef SYSV
  580.   #include <wait.h>
  581.   #endif /* SYSV */
  582. ! #endif /* BSD || IRIX4 */
  583.   
  584.   #ifdef lint
  585.   #include <sys/resource.h>
  586. ***************
  587. *** 149,155 ****
  588.   #endif /* SYSV */
  589.       int       pid;
  590.   
  591. ! #ifdef BSD
  592.       while ((pid = wait3(&status, WNOHANG, (struct rusage *)0)) > 0) {
  593.       Debug("%d died...\n", pid);
  594.       if (pid == exec_pid)
  595. --- 149,155 ----
  596.   #endif /* SYSV */
  597.       int       pid;
  598.   
  599. ! #if defined(BSD) || defined(IRIX4)
  600.       while ((pid = wait3(&status, WNOHANG, (struct rusage *)0)) > 0) {
  601.       Debug("%d died...\n", pid);
  602.       if (pid == exec_pid)
  603. ***************
  604. *** 163,169 ****
  605.       while ((pid = wait((int *)0)) > 0 && pid != exec_pid)
  606.       Debug("%d died...\n", pid);
  607.   #endif /* SYSV */
  608. ! #endif /* BSD */
  609.       if (pid == exec_pid && pid > 0) {
  610.       exec_pid = 0;
  611.       longjmp(execjbuf, 1);
  612. --- 163,169 ----
  613.       while ((pid = wait((int *)0)) > 0 && pid != exec_pid)
  614.       Debug("%d died...\n", pid);
  615.   #endif /* SYSV */
  616. ! #endif /* BSD || IRIX4 */
  617.       if (pid == exec_pid && pid > 0) {
  618.       exec_pid = 0;
  619.       longjmp(execjbuf, 1);
  620. *** 7.2.3/file.c    Wed May 22 18:18:13 1991
  621. --- 7.2.4/file.c    Thu Jan 30 20:50:48 1992
  622. ***************
  623. *** 3,8 ****
  624. --- 3,15 ----
  625.   #include "mush.h"
  626.   #include <pwd.h>
  627.   
  628. + #ifdef SYSV
  629. + #ifdef EWOULDBLOCK
  630. + #undef EWOULDBLOCK
  631. + #endif /* EWOULDBLOCK */
  632. + #define EWOULDBLOCK     EAGAIN
  633. + #endif /* SYSV */
  634.   /* takes string 'p' and address of int (isdir).  If p uses the ~ to reference
  635.    * a home directory of some sort, then expand it.  find out what sort of
  636.    * file final path is. set isdir to 1 if a directory, 0 if not, -1 on error
  637. ***************
  638. *** 461,467 ****
  639.   char *file, *mode;
  640.   {
  641.       int omask = umask(077);
  642. !     FILE *fp = fopen(file, mode);
  643.       (void) umask(omask);
  644.       return fp;
  645.   }
  646. --- 468,489 ----
  647.   char *file, *mode;
  648.   {
  649.       int omask = umask(077);
  650. !     FILE *fp;
  651. ! #ifdef SYSV
  652. !     /* XENIX and other older sytems can't handle "a+".    Even newer
  653. !      * SysV systems define a+ such that all writes go at end-of-file,
  654. !      * not at whatever the current seek position is.  Good grief.
  655. !      */
  656. !     if (strcmp(mode, "a+") == 0) {
  657. !     if (Access(file, F_OK) == 0)
  658. !         mode = "r+";
  659. !     else
  660. !         mode = "w+";
  661. !     if (fp = fopen(file, mode))
  662. !         (void) fseek(fp, 0L, 2); /* assure we're at the end of the file */
  663. !     } else
  664. ! #endif /* SYSV */
  665. !     fp = fopen(file, mode);
  666.       (void) umask(omask);
  667.       return fp;
  668.   }
  669. *** 7.2.3/folders.c    Thu May 16 18:28:55 1991
  670. --- 7.2.4/folders.c    Fri Jan 17 09:02:29 1992
  671. ***************
  672. *** 227,238 ****
  673.       if (msg_cnt && (!updating || current_msg < 0))
  674.       current_msg = (n == msg_cnt ? 0 : n);
  675.   
  676. -     if ((!istool || istool && !msg_cnt) && !iscurses)
  677. -     mail_status(0);
  678.       /* be quiet if we're piping */
  679.       if (!istool && !updating && !no_hdrs && msg_cnt
  680. !         && isoff(glob_flags, DO_PIPE))
  681.       (void) cmd_line(sprintf(buf, "headers %d", current_msg+1), msg_list);
  682.   #ifdef SUNTOOL
  683.       if (istool > 1) {
  684.       if (!msg_cnt)
  685. --- 227,239 ----
  686.       if (msg_cnt && (!updating || current_msg < 0))
  687.       current_msg = (n == msg_cnt ? 0 : n);
  688.   
  689.       /* be quiet if we're piping */
  690.       if (!istool && !updating && !no_hdrs && msg_cnt
  691. !         && isoff(glob_flags, DO_PIPE)) {
  692. !     if ((!istool || istool && !msg_cnt) && !iscurses)
  693. !         mail_status(0);
  694.       (void) cmd_line(sprintf(buf, "headers %d", current_msg+1), msg_list);
  695. +     }
  696.   #ifdef SUNTOOL
  697.       if (istool > 1) {
  698.       if (!msg_cnt)
  699. *** 7.2.3/hdrs.c    Thu May 16 18:29:00 1991
  700. --- 7.2.4/hdrs.c    Wed Nov 13 01:27:59 1991
  701. ***************
  702. *** 350,356 ****
  703.   int cnt, show_to;
  704.   char *hdr_fmt;
  705.   {
  706. !     static char        buf[256];
  707.       register char    *p, *p2, *b;
  708.       int            len, do_pad = FALSE, val, pad, got_dot, isauthor = 0, n;
  709.       char from[HDRSIZ], subject[256], date[64], lines[16];
  710. --- 350,356 ----
  711.   int cnt, show_to;
  712.   char *hdr_fmt;
  713.   {
  714. !     static char        buf[HDRSIZ];
  715.       register char    *p, *p2, *b;
  716.       int            len, do_pad = FALSE, val, pad, got_dot, isauthor = 0, n;
  717.       char from[HDRSIZ], subject[256], date[64], lines[16];
  718. ***************
  719. *** 357,362 ****
  720. --- 357,366 ----
  721.       char to[256], addr[256], name[256], user[256], status[4];
  722.       char Day[3], Mon[4], Tm[8], Yr[5], Wkday[4], Zone[8], *date_p;
  723.   
  724. +     buf[0] = 0;
  725. +     if (msg_cnt < 1)
  726. +     return buf;
  727.       /* status of the message */
  728.       if (ison(msg[cnt].m_flags, DELETE))
  729.       status[0] = '*';
  730. ***************
  731. *** 739,746 ****
  732.       if (!*p)
  733.       if (p2) /* take_me_off() was not done */
  734.           (void) strcpy(buf, login);
  735.       else
  736. !         (void) sprintf(buf, "%s <%s>", name, addr);
  737.       return buf;
  738.   }
  739.   
  740. --- 743,752 ----
  741.       if (!*p)
  742.       if (p2) /* take_me_off() was not done */
  743.           (void) strcpy(buf, login);
  744. +     else if (index(name, '"'))
  745. +         (void) sprintf(buf, "<%s> (%s)", addr, name);
  746.       else
  747. !         (void) sprintf(buf, "\"%s\" <%s>", name, addr);
  748.       return buf;
  749.   }
  750.   
  751. *** 7.2.3/init.c    Wed May 22 21:57:02 1991
  752. --- 7.2.4/init.c    Thu Jan 30 00:14:42 1992
  753. ***************
  754. *** 4,16 ****
  755.   #include "mush.h"
  756.   #include <pwd.h>
  757.   
  758. ! #ifdef BSD
  759.   #include <netdb.h>
  760. ! #endif /* BSD */
  761.   
  762. ! #if defined(SYSV) && !defined(HPUX)
  763.   #include <sys/utsname.h>
  764. ! #endif /* SYSV && !HPUX */
  765.   
  766.   void
  767.   init()
  768. --- 4,16 ----
  769.   #include "mush.h"
  770.   #include <pwd.h>
  771.   
  772. ! #if defined(BSD) || defined(HPUX) || defined(IRIX4)
  773.   #include <netdb.h>
  774. ! #endif /* BSD || HPUX || IRIX4 */
  775.   
  776. ! #if defined(SYSV) && !defined(HPUX) && !defined(IRIX4)
  777.   #include <sys/utsname.h>
  778. ! #endif /* SYSV && !HPUX && !IRIX4 */
  779.   
  780.   void
  781.   init()
  782. ***************
  783. *** 18,35 ****
  784.       char         *home, *realname, *argv[4];
  785.       extern char        *getlogin();
  786.       char        buf[MAXPATHLEN];
  787. ! #if defined(SYSV) && !defined(HPUX)
  788.       extern struct passwd *getpwuid();  /* sys-v forgot this in pwd.h! */
  789.       struct utsname ourhost;
  790.   #else
  791.       char ourhost[128];
  792. ! #endif /* SYSV && !HPUX */
  793.       register char     *p;
  794.       struct passwd     *entry;
  795.       int            cnt;
  796. ! #if defined(BSD) || defined(HPUX)
  797.       struct hostent     *hp;
  798. ! #endif /* BSD || HPUX */
  799.   
  800.       home = getenv("HOME");
  801.       if (realname = getenv("NAME")) {
  802. --- 18,35 ----
  803.       char         *home, *realname, *argv[4];
  804.       extern char        *getlogin();
  805.       char        buf[MAXPATHLEN];
  806. ! #if defined(SYSV) && !defined(HPUX) && !defined(IRIX4)
  807.       extern struct passwd *getpwuid();  /* sys-v forgot this in pwd.h! */
  808.       struct utsname ourhost;
  809.   #else
  810.       char ourhost[128];
  811. ! #endif /* SYSV && !HPUX && !IRIX4 */
  812.       register char     *p;
  813.       struct passwd     *entry;
  814.       int            cnt;
  815. ! #if defined(BSD) || defined(HPUX) || defined(IRIX4)
  816.       struct hostent     *hp;
  817. ! #endif /* BSD || HPUX || IRIX4 */
  818.   
  819.       home = getenv("HOME");
  820.       if (realname = getenv("NAME")) {
  821. ***************
  822. *** 42,48 ****
  823.       if (p = getlogin())
  824.           strdup(login, p);
  825.       else {
  826. !         login = "unknown";
  827.           print("I don't know you, but that's ok.\n");
  828.       }
  829.       else {
  830. --- 42,48 ----
  831.       if (p = getlogin())
  832.           strdup(login, p);
  833.       else {
  834. !         strdup(login, "unknown");
  835.           print("I don't know you, but that's ok.\n");
  836.       }
  837.       else {
  838. ***************
  839. *** 66,77 ****
  840.           error(home);
  841.       else
  842.           print("No home!? ");
  843. !     print_more("Using \"%s\" as home.\n", ALTERNATE_HOME);
  844.       } else {
  845.       argv[0] = "home";
  846.       argv[2] = home;
  847.       (void) add_option(&set_options, argv);
  848.       }
  849.       if (realname && *buf) {
  850.       /* realname has already been copied to buf */
  851.       argv[0] = "realname";
  852. --- 66,88 ----
  853.           error(home);
  854.       else
  855.           print("No home!? ");
  856. !     print_more("Using \"%s\" as home.\n", home = ALTERNATE_HOME);
  857.       } else {
  858.       argv[0] = "home";
  859.       argv[2] = home;
  860.       (void) add_option(&set_options, argv);
  861.       }
  862. + #ifdef HOMEMAIL
  863. +     strdup(spoolfile, sprintf(buf, "%s/%s", home, MAILFILE));
  864. + #else /* HOMEMAIL */
  865. +     if ((p = getenv("MAIL")) && *p)
  866. +     strdup(spoolfile, p);
  867. +     else
  868. +     strdup(spoolfile, sprintf(buf, "%s/%s", MAILDIR, login));
  869. + #endif /* HOMEMAIL */
  870. +     mailfile = "";
  871.       if (realname && *buf) {
  872.       /* realname has already been copied to buf */
  873.       argv[0] = "realname";
  874. ***************
  875. *** 84,90 ****
  876.       escape = DEF_ESCAPE;
  877.       prompt = DEF_PROMPT;
  878.   
  879. ! #if defined(BSD) || defined(HPUX)
  880.       (void) gethostname(ourhost, sizeof ourhost);
  881.       if (!(hp = gethostbyname(ourhost))) {
  882.       if (ourname = (char **)calloc((unsigned)2, sizeof (char *)))
  883. --- 95,101 ----
  884.       escape = DEF_ESCAPE;
  885.       prompt = DEF_PROMPT;
  886.   
  887. ! #if defined(BSD) || defined(HPUX) || defined(IRIX4)
  888.       (void) gethostname(ourhost, sizeof ourhost);
  889.       if (!(hp = gethostbyname(ourhost))) {
  890.       if (ourname = (char **)calloc((unsigned)2, sizeof (char *)))
  891. ***************
  892. *** 103,110 ****
  893.           strdup(ourname[0], ourhost); /* cnt better be 0! */
  894.       }
  895.       }
  896. ! #endif /* BSD || HPUX */
  897. ! #if defined(SYSV) && !defined(HPUX)
  898.       if (ourname = (char **)calloc((unsigned)2, sizeof (char *))) {
  899.       if ((uname (&ourhost) >= 0) && (*ourhost.nodename))
  900.           ourname[0] = savestr(ourhost.nodename);
  901. --- 114,121 ----
  902.           strdup(ourname[0], ourhost); /* cnt better be 0! */
  903.       }
  904.       }
  905. ! #else
  906. ! #ifdef SYSV
  907.       if (ourname = (char **)calloc((unsigned)2, sizeof (char *))) {
  908.       if ((uname (&ourhost) >= 0) && (*ourhost.nodename))
  909.           ourname[0] = savestr(ourhost.nodename);
  910. ***************
  911. *** 124,130 ****
  912.           }
  913.       }
  914.       }
  915. ! #endif /* SYSV && !HPUX */
  916.       if (ourname && ourname[0]) {
  917.       for (p = buf, cnt = 0; ourname[cnt]; cnt++) {
  918.           if (cnt)
  919. --- 135,142 ----
  920.           }
  921.       }
  922.       }
  923. ! #endif /* SYSV */
  924. ! #endif /* BSD || HPUX || IRIX4 */
  925.       if (ourname && ourname[0]) {
  926.       for (p = buf, cnt = 0; ourname[cnt]; cnt++) {
  927.           if (cnt)
  928. ***************
  929. *** 251,259 ****
  930.   
  931.       exited = 0;
  932.   
  933. !     while (p = fgets(&line[cont_line], BUFSIZ - cont_line, fp)) {
  934.       (*line_no)++;
  935. !     if (*(p2 = no_newln(p)) == '\\') {
  936.           *p2++ = ' ';
  937.           cont_line = p2 - line;
  938.           continue;
  939. --- 263,279 ----
  940.   
  941.       exited = 0;
  942.   
  943. !     while (p = fgets(&line[cont_line], BUFSIZ - cont_line - 1, fp)) {
  944.       (*line_no)++;
  945. !     if (p2 = index(p, '\n'))
  946. !         while (p2 > p && *p2 == '\n' || isspace(*p2))
  947. !         *p2-- = 0;  /* get rid of newline and trailing spaces */
  948. !     else {
  949. !         print("%s: line %d:%s line too long, truncated at %d characters.\n",
  950. !         file, *line_no, cont_line? " continued" : "", BUFSIZ);
  951. !         p2 = no_newln(p);
  952. !     }
  953. !     if (*p2 == '\\') {
  954.           *p2++ = ' ';
  955.           cont_line = p2 - line;
  956.           continue;
  957. *** 7.2.3/lock.c    Thu May 16 20:13:14 1991
  958. --- 7.2.4/lock.c    Sun Feb  2 19:43:53 1992
  959. ***************
  960. *** 15,25 ****
  961. --- 15,126 ----
  962.   #endif /* SYSV && !USG */
  963.   
  964.   #ifdef DOT_LOCK
  965. + #ifndef DOLOCK_PATH
  966. + #define DOLOCK_PATH    "dotlock"    /* Path to the executable */
  967. + #endif /* DOLOCK_PATH */
  968. + #ifndef DOLOCK_NAME
  969. + #define DOLOCK_NAME    "dotlock"    /* Name of the executable */
  970. + #endif /* DOLOCK_NAME */
  971. + #define DOLOCKIT    "-l"
  972. + #define UNLOCKIT    "-u"
  973. + #ifdef LOCK_PROG        /* Define for standalone locking program */
  974. + /* System V Release 2 does not support saved-set-group-id, so it is not
  975. +  * sufficient for mush to be setgid mail (or whatever group has write
  976. +  * permission on /usr/mail).  Instead, we need an external program that
  977. +  * can be setgid, which mush then runs to create and remove lock files.
  978. +  * Compiling this file with -DDOT_LOCK -DLOCK_PROG added to your CFLAGS
  979. +  * will generate such a program.
  980. +  *
  981. +  * For mush purposes, you should hardwire the DOLOCK_PATH to the full path
  982. +  * name of the installed executable.  This helps prevent malicious users
  983. +  * from substituting a different program.
  984. +  *
  985. +  * The program generated can also be used to perform mail locking from
  986. +  * shell scripts, so you may wish to consider installing it (or a copy)
  987. +  * in a publicly accessible location, e.g. /usr/local/bin.  Note that
  988. +  * this program is not compatible with Xenix mail locking!
  989. +  */
  990. + #undef    on_intr()
  991. + #define    on_intr()    0
  992. + #undef    off_intr()
  993. + #define    off_intr()    0
  994. + #undef    print
  995. + #define    print        printf
  996. + #undef    print_more
  997. + #define    print_more    fflush(stdout), printf
  998. + #undef    error
  999. + #define    error        printf
  1000. + #undef    sprintf
  1001. + /* Simple dotlock program.  Exits 0 for success, nonzero for failure.
  1002. +  *
  1003. +  * Usage:
  1004. +  *    dotlock -lock filename
  1005. +  *    dotlock -unlock filename
  1006. +  *
  1007. +  * The options can be abbreviated to their first letter (-l or -u);
  1008. +  * any other usage fails silently.
  1009. +  */
  1010. + main(argc, argv)
  1011. + int argc;
  1012. + char **argv;
  1013. + {
  1014. +     char *myname = rindex(argv[0], '/');
  1015. +     if (!myname)
  1016. +     myname = argv[0];
  1017. +     if (strcmp(myname, DOLOCK_NAME) != 0 || argc != 3) 
  1018. +     exit(-1);
  1019. +     
  1020. +     if (strncmp(argv[1], DOLOCKIT, 2) == 0)
  1021. +     dot_lock(argv[2]);
  1022. +     else if (strncmp(argv[1], UNLOCKIT, 2) == 0)
  1023. +     dot_unlock(argv[2]);
  1024. +     exit(-1);
  1025. + }
  1026. + #else /* !LOCK_PROG */
  1027.   extern int sgid;
  1028.   #ifdef BSD
  1029.   extern int rgid;
  1030.   #endif /* BSD */
  1031.   
  1032. + #ifdef SVR2
  1033. + /* No saved-setgid, so fork just long enough to create the lockfile. */
  1034. + lock_proc(filename, how)
  1035. + char *filename, *how;
  1036. + {
  1037. +     int kid, pid, status;
  1038. +     errno = 0;
  1039. +     switch (kid = fork()) {
  1040. +     case 0:
  1041. +         execle(DOLOCK_PATH, DOLOCK_NAME, how, filename, NULL, environ);
  1042. +         return kid;
  1043. +     case -1:
  1044. +         error("Unable to fork to change group id");
  1045. +         return -1;
  1046. +     default:
  1047. +         /* For SYSV, we're not doing SIGCLD handling, so go ahead
  1048. +          * and reap everything in sight until we get the one we want.
  1049. +          */
  1050. +         while ((pid = wait(&status)) != -1 && pid != kid)
  1051. +         ;
  1052. +         if (pid == kid)
  1053. +         errno = ((status & 0xf) == 0) ? (status >> 8) & 0xf : 0
  1054. +         return errno ? -1 : 0;
  1055. +     }
  1056. + }
  1057. + #endif /* SVR2 */
  1058. + #endif /* LOCK_PROG */
  1059.   dot_lock(filename)
  1060.   char *filename;
  1061.   {
  1062. ***************
  1063. *** 27,32 ****
  1064. --- 128,134 ----
  1065.       int lockfd, cnt = 0;
  1066.       SIGRET (*oldint)(), (*oldquit)();
  1067.   
  1068. + #ifndef LOCK_PROG
  1069.   #ifdef SYSV
  1070.       /* Only the spoolfile needs to be dot_locked -- other files are
  1071.        * handled by lock_fopen, below.  To avoid collisions with 14-char
  1072. ***************
  1073. *** 34,45 ****
  1074.        */
  1075.       if (strcmp(spoolfile, filename) != 0)
  1076.       return 0;
  1077. ! #endif
  1078.   #ifdef BSD
  1079.       setregid(rgid, sgid);
  1080.   #else /* BSD */
  1081.       setgid(sgid);
  1082.   #endif /* BSD */
  1083.   #ifdef M_XENIX
  1084.       (void) sprintf(buf, "/tmp/%.10s.mlk", login);
  1085.   #else /* M_XENIX */
  1086. --- 136,151 ----
  1087.        */
  1088.       if (strcmp(spoolfile, filename) != 0)
  1089.       return 0;
  1090. ! #ifdef SVR2
  1091. !     return lock_proc(filename, DOLOCKIT);
  1092. ! #endif /* SVR2 */
  1093. ! #endif /* SYSV */
  1094.   #ifdef BSD
  1095.       setregid(rgid, sgid);
  1096.   #else /* BSD */
  1097.       setgid(sgid);
  1098.   #endif /* BSD */
  1099. + #endif /* !LOCK_PROG */
  1100.   #ifdef M_XENIX
  1101.       (void) sprintf(buf, "/tmp/%.10s.mlk", login);
  1102.   #else /* M_XENIX */
  1103. ***************
  1104. *** 67,72 ****
  1105. --- 173,183 ----
  1106.           print("done.\n");
  1107.       (void) close(lockfd);
  1108.       }
  1109. + #ifdef LOCK_PROG
  1110. +     if (lockfd < 0)
  1111. +     print_more("\n");
  1112. +     exit(lockfd < 0? errno : 0);
  1113. + #else /* !LOCK_PROG */
  1114.   #ifdef BSD
  1115.       setregid(sgid, rgid);
  1116.   #else
  1117. ***************
  1118. *** 73,81 ****
  1119. --- 184,251 ----
  1120.       setgid(getgid());
  1121.   #endif /* BSD */
  1122.       return lockfd == -1? -1 : 0;
  1123. + #endif /* LOCK_PROG */
  1124.   }
  1125. + dot_unlock(filename)
  1126. + char *filename;
  1127. + {
  1128. +     char buf[MAXPATHLEN], *p;
  1129. + #if !defined(M_XENIX) || defined(LOCK_PROG)
  1130. +     (void) sprintf(buf, "%s.lock", filename);
  1131. + #ifndef LOCK_PROG
  1132. +     {
  1133. +     /* If the file was locked through open_file(), we may not have
  1134. +      * a complete pathname to work with here.  Expand it and test
  1135. +      * whether we need to unlink at all.  This should really be
  1136. +      * handled by having open_file() return the name it used, but
  1137. +      * that breaks too many other things at the moment.
  1138. +      */
  1139. +     int isdir = 0;
  1140. +     p = getpath(buf, &isdir);
  1141. +     if (isdir)
  1142. +         return 0;
  1143. +     (void) strcpy(buf, p);
  1144. +     }
  1145. + #ifdef SYSV
  1146. +     if (strncmp(spoolfile, buf, strlen(spoolfile)) != 0)
  1147. +     return 0;
  1148. + #ifdef SVR2
  1149. +     p = rindex(buf, '.');
  1150. +     *p = 0;
  1151. +     return lock_proc(buf, UNLOCKIT);
  1152. + #endif /* SVR2 */
  1153. + #endif /* SYSV */
  1154. + #else /* LOCK_PROG */
  1155. +     errno = 0;
  1156. + #endif /* !LOCK_PROG */
  1157. + #else /* M_XENIX && !LOCK_PROG */
  1158. +     (void) sprintf(buf, "/tmp/%.10s.mlk", login);
  1159. + #endif /* !M_XENIX || LOCK_PROG */
  1160. + #ifndef LOCK_PROG
  1161. + #ifdef BSD
  1162. +     setregid(rgid, sgid);
  1163. + #else /* BSD */
  1164. +     setgid(sgid);
  1165. + #endif /* BSD */
  1166. + #endif /* !LOCK_PROG */
  1167. +     (void) unlink(buf);
  1168. + #ifdef LOCK_PROG
  1169. +     exit(errno);
  1170. + #else /* !LOCK_PROG */
  1171. + #ifdef BSD
  1172. +     setregid(sgid, rgid);
  1173. + #else
  1174. +     setgid(getgid());
  1175. + #endif /* BSD */
  1176. + #endif /* LOCK_PROG */
  1177. +     return 0;
  1178. + }
  1179.   #endif /* DOT_LOCK */
  1180.   
  1181. + #ifndef LOCK_PROG
  1182.   #ifdef SYSV
  1183.   
  1184.   /*
  1185. ***************
  1186. *** 139,144 ****
  1187. --- 309,322 ----
  1188.           errno = EWOULDBLOCK;
  1189.           return NULL_FILE;
  1190.       }
  1191. + #ifdef DOT_LOCK
  1192. +     /* For additional assurance that each file is opened only once,
  1193. +      * and for ease of recovery from interrupts and errors, do the
  1194. +      * dot-locking here and unlock in exclusive_fclose().
  1195. +      */
  1196. +     if (dot_lock(filename) != 0)
  1197. +     return NULL_FILE;
  1198. + #endif /* DOT_LOCK */
  1199.       if (!(fp = mask_fopen(filename, mode)))
  1200.       return NULL_FILE;
  1201.       if (tmp = (struct options *)malloc(sizeof(struct options))) {
  1202. ***************
  1203. *** 171,176 ****
  1204. --- 349,357 ----
  1205.           exclude_list = tmp1->next;
  1206.           else
  1207.           tmp2->next = tmp1->next;
  1208. + #ifdef DOT_LOCK
  1209. +         dot_unlock(tmp1->option);
  1210. + #endif /* DOT_LOCK */
  1211.           xfree(tmp1->option);
  1212.   #ifndef LCKDFLDIR
  1213.           /* LCKDFLDIR needs lk_fclose(), so let caller do it */
  1214. ***************
  1215. *** 201,211 ****
  1216.       return NULL_FILE;
  1217.       }
  1218.   
  1219. ! #ifdef DOT_LOCK
  1220. !     if (dot_lock(filename) == 0)
  1221. ! #endif /* DOT_LOCK */
  1222. !     mail_fp = exclusive_fopen(filename, mode);
  1223. !     if (!mail_fp)
  1224.       return NULL_FILE;
  1225.       fd = fileno(mail_fp);
  1226.   
  1227. --- 382,388 ----
  1228.       return NULL_FILE;
  1229.       }
  1230.   
  1231. !     if (!(mail_fp = exclusive_fopen(filename, mode)))
  1232.       return NULL_FILE;
  1233.       fd = fileno(mail_fp);
  1234.   
  1235. ***************
  1236. *** 244,250 ****
  1237.               print(".");
  1238.       } else {
  1239.           error("Unable to lock \"%s\"", filename);
  1240. !         exclusive_fclose(mail_fp);
  1241.           off_intr();
  1242.           return NULL_FILE;
  1243.       }
  1244. --- 421,427 ----
  1245.               print(".");
  1246.       } else {
  1247.           error("Unable to lock \"%s\"", filename);
  1248. !         (void) exclusive_fclose(mail_fp);
  1249.           off_intr();
  1250.           return NULL_FILE;
  1251.       }
  1252. ***************
  1253. *** 256,262 ****
  1254.       cnt = (ison(glob_flags, WAS_INTR) != 0);
  1255.       off_intr();
  1256.       if (cnt) {
  1257. !     exclusive_fclose(mail_fp);
  1258.       return NULL_FILE;
  1259.       }
  1260.       return mail_fp;
  1261. --- 433,439 ----
  1262.       cnt = (ison(glob_flags, WAS_INTR) != 0);
  1263.       off_intr();
  1264.       if (cnt) {
  1265. !     (void) exclusive_fclose(mail_fp);
  1266.       return NULL_FILE;
  1267.       }
  1268.       return mail_fp;
  1269. ***************
  1270. *** 266,316 ****
  1271.   close_lock(filename, fp)
  1272.   char *filename;
  1273.   FILE *fp;
  1274. - #ifdef LCKDFLDIR
  1275.   {
  1276.       (void) exclusive_fclose(fp); /* Only removes the list elem */
  1277.       return lk_fclose(fp, filename, NULL, NULL);
  1278. - }
  1279.   #else /* !LCKDFLDIR */
  1280. - {
  1281. - #ifdef DOT_LOCK
  1282. -     char buf[MAXPATHLEN];
  1283. - #endif /* DOT_LOCK */
  1284.       fflush(fp);
  1285. - #ifdef DOT_LOCK
  1286. - #ifdef BSD
  1287. -     setregid(rgid, sgid);
  1288. - #else
  1289. -     setgid(sgid);
  1290. - #endif /* BSD */
  1291. - #ifdef SYSV
  1292. -     if (strcmp(spoolfile, filename) == 0)
  1293. - #endif /* SYSV */
  1294. - #ifdef M_XENIX
  1295. -     (void) unlink(sprintf(buf, "/tmp/%.10s.mlk", login));
  1296. - #else /* M_XENIX */
  1297. -     {
  1298. -     /* If the file was locked through open_file(), we may not have
  1299. -      * a complete pathname to work with here.  Expand it and test
  1300. -      * whether we need to unlink at all.  This should really be
  1301. -      * handled by having open_file() return the name it used, but
  1302. -      * that breaks too many other things at the moment.
  1303. -      */
  1304. -     int isdir = 0;
  1305. -     char *p = getpath(sprintf(buf, "%s.lock", filename), &isdir);
  1306. -     if (isdir == 0)
  1307. -         (void) unlink(p);
  1308. -     }
  1309. - #endif /* M_XENIX */
  1310. - #ifdef BSD
  1311. -     setregid(sgid, rgid);
  1312. - #else
  1313. -     setgid(getgid());
  1314. - #endif /* BSD */
  1315. - #endif /* DOT_LOCK */
  1316.       (void) flock(fileno(fp), LOCK_UN);
  1317.       return exclusive_fclose(fp);
  1318. - }
  1319.   #endif /* LCKDFLDIR */
  1320. --- 443,465 ----
  1321.   close_lock(filename, fp)
  1322.   char *filename;
  1323.   FILE *fp;
  1324.   {
  1325. + #ifdef LCKDFLDIR
  1326.       (void) exclusive_fclose(fp); /* Only removes the list elem */
  1327.       return lk_fclose(fp, filename, NULL, NULL);
  1328.   #else /* !LCKDFLDIR */
  1329.       fflush(fp);
  1330.       (void) flock(fileno(fp), LOCK_UN);
  1331.       return exclusive_fclose(fp);
  1332.   #endif /* LCKDFLDIR */
  1333. + }
  1334. + /* Make sure we don't leave dead lockfiles lying around */
  1335. + void
  1336. + droplocks()
  1337. + {
  1338. +     while (exclude_list)
  1339. +     close_lock(exclude_list->option, (FILE *)exclude_list->value);
  1340. + }
  1341. + #endif /* LOCK_PROG */
  1342. *** 7.2.3/loop.c    Thu May 16 18:29:08 1991
  1343. --- 7.2.4/loop.c    Wed Nov 13 09:58:26 1991
  1344. ***************
  1345. *** 73,78 ****
  1346. --- 73,80 ----
  1347.           }
  1348.   #endif /* CURSES */
  1349.       }
  1350. +     /* If we got back to here, we shouldn't be holding any file locks */
  1351. +     droplocks();
  1352.   #ifdef CURSES
  1353.       if (iscurses || c > -1) {
  1354.           /* if !iscurses, we know that we returned from a curses-based
  1355. *** 7.2.3/main.c    Thu May 16 18:29:17 1991
  1356. --- 7.2.4/main.c    Wed Jan 29 23:34:31 1992
  1357. ***************
  1358. *** 65,81 ****
  1359.       (void) setbuf(stdin, NULL);
  1360.   
  1361.       init(); /* must be done before checking mail since "login" is set here */
  1362. -     mailfile = "";
  1363. - #ifdef HOMEMAIL
  1364. -     {
  1365. -     char *home = do_set(set_options, "home");
  1366. -     if (!home)
  1367. -         home = ALTERNATE_HOME;
  1368. -     strdup(spoolfile, sprintf(buf, "%s/%s", home, MAILFILE));
  1369. -     }
  1370. - #else /* HOMEMAIL */
  1371. -     strdup(spoolfile, sprintf(buf, "%s/%s", MAILDIR, login));
  1372. - #endif /* HOMEMAIL */
  1373.   
  1374.       n = preparse_opts(&argc,argv);
  1375.   
  1376. --- 65,70 ----
  1377. ***************
  1378. *** 151,159 ****
  1379.       (void) signal(SIGINT, catch);
  1380.       (void) signal(SIGQUIT, catch);
  1381.       (void) signal(SIGHUP, catch);
  1382. !     if (istool)
  1383.           turnon(glob_flags, ECHO_FLAG);
  1384. !     tty_settings();
  1385.   #ifdef SIGCONT
  1386.       (void) signal(SIGTSTP, stop_start); /* this will take care of SIGCONT */
  1387.   #endif /* SIGCONT */
  1388. --- 140,149 ----
  1389.       (void) signal(SIGINT, catch);
  1390.       (void) signal(SIGQUIT, catch);
  1391.       (void) signal(SIGHUP, catch);
  1392. !     if (istool || hdrs_only)
  1393.           turnon(glob_flags, ECHO_FLAG);
  1394. !     if (!hdrs_only)
  1395. !         tty_settings();
  1396.   #ifdef SIGCONT
  1397.       (void) signal(SIGTSTP, stop_start); /* this will take care of SIGCONT */
  1398.   #endif /* SIGCONT */
  1399. *** 7.2.3/makefile.bsd    Thu May 16 18:29:18 1991
  1400. --- 7.2.4/makefile.bsd    Thu Jan 30 22:00:59 1992
  1401. ***************
  1402. *** 12,19 ****
  1403.         folders.o dates.o loop.o viewopts.o curses.o curs_io.o bind.o \
  1404.         lock.o macros.o options.o addrs.o malloc.o glob.o command2.o
  1405.   
  1406. ! HELP_FILES= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 mush.1 \
  1407. !     cmd_help Mushrc Mailrc Gnurc sample.mushrc advanced.mushrc digestify
  1408.   
  1409.   MAKES= makefile.bsd makefile.xenix makefile.sys.v makefile.hpux makefile.sun
  1410.   
  1411. --- 12,20 ----
  1412.         folders.o dates.o loop.o viewopts.o curses.o curs_io.o bind.o \
  1413.         lock.o macros.o options.o addrs.o malloc.o glob.o command2.o
  1414.   
  1415. ! HELP_FILES= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 \
  1416. !     README-7.2.4 mush.1 cmd_help Mushrc Mailrc Gnurc \
  1417. !     sample.mushrc advanced.mushrc digestify
  1418.   
  1419.   MAKES= makefile.bsd makefile.xenix makefile.sys.v makefile.hpux makefile.sun
  1420.   
  1421. ***************
  1422. *** 22,28 ****
  1423.   CFLAGS= -O -DCURSES -DBSD
  1424.   LDFLAGS=
  1425.   LINTFLAGS= -bxah -Dlint -DCURSES -DBSD
  1426. ! LIBES= -lcurses -ltermlib
  1427.   OTHERLIBS=
  1428.   # Use some variant of this one if you #define MMDF in config.h
  1429.   #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a
  1430. --- 23,29 ----
  1431.   CFLAGS= -O -DCURSES -DBSD
  1432.   LDFLAGS=
  1433.   LINTFLAGS= -bxah -Dlint -DCURSES -DBSD
  1434. ! LIBS= -lcurses -ltermlib
  1435.   OTHERLIBS=
  1436.   # Use some variant of this one if you #define MMDF in config.h
  1437.   #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a
  1438. ***************
  1439. *** 29,35 ****
  1440.   
  1441.   mush: $(OBJS)
  1442.       @echo loading...
  1443. !     @cc $(LDFLAGS) $(OBJS) $(LIBES) $(OTHERLIBS) -o mush
  1444.   
  1445.   $(OBJS): config.h mush.h
  1446.   loop.o: version.h
  1447. --- 30,36 ----
  1448.   
  1449.   mush: $(OBJS)
  1450.       @echo loading...
  1451. !     @cc $(LDFLAGS) $(OBJS) $(LIBS) $(OTHERLIBS) -o mush
  1452.   
  1453.   $(OBJS): config.h mush.h
  1454.   loop.o: version.h
  1455. *** 7.2.3/makefile.hpux    Thu May 16 18:29:19 1991
  1456. --- 7.2.4/makefile.hpux    Thu Jan 30 22:01:20 1992
  1457. ***************
  1458. *** 16,23 ****
  1459.   OBJS2= bind.o curs_io.o curses.o file.o strings.o macros.o \
  1460.       addrs.o malloc.o glob.o command2.o
  1461.   
  1462. ! HELP_FILES= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 mush.1 \
  1463. !     cmd_help Mushrc Mailrc Gnurc sample.mushrc advanced.mushrc digestify
  1464.   
  1465.   # If your HP-UX version is older than 6.5, you will need remove -DDIRECTORY
  1466.   
  1467. --- 16,24 ----
  1468.   OBJS2= bind.o curs_io.o curses.o file.o strings.o macros.o \
  1469.       addrs.o malloc.o glob.o command2.o
  1470.   
  1471. ! HELP_FILES= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 \
  1472. !     README-7.2.4 mush.1 cmd_help Mushrc Mailrc Gnurc \
  1473. !     sample.mushrc advanced.mushrc digestify
  1474.   
  1475.   # If your HP-UX version is older than 6.5, you will need remove -DDIRECTORY
  1476.   
  1477. *** 7.2.3/makefile.sun    Thu May 16 18:29:20 1991
  1478. --- 7.2.4/makefile.sun    Thu Jan 30 22:01:37 1992
  1479. ***************
  1480. *** 20,26 ****
  1481.   IMAGES= mail.icon.1 mail.icon.2
  1482.   
  1483.   HELP_FILES= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 \
  1484. !             mush.1 cmd_help tool_help Mushrc Mailrc Gnurc \
  1485.           advanced.mushrc sample.mushrc digestify
  1486.   
  1487.   MAKES= makefile.sun makefile.bsd makefile.sys.v makefile.xenix makefile.hpux
  1488. --- 20,26 ----
  1489.   IMAGES= mail.icon.1 mail.icon.2
  1490.   
  1491.   HELP_FILES= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 \
  1492. !             README-7.2.4 mush.1 cmd_help tool_help Mushrc Mailrc Gnurc \
  1493.           advanced.mushrc sample.mushrc digestify
  1494.   
  1495.   MAKES= makefile.sun makefile.bsd makefile.sys.v makefile.xenix makefile.hpux
  1496. ***************
  1497. *** 31,37 ****
  1498.   #    -DSUN_3_5, -DSUN_4_0, or -DSUN_4_1 to CFLAGS there.
  1499.   CFLAGS= -O -DSUNTOOL -DCURSES -DBSD
  1500.   LDFLAGS=
  1501. ! LIBES= -lcurses -ltermlib -lsuntool -lsunwindow -lpixrect
  1502.   OTHERLIBS=
  1503.   # Use some variant of this one if you #define MMDF in config.h
  1504.   #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a
  1505. --- 31,37 ----
  1506.   #    -DSUN_3_5, -DSUN_4_0, or -DSUN_4_1 to CFLAGS there.
  1507.   CFLAGS= -O -DSUNTOOL -DCURSES -DBSD
  1508.   LDFLAGS=
  1509. ! LIBS= -lcurses -ltermlib -lsuntool -lsunwindow -lpixrect
  1510.   OTHERLIBS=
  1511.   # Use some variant of this one if you #define MMDF in config.h
  1512.   #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a
  1513. ***************
  1514. *** 39,45 ****
  1515.   
  1516.   mush: $(OBJS)
  1517.       @echo loading...
  1518. !     @cc $(LDFLAGS) $(OBJS) $(LIBES) $(OTHERLIBS) -o mush
  1519.   
  1520.   $(OBJS): config.h mush.h
  1521.   loop.o: version.h
  1522. --- 39,45 ----
  1523.   
  1524.   mush: $(OBJS)
  1525.       @echo loading...
  1526. !     @cc $(LDFLAGS) $(OBJS) $(LIBS) $(OTHERLIBS) -o mush
  1527.   
  1528.   $(OBJS): config.h mush.h
  1529.   loop.o: version.h
  1530. *** 7.2.3/makefile.sys.v    Thu May 16 18:29:21 1991
  1531. --- 7.2.4/makefile.sys.v    Thu Jan 30 22:02:19 1992
  1532. ***************
  1533. *** 17,24 ****
  1534.   OBJS2= bind.o curs_io.o curses.o file.o strings.o macros.o \
  1535.       addrs.o malloc.o glob.o command2.o
  1536.   
  1537. ! HELP= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 mush.1 \
  1538. !     cmd_help Mushrc Mailrc Gnurc sample.mushrc advanced.mushrc digestify
  1539.   
  1540.   # Sun OS systems who wish to compile with sys-v options:
  1541.   # CC= /usr/5bin/cc
  1542. --- 17,25 ----
  1543.   OBJS2= bind.o curs_io.o curses.o file.o strings.o macros.o \
  1544.       addrs.o malloc.o glob.o command2.o
  1545.   
  1546. ! HELP= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 \
  1547. !     README-7.2.4 mush.1 cmd_help Mushrc Mailrc Gnurc \
  1548. !     sample.mushrc advanced.mushrc digestify
  1549.   
  1550.   # Sun OS systems who wish to compile with sys-v options:
  1551.   # CC= /usr/5bin/cc
  1552. ***************
  1553. *** 27,32 ****
  1554. --- 28,35 ----
  1555.   
  1556.   # IRIX 3.2 systems (SGI Iris workstations) should add -DDIRECTORY to CFLAGS
  1557.   # SCO UNIX 3.2 should add -DDIRECTORY -DSELECT and should avoid library -lx
  1558. + # System V Release 4 (SunOS 5?) should add -DSVR4 -DDIRECTORY to CFLAGS and
  1559. + #  should replace -lPW with -lgen
  1560.   
  1561.   CFLAGS=     -O -DSYSV -DUSG -DCURSES -DREGCMP -DSIGRET=void
  1562.   LDFLAGS=
  1563. *** 7.2.3/makefile.xenix    Thu May 16 18:29:22 1991
  1564. --- 7.2.4/makefile.xenix    Thu Jan 30 22:02:41 1992
  1565. ***************
  1566. *** 20,27 ****
  1567.         signals.o setopts.o msgs.o pick.o sort.o expr.o strings.o \
  1568.         folders.o dates.o loop.o viewopts.o bind.o curses.o curs_io.o \
  1569.         lock.o macros.o options.o addrs.o malloc.o glob.o command2.o
  1570. ! HELP_FILES= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 mush.1 \
  1571. !     cmd_help Mushrc Mailrc Gnurc sample.mushrc advanced.mushrc digestify
  1572.   
  1573.   # Memory model.  Use -M3e for 80386 machines.
  1574.   # Use -M2le -Mt32 -LARGE for 80286 machines.
  1575. --- 20,28 ----
  1576.         signals.o setopts.o msgs.o pick.o sort.o expr.o strings.o \
  1577.         folders.o dates.o loop.o viewopts.o bind.o curses.o curs_io.o \
  1578.         lock.o macros.o options.o addrs.o malloc.o glob.o command2.o
  1579. ! HELP_FILES= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 \
  1580. !     README-7.2.4 mush.1 cmd_help Mushrc Mailrc Gnurc \
  1581. !     sample.mushrc advanced.mushrc digestify
  1582.   
  1583.   # Memory model.  Use -M3e for 80386 machines.
  1584.   # Use -M2le -Mt32 -LARGE for 80286 machines.
  1585. ***************
  1586. *** 33,39 ****
  1587.   LDFLAGS= -X -lx -M3
  1588.   
  1589.   CFLAGS= $(MODEL) -O -DSYSV -DCURSES -DREGCMP -DUSG 
  1590. ! LIBES= -lcurses -ltermlib
  1591.   OTHERLIBS=
  1592.   # Use some variant of this one if you #define MMDF in config.h
  1593.   #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a
  1594. --- 34,40 ----
  1595.   LDFLAGS= -X -lx -M3
  1596.   
  1597.   CFLAGS= $(MODEL) -O -DSYSV -DCURSES -DREGCMP -DUSG 
  1598. ! LIBS= -lcurses -ltermlib
  1599.   OTHERLIBS=
  1600.   # Use some variant of this one if you #define MMDF in config.h
  1601.   #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a
  1602. ***************
  1603. *** 40,46 ****
  1604.   
  1605.   mush: $(OBJS)
  1606.       @echo loading...
  1607. !     @cc $(LDFLAGS) $(OBJS) $(LIBES) $(OTHERLIBS) -o mush
  1608.   
  1609.   $(OBJS): config.h mush.h
  1610.   loop.o: version.h
  1611. --- 41,47 ----
  1612.   
  1613.   mush: $(OBJS)
  1614.       @echo loading...
  1615. !     @cc $(LDFLAGS) $(OBJS) $(LIBS) $(OTHERLIBS) -o mush
  1616.   
  1617.   $(OBJS): config.h mush.h
  1618.   loop.o: version.h
  1619. *** 7.2.3/misc.c    Thu Oct 25 17:46:38 1990
  1620. --- 7.2.4/misc.c    Thu Jan 30 23:25:10 1992
  1621. ***************
  1622. *** 494,499 ****
  1623. --- 494,504 ----
  1624.   
  1625.       if (start_pager) {
  1626.       turnon(glob_flags, IGN_SIGS);
  1627. +     cnt = len = 0;
  1628. +     if (buf && strcmp(buf, "NONE") == 0) {
  1629. +         cnt = -1;    /* cnt < 0 disables c_more() */
  1630. +         buf = NULL;
  1631. +     }
  1632.       if (!buf) {
  1633.           /* internal pager */
  1634.           save_echo_flag = ison(glob_flags, ECHO_FLAG);
  1635. ***************
  1636. *** 507,513 ****
  1637.           if (!(pp = popen(buf, "w")))
  1638.           error(buf);
  1639.       }
  1640. -     cnt = len = 0;
  1641.       } else if (!buf) {
  1642.       if (pp && pp != stdout)
  1643.           (void) pclose(pp);
  1644. --- 512,517 ----
  1645. ***************
  1646. *** 518,524 ****
  1647.       } else
  1648.           echo_off();
  1649.       turnoff(glob_flags, IGN_SIGS);
  1650. !     } else if (pp != stdout)
  1651.       return fputs(buf, pp); /* returns EOF if user exited pager */
  1652.       else {
  1653.       register char c = 0, *cr = index(buf, '\n');
  1654. --- 522,528 ----
  1655.       } else
  1656.           echo_off();
  1657.       turnoff(glob_flags, IGN_SIGS);
  1658. !     } else if (pp != stdout || cnt < 0)
  1659.       return fputs(buf, pp); /* returns EOF if user exited pager */
  1660.       else {
  1661.       register char c = 0, *cr = index(buf, '\n');
  1662. ***************
  1663. *** 666,675 ****
  1664.       (void) fputc('\n', fp);
  1665.       (void) fflush(fp);
  1666.       if (*buf == '$')
  1667. !         if (!(p = do_set(set_options, buf)))
  1668.           wprint("(%s isn't set -- letter not signed)\n", buf);
  1669.           else {
  1670. !         putstring(p+1, fp);
  1671.           if (noisy)
  1672.               wprint("\n");
  1673.           }
  1674. --- 670,679 ----
  1675.       (void) fputc('\n', fp);
  1676.       (void) fflush(fp);
  1677.       if (*buf == '$')
  1678. !         if (!(p = do_set(set_options, buf+1)))
  1679.           wprint("(%s isn't set -- letter not signed)\n", buf);
  1680.           else {
  1681. !         putstring(p, fp);
  1682.           if (noisy)
  1683.               wprint("\n");
  1684.           }
  1685. *** 7.2.3/msgs.c    Wed May 22 18:27:16 1991
  1686. --- 7.2.4/msgs.c    Sun Feb  2 13:59:14 1992
  1687. ***************
  1688. *** 341,349 ****
  1689.           write_err = 1;    /* forces return 0; below */
  1690.           goto resume_timer;    /* blecch */
  1691.       }
  1692. - #else /* !SUNTOOL */
  1693. -     return 0;
  1694.   #endif /* SUNTOOL */
  1695.       }
  1696.       /* Make sure no mail arrived between the last check and when we
  1697.        * got the lock.  If it did, release the lock and try again.
  1698. --- 341,348 ----
  1699.           write_err = 1;    /* forces return 0; below */
  1700.           goto resume_timer;    /* blecch */
  1701.       }
  1702.   #endif /* SUNTOOL */
  1703. +     return 0;
  1704.       }
  1705.       /* Make sure no mail arrived between the last check and when we
  1706.        * got the lock.  If it did, release the lock and try again.
  1707. ***************
  1708. *** 505,513 ****
  1709. --- 504,519 ----
  1710.       /* Reset the access time of the spool file to prevent
  1711.        * bogus "new mail" messages from the shell.
  1712.        */
  1713. + #ifdef POSIX_UTIME
  1714. +     struct utimbuf times;
  1715. +     (void) fflush(mail_fp); /* just in case */
  1716. +     times.modtime = time(×.actime) - 2;
  1717. +     times.ausec = times.modusec = 0;
  1718. + #else /* !POSIX_UTIME */
  1719.       long times[2];
  1720.       (void) fflush(mail_fp); /* just in case */
  1721.       times[1] = time(×[0]) - (long)2;
  1722. + #endif /* POSIX_UTIME */
  1723.       if (!strcmp(mailfile, spoolfile) && utime(mailfile, times))
  1724.           error("utime");
  1725.       }
  1726. *** 7.2.3/mush.h    Wed May 22 18:15:57 1991
  1727. --- 7.2.4/mush.h    Sun Feb  2 13:50:50 1992
  1728. ***************
  1729. *** 35,40 ****
  1730. --- 35,44 ----
  1731.   #endif /* SYSV && USG */
  1732.   #endif /* CURSES */
  1733.   
  1734. + #if defined(SVR4)
  1735. + #include <sys/ttold.h>
  1736. + #endif /* SVR4 */
  1737.   #include <ctype.h>
  1738.   #include <errno.h>
  1739.   #include <setjmp.h>
  1740. ***************
  1741. *** 49,71 ****
  1742.       free_vec(),        /* free a malloc'ed argv */
  1743.       xfree();        /* free malloc'ed pointers */
  1744.   
  1745. - #if defined(SUNTOOL) || defined(SUN_3_5) || defined(SUN_4_0) || defined(SUN_4_1)
  1746. - #if !defined(BSD) && !defined(SYSV)
  1747. - #    define BSD /* default to BSD */
  1748. - #endif /* !BSD && !SYSV */
  1749. - #if !defined(SUN_3_5) && !defined(SUN_4_0)
  1750. - #    ifndef SUN_4_1
  1751. - #        define SUN_4_1 /* default to sun 4.1 */
  1752. - #    endif /* SUN_4_1 */
  1753. - #    define SUN_4_0 /* 4.0 stuff needed too */
  1754. - #endif /* !SUN_3_5 && !SUN_4_0 */
  1755. - #ifdef SUN_4_0
  1756. - #    undef SUN_3_5
  1757. - #    undef SIGRET
  1758. - #    define SIGRET void
  1759. - #endif /* SUN_4_0 */
  1760. - #endif /* SUNTOOL || SUN_3_5 || SUN_4_0 || SUN_4_1 */
  1761.   #ifdef BSD
  1762.   #define fputs Fputs    /* See comments in print.c */
  1763.   #endif /* BSD */
  1764. --- 53,58 ----
  1765. ***************
  1766. *** 103,108 ****
  1767. --- 90,98 ----
  1768.   #    endif /* SYSV */
  1769.   #endif /* SUNTOOL */
  1770.   
  1771. + #ifdef POSIX_UTIME
  1772. + #include <sys/utime.h>
  1773. + #endif /* POSIX_UTIME */
  1774.   #include <sys/stat.h>
  1775.   #include <sys/file.h>
  1776.   
  1777. *** 7.2.3/pick.c    Sun May 19 19:59:34 1991
  1778. --- 7.2.4/pick.c    Wed Nov 20 23:42:33 1991
  1779. ***************
  1780. *** 219,225 ****
  1781.           print_more(" from the message header \"%s:\"", search_hdr);
  1782.       } else if (mdy[1]) {
  1783.           extern char *month_names[]; /* from dates.c */
  1784. !         print_more(" dated ");
  1785.           if (before || after)
  1786.           if (xflg)
  1787.               print_more("%s ", (!before)? "before": "after");
  1788. --- 219,225 ----
  1789.           print_more(" from the message header \"%s:\"", search_hdr);
  1790.       } else if (mdy[1]) {
  1791.           extern char *month_names[]; /* from dates.c */
  1792. !         print_more("%s dated ", xflg && !(before || after)? " not" : "");
  1793.           if (before || after)
  1794.           if (xflg)
  1795.               print_more("%s ", (!before)? "before": "after");
  1796. ***************
  1797. *** 438,444 ****
  1798.       static char     *err = (char *)-1, direction;
  1799.       SIGRET        (*oldint)(), (*oldquit)();
  1800.   #ifdef REGCMP
  1801. !     char *regcmp();
  1802.   #else /* REGCMP */
  1803.       char *re_comp();
  1804.   #endif /* REGCMP */
  1805. --- 438,444 ----
  1806.       static char     *err = (char *)-1, direction;
  1807.       SIGRET        (*oldint)(), (*oldquit)();
  1808.   #ifdef REGCMP
  1809. !     char *regex(), *regcmp();
  1810.   #else /* REGCMP */
  1811.       char *re_comp();
  1812.   #endif /* REGCMP */
  1813. *** 7.2.3/setopts.c    Thu May 16 18:30:06 1991
  1814. --- 7.2.4/setopts.c    Thu Nov 21 10:06:23 1991
  1815. ***************
  1816. *** 696,702 ****
  1817.   {
  1818.       register char *cmd = *argv, *p;
  1819.       struct options **list;
  1820. !     char firstchar = *cmd, buf[BUFSIZ];
  1821.   
  1822.       if (argc == 0)
  1823.       return 0 - in_pipe();
  1824. --- 696,702 ----
  1825.   {
  1826.       register char *cmd = *argv, *p;
  1827.       struct options **list;
  1828. !     char firstchar = *cmd, buf[HDRSIZ];
  1829.   
  1830.       if (argc == 0)
  1831.       return 0 - in_pipe();
  1832. *** 7.2.3/signals.c    Thu May 16 18:30:08 1991
  1833. --- 7.2.4/signals.c    Wed Jan 29 23:56:50 1992
  1834. ***************
  1835. *** 231,236 ****
  1836. --- 231,237 ----
  1837.   
  1838.       if (ison(glob_flags, IS_GETTING))
  1839.       turnoff(glob_flags, IS_GETTING), dead_letter(sig);
  1840. +     droplocks();
  1841.       if ((sig == SIGSEGV || sig == SIGBUS) && isoff(glob_flags, IGN_SIGS)
  1842.           && *tempfile && !istool) {
  1843.       (void) fprintf(stderr, "remove %s [y]? ", tempfile), (void) fflush(stderr);
  1844. ***************
  1845. *** 256,261 ****
  1846. --- 257,268 ----
  1847.           abort();
  1848.       }
  1849.       }
  1850. + #ifdef CSH_FILEC_FIX
  1851. +     if (isoff(glob_flags, ECHO_FLAG) && isoff(glob_flags, REDIRECT)) {
  1852. +     c = 0;
  1853. +     (void)ioctl(0, TIOCFLUSH, &c);
  1854. +     }
  1855. + #endif /* CSH_FILEC_FIX */
  1856.       exit(sig);
  1857.   }
  1858.   
  1859.  
  1860. -- 
  1861. Bart Schaefer                                     schaefer@zigzag.z-code.com
  1862. Z-Code Software Corp.                             schaefer@z-code.com
  1863. New male in /home/schaefer:
  1864.   1  N  Benjamin Timothy Schaefer  Nov 26 1991 (3572g) Happy Birthday!
  1865.  
  1866. exit 0 # Just in case...
  1867.