home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / mail / elm / 3729 < prev    next >
Encoding:
Internet Message Format  |  1992-12-14  |  79.7 KB

  1. Xref: sparky comp.mail.elm:3729 comp.sources.bugs:299
  2. Path: sparky!uunet!spool.mu.edu!dsinc!dsinc!not-for-mail
  3. From: syd@dsinc.DSI.COM (Syd Weinstein)
  4. Newsgroups: comp.mail.elm,comp.sources.bugs
  5. Subject: elm 2.4 Patch #16
  6. Followup-To: poster
  7. Date: 14 Dec 1992 20:48:36 -0500
  8. Organization: Datacomp Systems, Inc., Huntingdon Valley, PA 19006
  9. Lines: 2626
  10. Sender: syd@dsi.com
  11. Message-ID: <1gjdhkINNoig@dsinc.dsi.com>
  12. NNTP-Posting-Host: dsinc.dsi.com
  13. Summary: This is an official patch for elm 2.4 system.  Please apply it.
  14. Priority: LOW
  15.  
  16. part 3 of a 4 part patch
  17.  
  18. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your elm source
  19.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  20.     If you don't have the patch program, apply the following by hand,
  21.     or get patch (version 2.0, latest patchlevel).
  22.  
  23.     After patching:
  24.         do nothing, apply patch 17 next
  25.  
  26.     If patch indicates that patchlevel is the wrong version, you may need
  27.     to apply one or more previous patches, or the patch may already
  28.     have been applied.  See the patchlevel.h file to find out what has or
  29.     has not been applied.  In any event, don't continue with the patch.
  30.  
  31.     If you are missing previous patches they can be obtained from our:
  32.     archive server.
  33.  
  34.     Syd Weinstein
  35.     elm@DSI.COM
  36.  
  37.     The patches are available from the dsinc archive server
  38.     Send the following message to archive-server@DSI.COM for
  39.     a list of available patches:
  40.  
  41.     Subject: patch list
  42.     send index elm
  43.  
  44. Index: hdrs/patchlevel.h
  45. Prereq: "15"
  46. *** ../elm2.4/hdrs/patchlevel.h    Wed Nov 25 14:10:35 1992
  47. --- hdrs/patchlevel.h    Wed Nov 25 19:50:23 1992
  48. ***************
  49. *** 1 ****
  50. ! #define PATCHLEVEL "15"
  51. --- 1 ----
  52. ! #define PATCHLEVEL "16"
  53.  
  54. Index: src/alias.c
  55. Prereq: 5.11
  56. *** ../elm2.4/src/alias.c    Tue Nov 17 14:11:04 1992
  57. --- src/alias.c    Sun Dec 13 12:59:18 1992
  58. ***************
  59. *** 1,8 ****
  60.   
  61. ! static char rcsid[] = "@(#)$Id: alias.c,v 5.11 1992/11/15 01:24:34 syd Exp $";
  62.   
  63.   /*******************************************************************************
  64. !  *  The Elm Mail System  -  $Revision: 5.11 $   $State: Exp $
  65.    *
  66.    *             Copyright (c) 1988-1992 USENET Community Trust
  67.    *             Copyright (c) 1986,1987 Dave Taylor
  68. --- 1,8 ----
  69.   
  70. ! static char rcsid[] = "@(#)$Id: alias.c,v 5.17 1992/12/13 17:59:18 syd Exp $";
  71.   
  72.   /*******************************************************************************
  73. !  *  The Elm Mail System  -  $Revision: 5.17 $   $State: Exp $
  74.    *
  75.    *             Copyright (c) 1988-1992 USENET Community Trust
  76.    *             Copyright (c) 1986,1987 Dave Taylor
  77. ***************
  78. *** 14,19 ****
  79. --- 14,49 ----
  80.    *
  81.    *******************************************************************************
  82.    * $Log: alias.c,v $
  83. +  * Revision 5.17  1992/12/13  17:59:18  syd
  84. +  * Please write on the blackboard 500 times `NULL != 0.'
  85. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  86. +  *
  87. +  * Revision 5.16  1992/12/11  02:09:06  syd
  88. +  * Fix where the user creates a first new alias, then deletes it, the
  89. +  * alias stays on screen, but the file really will be empty if it was the
  90. +  * last alias, so the retry to delete gives 'cannot open ...file' messages
  91. +  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
  92. +  *
  93. +  * Revision 5.15  1992/12/11  01:58:22  syd
  94. +  * Anytime elm wants to re-run newalias, selected is set to 0.
  95. +  * (removing any limit in effect)
  96. +  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
  97. +  *
  98. +  * Revision 5.14  1992/12/11  01:45:04  syd
  99. +  * remove sys/types.h include, it is now included by defs.h
  100. +  * and this routine includes defs.h or indirectly includes defs.h
  101. +  * From: Syd
  102. +  *
  103. +  * Revision 5.13  1992/12/07  03:02:03  syd
  104. +  * On machines with 64 bit pointers (and 64 bit longs) using int
  105. +  * for newmax causes pointer truncation.
  106. +  * From: Jim Brown
  107. +  *
  108. +  * Revision 5.12  1992/11/26  00:46:50  syd
  109. +  * Fix how errno is used so err is inited and used instead
  110. +  * as errno gets overwritten by print system call
  111. +  * From: Syd
  112. +  *
  113.    * Revision 5.11  1992/11/15  01:24:34  syd
  114.    * The situation is that the .elm/aliases file is missing, but
  115.    * .elm/aliases.dir and .elm/aliases.pag exist (isn't serendipity
  116. ***************
  117. *** 101,107 ****
  118.   #include "s_elm.h"
  119.   #include <errno.h>
  120.   #include <ctype.h>
  121. - #include <sys/types.h>
  122.   #include <sys/stat.h>
  123.   #include "s_aliases.h"
  124.   #include "ndbz.h"
  125. --- 131,136 ----
  126. ***************
  127. *** 150,156 ****
  128.   
  129.   open_alias_files()
  130.   {
  131. !     static int first_time = 1;
  132.   /*
  133.    *    Close and re-open the system and user alias files, if present,
  134.    *    and if they have changed since last we opened them.
  135. --- 179,185 ----
  136.   
  137.   open_alias_files()
  138.   {
  139. !     static int first_time = TRUE;
  140.   /*
  141.    *    Close and re-open the system and user alias files, if present,
  142.    *    and if they have changed since last we opened them.
  143. ***************
  144. *** 221,249 ****
  145.    */
  146.   
  147.       struct stat hst;
  148. !     static time_t system_ctime, system_mtime;
  149.   
  150.       /* If file hasn't changed, don't bother re-opening. */
  151.   
  152. !     if (stat(system_data_file, &hst) == 0
  153. !      && hst.st_ctime == system_ctime
  154. !      && hst.st_mtime == system_mtime)
  155. !         return(0);
  156.   
  157. !     /* re-open system hash table.  If we can't, just return. */
  158.   
  159. !     if (system_hash != NULL)
  160. !         dbz_close(system_hash);
  161.   
  162. !     if ((system_hash = dbz_open(system_data_file, O_RDONLY, 0)) == NULL)
  163. !         return(0);
  164.   
  165. !     /* Remember hash file times. */
  166.   
  167. !     system_ctime = hst.st_ctime;
  168. !     system_mtime = hst.st_mtime;
  169.   
  170. -         return(1);
  171.   }
  172.   
  173.   int
  174. --- 250,299 ----
  175.    */
  176.   
  177.       struct stat hst;
  178. !     static time_t system_ctime = 0, system_mtime = 0;
  179.   
  180.       /* If file hasn't changed, don't bother re-opening. */
  181.   
  182. !     if (stat(system_data_file, &hst) == 0) {    /* File exists */
  183. !         if (hst.st_ctime == system_ctime &&
  184. !             hst.st_mtime == system_mtime) {        /* No changes */
  185. !             return(0);
  186. !         }
  187. !        /*
  188. !         * Re-open system hash table.  If we can't, just return.
  189. !         */
  190. !         if (system_hash != NULL)
  191. !             dbz_close(system_hash);
  192.   
  193. !         if ((system_hash = dbz_open(system_data_file, O_RDONLY, 0)) == NULL)
  194. !             return(0);
  195.   
  196. !         /* Remember hash file times. */
  197.   
  198. !         system_ctime = hst.st_ctime;
  199. !         system_mtime = hst.st_mtime;
  200.   
  201. !             return(1);
  202. !     }
  203. !     else {                    /* File does not exist */
  204. !         if (system_ctime == 0 && system_mtime == 0) {
  205. !             return(0);            /* File never existed */
  206. !         }
  207. !         else {            /* Once existed, better re-read */
  208. !            /*
  209. !             * Since we no longer exist, we pretend we never existed.
  210. !             */
  211. !             system_ctime = 0;
  212. !             system_mtime = 0;
  213.   
  214. !             return(1);
  215. !         }
  216. !     }
  217.   
  218.   }
  219.   
  220.   int
  221. ***************
  222. *** 258,288 ****
  223.   
  224.       struct stat hst;
  225.       char fname[SLEN];
  226. !     static time_t user_ctime, user_mtime;
  227.   
  228.       /* If hash file hasn't changed, don't bother re-reading. */
  229.   
  230.       sprintf(fname, "%s/%s", home, ALIAS_DATA);
  231.   
  232. !     if (stat(fname, &hst) == 0
  233. !      && hst.st_ctime == user_ctime
  234. !      && hst.st_mtime == user_mtime)
  235. !         return(0);
  236.   
  237. !     /* Open user hash table.  If we can't, just return. */
  238.   
  239. !     if (user_hash != NULL)
  240. !         dbz_close(user_hash);
  241.   
  242. !     if ((user_hash = dbz_open(fname, O_RDONLY, 0)) == NULL)
  243. !         return(0);
  244.   
  245. !     /* Remember hash file times. */
  246.   
  247. !     user_ctime = hst.st_ctime;
  248. !     user_mtime = hst.st_mtime;
  249.   
  250. -         return(1);
  251.   }
  252.   
  253.   int
  254. --- 308,359 ----
  255.   
  256.       struct stat hst;
  257.       char fname[SLEN];
  258. !     static time_t user_ctime = 0, user_mtime = 0;
  259.   
  260.       /* If hash file hasn't changed, don't bother re-reading. */
  261.   
  262.       sprintf(fname, "%s/%s", home, ALIAS_DATA);
  263.   
  264. !     if (stat(fname, &hst) == 0) {            /* File exists */
  265. !         if (hst.st_ctime == user_ctime &&
  266. !             hst.st_mtime == user_mtime) {        /* No changes */
  267. !             return(0);
  268. !         }
  269. !        /*
  270. !         * Open user hash table.  If we can't, just return.
  271. !         */
  272.   
  273. !         if (user_hash != NULL)
  274. !             dbz_close(user_hash);
  275.   
  276. !         if ((user_hash = dbz_open(fname, O_RDONLY, 0)) == NULL)
  277. !             return(0);
  278.   
  279. !         /* Remember hash file times. */
  280.   
  281. !         user_ctime = hst.st_ctime;
  282. !         user_mtime = hst.st_mtime;
  283.   
  284. !             return(1);
  285. !     }
  286. !     else {                    /* File does not exist */
  287. !         if (user_ctime == 0 && user_mtime == 0) {
  288. !             return(0);            /* File never existed */
  289. !         }
  290. !         else {            /* Once existed, better re-read */
  291. !            /*
  292. !             * Since we no longer exist, we pretend we never existed.
  293. !             */
  294. !             user_ctime = 0;
  295. !             user_mtime = 0;
  296. !             return(1);
  297. !         }
  298. !     }
  299.   
  300.   }
  301.   
  302.   int
  303. ***************
  304. *** 556,570 ****
  305.       FILE *file;
  306.       char fname[SLEN];
  307.       char buffer[SLEN];
  308.       
  309.       sprintf(fname,"%s/%s", home, ALIAS_TEXT);
  310.       
  311.       save_file_stats(fname);
  312.       if ((file = fopen(fname, "a")) == NULL) {
  313.         dprint(2, (debugfile, 
  314.            "Failure attempting to add alias to file %s within %s",
  315.              fname, "add_to_alias_text"));
  316. !       dprint(2, (debugfile, "** %s **\n", error_description(errno)));
  317.         error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntOpenAdd,
  318.            "Couldn't open %s to add new alias!"), fname);
  319.         return(1);
  320. --- 627,643 ----
  321.       FILE *file;
  322.       char fname[SLEN];
  323.       char buffer[SLEN];
  324. +     int  err;
  325.       
  326.       sprintf(fname,"%s/%s", home, ALIAS_TEXT);
  327.       
  328.       save_file_stats(fname);
  329.       if ((file = fopen(fname, "a")) == NULL) {
  330. +       err = errno;
  331.         dprint(2, (debugfile, 
  332.            "Failure attempting to add alias to file %s within %s",
  333.              fname, "add_to_alias_text"));
  334. !       dprint(2, (debugfile, "** %s **\n", error_description(err)));
  335.         error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntOpenAdd,
  336.            "Couldn't open %s to add new alias!"), fname);
  337.         return(1);
  338. ***************
  339. *** 581,590 ****
  340.           strcat(buffer, comment);
  341.       }
  342.       if (fprintf(file,"%s = %s = %s\n", aliasname, buffer, address) == EOF) {
  343.           dprint(2, (debugfile,
  344.                  "Failure attempting to write alias to file within %s",
  345.                  fname, "add_to_alias_text"));
  346. !         dprint(2, (debugfile, "** %s **\n", error_description(errno)));
  347.           error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntWrite,
  348.              "Couldn't write alias to file %s!"), fname);
  349.           fclose(file);
  350. --- 654,664 ----
  351.           strcat(buffer, comment);
  352.       }
  353.       if (fprintf(file,"%s = %s = %s\n", aliasname, buffer, address) == EOF) {
  354. +         err = errno;
  355.           dprint(2, (debugfile,
  356.                  "Failure attempting to write alias to file within %s",
  357.                  fname, "add_to_alias_text"));
  358. !         dprint(2, (debugfile, "** %s **\n", error_description(err)));
  359.           error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntWrite,
  360.              "Couldn't write alias to file %s!"), fname);
  361.           fclose(file);
  362. ***************
  363. *** 618,623 ****
  364. --- 692,698 ----
  365.       register int i;
  366.       int num_aliases;
  367.       int delete_continues;
  368. +     int err;
  369.   
  370.       delete_continues = FALSE;
  371.   
  372. ***************
  373. *** 630,639 ****
  374.       save_file_stats(fname);
  375.   
  376.       if ((file = fopen(fname, "r")) == NULL) {
  377.         dprint(2, (debugfile, 
  378.            "Failure attempting to delete alias from file %s within %s",
  379.              fname, "delete_from_alias_text"));
  380. !       dprint(2, (debugfile, "** %s **\n", error_description(errno)));
  381.         error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntOpenDelete,
  382.            "Couldn't open %s to delete alias!"), fname);
  383.         return(1);
  384. --- 705,715 ----
  385.       save_file_stats(fname);
  386.   
  387.       if ((file = fopen(fname, "r")) == NULL) {
  388. +       err = errno;
  389.         dprint(2, (debugfile, 
  390.            "Failure attempting to delete alias from file %s within %s",
  391.              fname, "delete_from_alias_text"));
  392. !       dprint(2, (debugfile, "** %s **\n", error_description(err)));
  393.         error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntOpenDelete,
  394.            "Couldn't open %s to delete alias!"), fname);
  395.         return(1);
  396. ***************
  397. *** 640,649 ****
  398.       }
  399.   
  400.       if ((tmp_file = fopen(tmpfname, "w")) == NULL) {
  401.         dprint(2, (debugfile, 
  402.            "Failure attempting to open temp file %s within %s",
  403.              tmpfname, "delete_from_alias_text"));
  404. !       dprint(2, (debugfile, "** %s **\n", error_description(errno)));
  405.         error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntOpenTemp,
  406.              "Couldn't open tempfile %s to delete alias!"), tmpfname);
  407.         return(1);
  408. --- 716,726 ----
  409.       }
  410.   
  411.       if ((tmp_file = fopen(tmpfname, "w")) == NULL) {
  412. +       err = errno;
  413.         dprint(2, (debugfile, 
  414.            "Failure attempting to open temp file %s within %s",
  415.              tmpfname, "delete_from_alias_text"));
  416. !       dprint(2, (debugfile, "** %s **\n", error_description(err)));
  417.         error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntOpenTemp,
  418.              "Couldn't open tempfile %s to delete alias!"), tmpfname);
  419.         return(1);
  420. ***************
  421. *** 679,688 ****
  422.         }
  423.         if (! delete_continues) {
  424.           if (fprintf(tmp_file,"%s", line_in_file) == EOF) {
  425.             dprint(2, (debugfile,
  426.           "Failure attempting to write to temp file %s within %s",
  427.           tmpfname, "delete_from_alias_text"));
  428. !           dprint(2, (debugfile, "** %s **\n", error_description(errno)));
  429.             error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntWriteTemp,
  430.           "Couldn't write to tempfile %s!"), tmpfname);
  431.             fclose(file);
  432. --- 756,766 ----
  433.         }
  434.         if (! delete_continues) {
  435.           if (fprintf(tmp_file,"%s", line_in_file) == EOF) {
  436. +           err = errno;
  437.             dprint(2, (debugfile,
  438.           "Failure attempting to write to temp file %s within %s",
  439.           tmpfname, "delete_from_alias_text"));
  440. !           dprint(2, (debugfile, "** %s **\n", error_description(err)));
  441.             error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntWriteTemp,
  442.           "Couldn't write to tempfile %s!"), tmpfname);
  443.             fclose(file);
  444. ***************
  445. *** 706,756 ****
  446.       return(0);
  447.   }
  448.   
  449. - delete_alias_files()
  450. - {
  451. - /*
  452. -  *    This routine remove all the alias text, hash, and data files.
  453. -  *    This is called from delete_aliases when there are no user aliases
  454. -  *    to be kept.
  455. -  */
  456. -     char fname[SLEN];
  457. -     sprintf(fname,"%s/%s", home, ALIAS_TEXT);
  458. -     if (unlink(fname)) {
  459. -       error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntDeleteText,
  460. -          "Could not delete alias text file %s!"), fname);
  461. -       sleep(2);
  462. -     }
  463. -     if (user_hash != NULL) {
  464. -         dbz_close(user_hash);
  465. -         user_hash = NULL;
  466. -     }
  467. -     sprintf(fname,"%s/%s", home, ALIAS_DATA);
  468. -     if (unlink(fname)) {
  469. -       error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntDeleteData,
  470. -            "Could not delete alias data file %s!"), fname);
  471. -       sleep(2);
  472. -     }
  473. -     sprintf(fname,"%s/%s.dir", home, ALIAS_DATA);
  474. -     if (unlink(fname)) {
  475. -       error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntDeleteHash,
  476. -            "Could not delete alias hash file %s!"), fname);
  477. -       sleep(2);
  478. -     }
  479. -     sprintf(fname,"%s/%s.pag", home, ALIAS_DATA);
  480. -     if (unlink(fname)) {
  481. -       error1(catgets(elm_msg_cat, AliasesSet, AliasesCouldntDeleteHash,
  482. -            "Could not delete alias hash file %s!"), fname);
  483. -       sleep(2);
  484. -     }
  485. - }
  486.   alias()
  487.   {
  488.   /*
  489. --- 784,789 ----
  490. ***************
  491. *** 1053,1058 ****
  492. --- 1086,1097 ----
  493.       sprintf(itextfile, "%s/%s", home, ALIAS_TEXT);
  494.       sprintf(odatafile, "%s/%s", home, ALIAS_DATA);
  495.   
  496. + /*
  497. +  *    We need to unlimit everything since aliases are 
  498. +  *     eing read in from scratch.
  499. +  */
  500. +     selected = 0;
  501.       na = do_newalias(itextfile, odatafile, TRUE, FALSE);
  502.       if (na >= 0) {
  503.           error1(catgets(elm_msg_cat, AliasesSet, AliasesReReading,
  504. ***************
  505. *** 1306,1312 ****
  506.    *    Get an alias (name, address, etc.) from the data file
  507.    */
  508.   
  509. !     int new_max;
  510.       register struct alias_rec    **new_aliases, *a;
  511.       struct alias_rec    ar;
  512.       FILE *data_file = db->dbz_basef;
  513. --- 1345,1351 ----
  514.    *    Get an alias (name, address, etc.) from the data file
  515.    */
  516.   
  517. !     long new_max;
  518.       register struct alias_rec    **new_aliases, *a;
  519.       struct alias_rec    ar;
  520.       FILE *data_file = db->dbz_basef;
  521. ***************
  522. *** 1364,1370 ****
  523.       aliases[current] = a;
  524.       fread((char *) (a + 1), ar.length, 1, data_file);
  525.       *a = ar;
  526. !     new_max = (int) (a + 1);
  527.       a->alias += new_max;
  528.       a->last_name += new_max;
  529.       a->name += new_max;
  530. --- 1403,1409 ----
  531.       aliases[current] = a;
  532.       fread((char *) (a + 1), ar.length, 1, data_file);
  533.       *a = ar;
  534. !     new_max = (long) (a + 1);
  535.       a->alias += new_max;
  536.       a->last_name += new_max;
  537.       a->name += new_max;
  538.  
  539. Index: src/calendar.c
  540. Prereq: 5.1
  541. *** ../elm2.4/src/calendar.c    Sat Oct  3 18:58:47 1992
  542. --- src/calendar.c    Wed Nov 25 19:47:10 1992
  543. ***************
  544. *** 1,8 ****
  545.   
  546. ! static char rcsid[] = "@(#)$Id: calendar.c,v 5.1 1992/10/03 22:58:40 syd Exp $";
  547.   
  548.   /*******************************************************************************
  549. !  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
  550.    *
  551.    *             Copyright (c) 1988-1992 USENET Community Trust
  552.    *             Copyright (c) 1986,1987 Dave Taylor
  553. --- 1,8 ----
  554.   
  555. ! static char rcsid[] = "@(#)$Id: calendar.c,v 5.2 1992/11/26 00:46:50 syd Exp $";
  556.   
  557.   /*******************************************************************************
  558. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  559.    *
  560.    *             Copyright (c) 1988-1992 USENET Community Trust
  561.    *             Copyright (c) 1986,1987 Dave Taylor
  562. ***************
  563. *** 14,19 ****
  564. --- 14,24 ----
  565.    *
  566.    *******************************************************************************
  567.    * $Log: calendar.c,v $
  568. +  * Revision 5.2  1992/11/26  00:46:50  syd
  569. +  * Fix how errno is used so err is inited and used instead
  570. +  * as errno gets overwritten by print system call
  571. +  * From: Syd
  572. +  *
  573.    * Revision 5.1  1992/10/03  22:58:40  syd
  574.    * Initial checkin as of 2.4 Release at PL0
  575.    *
  576. ***************
  577. *** 48,61 ****
  578.   {
  579.       FILE *calendar;
  580.       int  count;
  581.   
  582.       /* First step is to open the calendar file for appending... **/
  583.   
  584.       if (can_open(calendar_file, "a") != 0) {
  585.         dprint(2, (debugfile,
  586.             "Error: wrong permissions to append to calendar %s\n",
  587.             calendar_file));
  588. !       dprint(2, (debugfile, "** - %s **\n", error_description(errno)));
  589.         error1(catgets(elm_msg_cat, ErrorSet, ErrorCalendarCanOpen,
  590.             "Not able to append to file %s!"), calendar_file);
  591.         return; 
  592. --- 53,68 ----
  593.   {
  594.       FILE *calendar;
  595.       int  count;
  596. +     int  err;
  597.   
  598.       /* First step is to open the calendar file for appending... **/
  599.   
  600.       if (can_open(calendar_file, "a") != 0) {
  601. +       err = errno;
  602.         dprint(2, (debugfile,
  603.             "Error: wrong permissions to append to calendar %s\n",
  604.             calendar_file));
  605. !       dprint(2, (debugfile, "** - %s **\n", error_description(err)));
  606.         error1(catgets(elm_msg_cat, ErrorSet, ErrorCalendarCanOpen,
  607.             "Not able to append to file %s!"), calendar_file);
  608.         return; 
  609. ***************
  610. *** 64,73 ****
  611.       save_file_stats(calendar_file);
  612.   
  613.       if ((calendar = fopen(calendar_file,"a")) == NULL) {
  614.         dprint(2, (debugfile, 
  615.           "Error: couldn't append to calendar file %s (scan)\n", 
  616.           calendar_file));
  617. !       dprint(2, (debugfile, "** - %s **\n", error_description(errno)));
  618.         error1(catgets(elm_msg_cat, ErrorSet, ErrorCalendarAppend,
  619.             "Couldn't append to file %s!"), calendar_file);
  620.         return; 
  621. --- 71,81 ----
  622.       save_file_stats(calendar_file);
  623.   
  624.       if ((calendar = fopen(calendar_file,"a")) == NULL) {
  625. +       err = errno;
  626.         dprint(2, (debugfile, 
  627.           "Error: couldn't append to calendar file %s (scan)\n", 
  628.           calendar_file));
  629. !       dprint(2, (debugfile, "** - %s **\n", error_description(err)));
  630.         error1(catgets(elm_msg_cat, ErrorSet, ErrorCalendarAppend,
  631.             "Couldn't append to file %s!"), calendar_file);
  632.         return; 
  633.  
  634. Index: src/curses.c
  635. Prereq: 5.7
  636. *** ../elm2.4/src/curses.c    Tue Nov 10 15:20:25 1992
  637. --- src/curses.c    Thu Dec 10 20:45:31 1992
  638. ***************
  639. *** 1,8 ****
  640.   
  641. ! static char rcsid[] = "@(#)$Id: curses.c,v 5.7 1992/11/07 20:45:39 syd Exp $";
  642.   
  643.   /*******************************************************************************
  644. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  645.    *
  646.    *             Copyright (c) 1988-1992 USENET Community Trust
  647.    *             Copyright (c) 1986,1987 Dave Taylor
  648. --- 1,8 ----
  649.   
  650. ! static char rcsid[] = "@(#)$Id: curses.c,v 5.8 1992/12/11 01:45:04 syd Exp $";
  651.   
  652.   /*******************************************************************************
  653. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  654.    *
  655.    *             Copyright (c) 1988-1992 USENET Community Trust
  656.    *             Copyright (c) 1986,1987 Dave Taylor
  657. ***************
  658. *** 14,19 ****
  659. --- 14,24 ----
  660.    *
  661.    *******************************************************************************
  662.    * $Log: curses.c,v $
  663. +  * Revision 5.8  1992/12/11  01:45:04  syd
  664. +  * remove sys/types.h include, it is now included by defs.h
  665. +  * and this routine includes defs.h or indirectly includes defs.h
  666. +  * From: Syd
  667. +  *
  668.    * Revision 5.7  1992/11/07  20:45:39  syd
  669.    * add no tite flag on options that should not use ti/te
  670.    * Hack by Syd
  671. ***************
  672. *** 78,84 ****
  673.   #include <ctype.h>
  674.   
  675.   #ifdef PTEM
  676. - #  include <sys/types.h>
  677.   #  include <sys/stream.h>
  678.   #  include <sys/ptem.h>
  679.   #endif
  680. --- 83,88 ----
  681.  
  682. Index: src/date.c
  683. Prereq: 5.2
  684. *** ../elm2.4/src/date.c    Tue Nov 17 14:10:56 1992
  685. --- src/date.c    Thu Dec 10 20:45:32 1992
  686. ***************
  687. *** 1,8 ****
  688.   
  689. ! static char rcsid[] = "@(#)$Id: date.c,v 5.2 1992/11/15 02:10:11 syd Exp $";
  690.   
  691.   /*******************************************************************************
  692. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  693.    *
  694.    *             Copyright (c) 1988-1992 USENET Community Trust
  695.    *             Copyright (c) 1986,1987 Dave Taylor
  696. --- 1,8 ----
  697.   
  698. ! static char rcsid[] = "@(#)$Id: date.c,v 5.4 1992/12/11 01:45:04 syd Exp $";
  699.   
  700.   /*******************************************************************************
  701. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  702.    *
  703.    *             Copyright (c) 1988-1992 USENET Community Trust
  704.    *             Copyright (c) 1986,1987 Dave Taylor
  705. ***************
  706. *** 14,19 ****
  707. --- 14,28 ----
  708.    *
  709.    *******************************************************************************
  710.    * $Log: date.c,v $
  711. +  * Revision 5.4  1992/12/11  01:45:04  syd
  712. +  * remove sys/types.h include, it is now included by defs.h
  713. +  * and this routine includes defs.h or indirectly includes defs.h
  714. +  * From: Syd
  715. +  *
  716. +  * Revision 5.3  1992/12/07  02:57:09  syd
  717. +  * convert long to time_t where relevant
  718. +  * From: Syd via prompting from Jim Brown
  719. +  *
  720.    * Revision 5.2  1992/11/15  02:10:11  syd
  721.    * remove no longer used tzname
  722.    * From: Syd
  723. ***************
  724. *** 29,35 ****
  725.   
  726.   
  727.   #include "headers.h"
  728. - #include <sys/types.h>
  729.   
  730.   #ifdef I_TIME
  731.   #  include <time.h>
  732. --- 38,43 ----
  733. ***************
  734. *** 162,172 ****
  735.   
  736.       static char buffer[SLEN];    /* static character buffer       */
  737.       struct tm *the_time;        /* Time structure, see CTIME(3C) */
  738. -     long       junk;        /* time in seconds....         */
  739.   
  740.   #ifdef BSD
  741.       struct  timeval  time_val;        
  742.       struct  timezone time_zone;
  743.   #endif
  744.   
  745.   #ifdef BSD
  746. --- 170,182 ----
  747.   
  748.       static char buffer[SLEN];    /* static character buffer       */
  749.       struct tm *the_time;        /* Time structure, see CTIME(3C) */
  750.   
  751.   #ifdef BSD
  752.       struct  timeval  time_val;        
  753.       struct  timezone time_zone;
  754. +     long       junk;        /* time in seconds....         */
  755. + #else
  756. +     time_t       junk;        /* time in seconds....         */
  757.   #endif
  758.   
  759.   #ifdef BSD
  760. ***************
  761. *** 173,179 ****
  762.       gettimeofday(&time_val, &time_zone);
  763.       junk = time_val.tv_sec;
  764.   #else
  765. !     junk = time((long *) 0);    /* this must be here for it to work! */
  766.   #endif
  767.       the_time = localtime(&junk);
  768.   
  769. --- 183,189 ----
  770.       gettimeofday(&time_val, &time_zone);
  771.       junk = time_val.tv_sec;
  772.   #else
  773. !     junk = time((time_t *) 0);    /* this must be here for it to work! */
  774.   #endif
  775.       the_time = localtime(&junk);
  776.   
  777. ***************
  778. *** 194,200 ****
  779.   char *
  780.   elm_date_str(buf, seconds)
  781.   char *buf;
  782. ! long seconds;
  783.   {
  784.       struct tm *tmbuf;
  785.   
  786. --- 204,210 ----
  787.   char *
  788.   elm_date_str(buf, seconds)
  789.   char *buf;
  790. ! time_t seconds;
  791.   {
  792.       struct tm *tmbuf;
  793.   
  794. ***************
  795. *** 216,222 ****
  796.   struct header_rec *entry;
  797.   {
  798.       struct tm *tmbuf;
  799. !     long seconds;
  800.   
  801.       seconds = entry->time_sent + entry->tz_offset;
  802.       tmbuf = gmtime(&seconds);
  803. --- 226,232 ----
  804.   struct header_rec *entry;
  805.   {
  806.       struct tm *tmbuf;
  807. !     time_t seconds;
  808.   
  809.       seconds = entry->time_sent + entry->tz_offset;
  810.       tmbuf = gmtime(&seconds);
  811.  
  812. Index: src/edit.c
  813. Prereq: 5.2
  814. *** ../elm2.4/src/edit.c    Tue Nov 17 14:11:04 1992
  815. --- src/edit.c    Thu Dec 10 20:56:51 1992
  816. ***************
  817. *** 1,8 ****
  818.   
  819. ! static char rcsid[] = "@(#)$Id: edit.c,v 5.2 1992/11/14 21:53:49 syd Exp $";
  820.   
  821.   /*******************************************************************************
  822. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  823.    *
  824.    *             Copyright (c) 1988-1992 USENET Community Trust
  825.    *             Copyright (c) 1986,1987 Dave Taylor
  826. --- 1,8 ----
  827.   
  828. ! static char rcsid[] = "@(#)$Id: edit.c,v 5.4 1992/12/07 14:53:21 syd Exp $";
  829.   
  830.   /*******************************************************************************
  831. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  832.    *
  833.    *             Copyright (c) 1988-1992 USENET Community Trust
  834.    *             Copyright (c) 1986,1987 Dave Taylor
  835. ***************
  836. *** 14,19 ****
  837. --- 14,28 ----
  838.    *
  839.    *******************************************************************************
  840.    * $Log: edit.c,v $
  841. +  * Revision 5.4  1992/12/07  14:53:21  syd
  842. +  * Fix typos in edit.c
  843. +  * From: Bo.Asbjorn.Muldbak <bam@jutland.ColumbiaSC.NCR.COM>
  844. +  *
  845. +  * Revision 5.3  1992/11/26  00:46:13  syd
  846. +  * changes to first change screen back (Raw off) and then issue final
  847. +  * error message.
  848. +  * From: Syd
  849. +  *
  850.    * Revision 5.2  1992/11/14  21:53:49  syd
  851.    * When elm copies the temp mailbox back to the mail spool to resync or
  852.    * quit, it changes to the mailgroup before attempting to diddle in the
  853. ***************
  854. *** 46,51 ****
  855. --- 55,86 ----
  856.   
  857.   #ifdef ALLOW_MAILBOX_EDITING
  858.   
  859. + static void copy_failed_emergency_exit(cur_folder, edited_file, linked)
  860. + char *cur_folder, *edited_file;
  861. + int linked;
  862. + {
  863. +     int err = errno;
  864. +     MoveCursor(LINES, 0);
  865. +     Raw(OFF);
  866. +     if (linked)
  867. +         MCprintf(catgets(elm_msg_cat, ElmSet, ElmCouldntLinkMailfile,
  868. +             "\nCouldn't link %s to mailfile %s!\n"),
  869. +             edited_file, cur_folder);
  870. +     else
  871. +         MCprintf(catgets(elm_msg_cat, ElmSet, ElmCouldntCopyMailfile,
  872. +             "\nCouldn't copy %s to mailfile %s!\n"),
  873. +             cur_folder, edited_file);
  874. +     printf(catgets(elm_msg_cat, ElmSet, ElmCheckOutMail,
  875. +         "\nYou'll need to check out %s for your mail.\n"),
  876. +         edited_file);
  877. +     printf("** %s. **\n", error_description(err));
  878. +     unlock();                    /* ciao!*/
  879. +     emergency_exit();
  880. + }
  881.   edit_mailbox()
  882.   {
  883.       /** Allow the user to edit their folder, always resynchronizing
  884. ***************
  885. *** 129,150 ****
  886.   
  887.            while ((len = mail_gets(buffer, SLEN, real_folder)) != 0)
  888.              if (fwrite(buffer, 1, len, temp_folder) != len) {
  889. !          Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmCouldntCopyMailfile,
  890. !             "\n\rCouldn't copy %s to mailfile %s!\n\r"),
  891. !             2, cur_folder, edited_file);
  892. !          Write_to_screen("** %s. **\n\r", 1, error_description(errno));
  893. !          unlock();                    /* ciao!*/
  894. !              emergency_exit();
  895.              }
  896.   
  897.            fclose(real_folder);
  898.            if (fclose(temp_folder)) {
  899. !            Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmCouldntCopyMailfile,
  900. !           "\n\rCouldn't copy %s to mailfile %s!\n\r"),
  901. !           2, cur_folder, edited_file);
  902. !            Write_to_screen("** %s. **\n\r", 1, error_description(errno));
  903. !            unlock();                    /* ciao!*/
  904. !            emergency_exit();
  905.            }
  906.   
  907.           } else lock(OUTGOING);
  908. --- 164,175 ----
  909.   
  910.            while ((len = mail_gets(buffer, SLEN, real_folder)) != 0)
  911.              if (fwrite(buffer, 1, len, temp_folder) != len) {
  912. !              copy_failed_emergency_exit(cur_folder, edited_file, FALSE);
  913.              }
  914.   
  915.            fclose(real_folder);
  916.            if (fclose(temp_folder)) {
  917. !            copy_failed_emergency_exit(cur_folder, edited_file, FALSE);
  918.            }
  919.   
  920.           } else lock(OUTGOING);
  921. ***************
  922. *** 162,187 ****
  923.            if (errno == EXDEV || errno == EEXIST) {
  924.              /* attempt to link across file systems */
  925.                 if (copy(edited_file, cur_folder) != 0) {
  926. !          Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmCouldntCopyMailfile,
  927. !             "\n\rCouldn't copy %s to mailfile %s!\n\r"),
  928. !             2, edited_file, cur_folder);
  929. !          Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmCheckOutMail,
  930. !             "\n\rYou'll need to check out %s for your mail.\n\r"),
  931. !             1, edited_file);
  932. !          Write_to_screen("** %s. **\n\r", 1, error_description(errno));
  933. !          unlock();                    /* ciao!*/
  934. !          emergency_exit();
  935.              }
  936.            } else {
  937. !         Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmCouldntLinkMailfile,
  938. !           "\n\rCouldn't link %s to mailfile %s!\n\r"),
  939. !           2, edited_file, cur_folder);
  940. !         Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmCheckOutMail,
  941. !           "\n\rYou'll need to check out %s for your mail.\n\r"),
  942. !           1, edited_file);
  943. !         Write_to_screen("** %s. **\n\r", 1, error_description(errno));
  944. !             unlock();                    /* ciao!*/
  945. !             emergency_exit();
  946.            }
  947.          }
  948.   
  949. --- 187,196 ----
  950.            if (errno == EXDEV || errno == EEXIST) {
  951.              /* attempt to link across file systems */
  952.                 if (copy(edited_file, cur_folder) != 0) {
  953. !              copy_failed_emergency_exit(cur_folder, edited_file, FALSE);
  954.              }
  955.            } else {
  956. !              copy_failed_emergency_exit(cur_folder, edited_file, TRUE);
  957.            }
  958.          }
  959.   
  960.  
  961. Index: src/editmsg.c
  962. Prereq: 5.4
  963. *** ../elm2.4/src/editmsg.c    Wed Nov 25 14:10:38 1992
  964. --- src/editmsg.c    Fri Dec 11 20:44:19 1992
  965. ***************
  966. *** 1,8 ****
  967.   
  968. ! static char rcsid[] = "@(#)$Id: editmsg.c,v 5.4 1992/11/22 00:03:28 syd Exp $";
  969.   
  970.   /*******************************************************************************
  971. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  972.    *
  973.    *             Copyright (c) 1988-1992 USENET Community Trust
  974.    *            Copyright (c) 1986,1987 Dave Taylor
  975. --- 1,8 ----
  976.   
  977. ! static char rcsid[] = "@(#)$Id: editmsg.c,v 5.7 1992/12/12 01:44:03 syd Exp $";
  978.   
  979.   /*******************************************************************************
  980. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  981.    *
  982.    *             Copyright (c) 1988-1992 USENET Community Trust
  983.    *            Copyright (c) 1986,1987 Dave Taylor
  984. ***************
  985. *** 14,19 ****
  986. --- 14,33 ----
  987.    *
  988.    *******************************************************************************
  989.    * $Log: editmsg.c,v $
  990. +  * Revision 5.7  1992/12/12  01:44:03  syd
  991. +  * Fix building editor wrap problem
  992. +  * From: Syd via prompting from vogt@isa.de (Gerald Vogt)
  993. +  *
  994. +  * Revision 5.6  1992/12/11  01:56:11  syd
  995. +  * If sigset() and sigrelse() are available, release signal before
  996. +  * using longjmp() to leave signal handler.
  997. +  * From: chip@tct.com (Chip Salzenberg)
  998. +  *
  999. +  * Revision 5.5  1992/11/26  00:46:13  syd
  1000. +  * changes to first change screen back (Raw off) and then issue final
  1001. +  * error message.
  1002. +  * From: Syd
  1003. +  *
  1004.    * Revision 5.4  1992/11/22  00:03:28  syd
  1005.    * Handle the case where a system does
  1006.    * >         #define jmp_buf sigjmp_buf
  1007. ***************
  1008. *** 241,254 ****
  1009.       
  1010.       char buffer[SLEN];
  1011.   
  1012. !     fclose(edit_fd);
  1013. !     if ((edit_fd = fopen(filename, "r")) == NULL) {
  1014. !       Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmCantOpenReadBail,
  1015. !           "\n\rPanic: Can't open file for reading!  Emergency Exit!\n\r"),
  1016. !           0);
  1017. !       emergency_exit();
  1018. !     }
  1019.   
  1020.       Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmEditmsgPrintTo,
  1021.           "\n\rTo: %s\n\r"), 1, format_long(to, 4));
  1022. --- 255,262 ----
  1023.       
  1024.       char buffer[SLEN];
  1025.   
  1026. !     fflush(edit_fd);
  1027. !     fseek(edit_fd, 0L, 0);
  1028.   
  1029.       Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmEditmsgPrintTo,
  1030.           "\n\rTo: %s\n\r"), 1, format_long(to, 4));
  1031. ***************
  1032. *** 264,278 ****
  1033.         CarriageReturn();
  1034.       }
  1035.   
  1036. -     fclose(edit_fd);
  1037. -     if ((edit_fd = fopen(filename, "a")) == NULL) {
  1038. -       Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmCantOpenAppendBail,
  1039. -           "\n\rPanic: Can't reopen file for appending!  Emergency Exit!\n\r"),
  1040. -           0);
  1041. -       emergency_exit();
  1042. -     }
  1043.       Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmEditmsgPrintContinue,
  1044.           "\n\r(Continue entering message.)\n\r"), 0);
  1045.   }
  1046. --- 272,277 ----
  1047. ***************
  1048. *** 430,435 ****
  1049. --- 429,443 ----
  1050.         Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmEditmsgCancelled,
  1051.           "(Interrupt. Letter cancelled.)\n\r"), 0);
  1052.   
  1053. + #if defined(SIGSET) && defined(HASSIGHOLD)
  1054. +     /*
  1055. +      * During execution of a signal handler set with sigset(),
  1056. +      * the originating signal is held.  It must be released or
  1057. +      * it cannot recur.
  1058. +      */
  1059. +     sigrelse(sig);
  1060. + #endif /* SIGSET and HASSIGHOLD */
  1061.       LONGJMP(edit_location, 1);        /* get back */
  1062.   }
  1063.   
  1064. ***************
  1065. *** 445,450 ****
  1066. --- 453,459 ----
  1067.   
  1068.       char buffer[SLEN];
  1069.       register int stat, return_value = 0, old_raw;
  1070. +     int  err;
  1071.   
  1072.       buffer[0] = '\0';
  1073.   
  1074. ***************
  1075. *** 479,488 ****
  1076.         transmit_functions(OFF);        /* function keys are local */
  1077.   
  1078.       if ((stat = system_call(buffer, SY_ENAB_SIGHUP|SY_DUMPSTATE)) == -1) {
  1079.         dprint(1,(debugfile, 
  1080.             "System call failed with stat %d (edit_the_message)\n", 
  1081.             stat));
  1082. !       dprint(1, (debugfile, "** %s **\n", error_description(errno)));
  1083.         ClearLine(LINES-1);
  1084.         error1(catgets(elm_msg_cat, ElmSet, ElmCantInvokeEditor,
  1085.           "Can't invoke editor '%s' for composition."), editor);
  1086. --- 488,498 ----
  1087.         transmit_functions(OFF);        /* function keys are local */
  1088.   
  1089.       if ((stat = system_call(buffer, SY_ENAB_SIGHUP|SY_DUMPSTATE)) == -1) {
  1090. +       err = errno;
  1091.         dprint(1,(debugfile, 
  1092.             "System call failed with stat %d (edit_the_message)\n", 
  1093.             stat));
  1094. !       dprint(1, (debugfile, "** %s **\n", error_description(err)));
  1095.         ClearLine(LINES-1);
  1096.         error1(catgets(elm_msg_cat, ElmSet, ElmCantInvokeEditor,
  1097.           "Can't invoke editor '%s' for composition."), editor);
  1098. ***************
  1099. *** 516,521 ****
  1100. --- 526,532 ----
  1101.       int      old_raw, is_wrapped = 0;
  1102.       SIGHAND_TYPE    edit_interrupt();
  1103.       SIGHAND_TYPE    (*oldint)(), (*oldquit)();
  1104. +     int  err;
  1105.   
  1106.       /* The built-in editor is not re-entrant! */
  1107.       if (builtin_editor_active) {
  1108. ***************
  1109. *** 533,546 ****
  1110.             "(Continue entering message.  Type ^D or '.' on a line by itself to end.)\n\r");
  1111.       }
  1112.   
  1113. !     if ((edit_fd = fopen(filename, "a")) == NULL) {
  1114.         sprintf(buffer, catgets(elm_msg_cat, ElmSet, ElmCouldntOpenAppend,
  1115.           "Couldn't open %s for appending [%s]."),
  1116. !         filename, error_description(errno));
  1117.         Write_to_screen(buffer, 0);
  1118.         dprint(1, (debugfile,
  1119.           "Error encountered trying to open file %s;\n", filename));
  1120. !       dprint(1, (debugfile, "** %s **\n", error_description(errno)));
  1121.         return(1);
  1122.       }
  1123.   
  1124. --- 544,558 ----
  1125.             "(Continue entering message.  Type ^D or '.' on a line by itself to end.)\n\r");
  1126.       }
  1127.   
  1128. !     if ((edit_fd = fopen(filename, "a+")) == NULL) {
  1129. !       err = errno;
  1130.         sprintf(buffer, catgets(elm_msg_cat, ElmSet, ElmCouldntOpenAppend,
  1131.           "Couldn't open %s for appending [%s]."),
  1132. !         filename, error_description(err));
  1133.         Write_to_screen(buffer, 0);
  1134.         dprint(1, (debugfile,
  1135.           "Error encountered trying to open file %s;\n", filename));
  1136. !       dprint(1, (debugfile, "** %s **\n", error_description(err)));
  1137.         return(1);
  1138.       }
  1139.   
  1140. ***************
  1141. *** 637,643 ****
  1142.                      fclose(edit_fd);
  1143.                    (void) edit_the_message(filename,0);
  1144.                    strcpy(editor, buffer);
  1145. !                  edit_fd = fopen(filename, "a");
  1146.                    Write_to_screen(post_ed_continue, 0);
  1147.                    goto more_input;
  1148.                  }
  1149. --- 649,655 ----
  1150.                      fclose(edit_fd);
  1151.                    (void) edit_the_message(filename,0);
  1152.                    strcpy(editor, buffer);
  1153. !                  edit_fd = fopen(filename, "a+");
  1154.                    Write_to_screen(post_ed_continue, 0);
  1155.                    goto more_input;
  1156.                  }
  1157. ***************
  1158. *** 657,663 ****
  1159.                 fclose(edit_fd);
  1160.                 (void) edit_the_message(filename,0);
  1161.                 strcpy(editor, buffer);
  1162. !               edit_fd = fopen(filename, "a");
  1163.                 Write_to_screen(post_ed_continue, 0);
  1164.                 goto more_input;
  1165.   
  1166. --- 669,675 ----
  1167.                 fclose(edit_fd);
  1168.                 (void) edit_the_message(filename,0);
  1169.                 strcpy(editor, buffer);
  1170. !               edit_fd = fopen(filename, "a+");
  1171.                 Write_to_screen(post_ed_continue, 0);
  1172.                 goto more_input;
  1173.   
  1174. ***************
  1175. *** 672,678 ****
  1176.                   fclose(edit_fd);
  1177.                   (void) edit_the_message(filename,0);
  1178.                   strcpy(editor, buffer);
  1179. !                 edit_fd = fopen(filename, "a");
  1180.                   Write_to_screen(post_ed_continue, 0);
  1181.                   goto more_input;
  1182.                 }
  1183. --- 684,690 ----
  1184.                   fclose(edit_fd);
  1185.                   (void) edit_the_message(filename,0);
  1186.                   strcpy(editor, buffer);
  1187. !                 edit_fd = fopen(filename, "a+");
  1188.                   Write_to_screen(post_ed_continue, 0);
  1189.                   goto more_input;
  1190.                 }
  1191.  
  1192. Index: src/elm.c
  1193. Prereq: 5.5
  1194. *** ../elm2.4/src/elm.c    Wed Nov 25 14:10:38 1992
  1195. --- src/elm.c    Thu Dec 10 20:45:33 1992
  1196. ***************
  1197. *** 1,8 ****
  1198.   
  1199. ! static char rcsid[] = "@(#)$Id: elm.c,v 5.5 1992/11/22 00:03:56 syd Exp $";
  1200.   
  1201.   /*******************************************************************************
  1202. !  *  The Elm Mail System  -  $Revision: 5.5 $   $State: Exp $
  1203.    *
  1204.    * This file and all associated files and documentation:
  1205.    *            Copyright (c) 1988-1992 USENET Community Trust
  1206. --- 1,8 ----
  1207.   
  1208. ! static char rcsid[] = "@(#)$Id: elm.c,v 5.8 1992/12/11 01:45:04 syd Exp $";
  1209.   
  1210.   /*******************************************************************************
  1211. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  1212.    *
  1213.    * This file and all associated files and documentation:
  1214.    *            Copyright (c) 1988-1992 USENET Community Trust
  1215. ***************
  1216. *** 15,20 ****
  1217. --- 15,34 ----
  1218.    *
  1219.    *******************************************************************************
  1220.    * $Log: elm.c,v $
  1221. +  * Revision 5.8  1992/12/11  01:45:04  syd
  1222. +  * remove sys/types.h include, it is now included by defs.h
  1223. +  * and this routine includes defs.h or indirectly includes defs.h
  1224. +  * From: Syd
  1225. +  *
  1226. +  * Revision 5.7  1992/12/07  02:58:13  syd
  1227. +  * fix long -> time_t
  1228. +  * From: Syd
  1229. +  *
  1230. +  * Revision 5.6  1992/11/26  00:46:13  syd
  1231. +  * changes to first change screen back (Raw off) and then issue final
  1232. +  * error message.
  1233. +  * From: Syd
  1234. +  *
  1235.    * Revision 5.5  1992/11/22  00:03:56  syd
  1236.    * Fix segmentation violation on restricted alias page jump.
  1237.    * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
  1238. ***************
  1239. *** 53,59 ****
  1240.   #  include <sys/time.h>
  1241.   #endif
  1242.   #ifdef BSD
  1243. - #  include <sys/types.h>
  1244.   #  include <sys/timeb.h>
  1245.   
  1246.   #undef        toupper
  1247. --- 67,72 ----
  1248. ***************
  1249. *** 141,149 ****
  1250.             dprint(1, (debugfile,
  1251.               "Error: given file %s as folder - unreadable (%s)!\n", 
  1252.               cur_folder, error_description(errno)));
  1253.             fprintf(stderr, catgets(elm_msg_cat, ElmSet, ElmCantOpenFolderRead,
  1254.           "Can't open folder '%s' for reading!\n"), cur_folder);
  1255. !           leave();
  1256.             }
  1257.   
  1258.           newmbox(cur_folder, TRUE);    /* last won't be touched! */
  1259. --- 154,163 ----
  1260.             dprint(1, (debugfile,
  1261.               "Error: given file %s as folder - unreadable (%s)!\n", 
  1262.               cur_folder, error_description(errno)));
  1263. +           Raw(OFF);
  1264.             fprintf(stderr, catgets(elm_msg_cat, ElmSet, ElmCantOpenFolderRead,
  1265.           "Can't open folder '%s' for reading!\n"), cur_folder);
  1266. !           leave(0);
  1267.             }
  1268.   
  1269.           newmbox(cur_folder, TRUE);    /* last won't be touched! */
  1270. ***************
  1271. *** 425,431 ****
  1272.                  if((i=options()) > 0)
  1273.                    get_page(current);
  1274.                  else if(i < 0)
  1275. !                  leave();
  1276.                  redraw++;    /* always fix da screen... */
  1277.                  break;
  1278.   
  1279. --- 439,445 ----
  1280.                  if((i=options()) > 0)
  1281.                    get_page(current);
  1282.                  else if(i < 0)
  1283. !                  leave(0);
  1284.                  redraw++;    /* always fix da screen... */
  1285.                  break;
  1286.   
  1287. ***************
  1288. *** 522,528 ****
  1289.                    catgets(elm_msg_cat, ElmSet, ElmQuickExit,
  1290.                    "Quick Exit"));
  1291.                              fflush(stdout);
  1292. !                leave();
  1293.                  break;
  1294.   
  1295.           case ctrl('Q') :
  1296. --- 536,542 ----
  1297.                    catgets(elm_msg_cat, ElmSet, ElmQuickExit,
  1298.                    "Quick Exit"));
  1299.                              fflush(stdout);
  1300. !                leave(0);
  1301.                  break;
  1302.   
  1303.           case ctrl('Q') :
  1304. ***************
  1305. *** 533,539 ****
  1306.                  exit_prog();
  1307.                  break;
  1308.   
  1309. !             case EOF :  leave();  /* Read failed, control tty died? */
  1310.                           break;
  1311.           
  1312.           case '@'    : debug_screen();  redraw++;    break;
  1313. --- 547,553 ----
  1314.                  exit_prog();
  1315.                  break;
  1316.   
  1317. !             case EOF :  leave(0);  /* Read failed, control tty died? */
  1318.                           break;
  1319.           
  1320.           case '@'    : debug_screen();  redraw++;    break;
  1321. ***************
  1322. *** 631,637 ****
  1323.             in the record structure. **/
  1324.       
  1325.       char buffer[SLEN];
  1326. !     long header_time;
  1327.       register struct header_rec *current_header = headers[current-1];
  1328.   
  1329.       ClearScreen();
  1330. --- 645,651 ----
  1331.             in the record structure. **/
  1332.       
  1333.       char buffer[SLEN];
  1334. !     time_t header_time;
  1335.       register struct header_rec *current_header = headers[current-1];
  1336.   
  1337.       ClearScreen();
  1338.  
  1339. Index: src/encode.c
  1340. Prereq: 5.1
  1341. *** ../elm2.4/src/encode.c    Sat Oct  3 18:58:52 1992
  1342. --- src/encode.c    Sun Dec  6 21:34:57 1992
  1343. ***************
  1344. *** 1,8 ****
  1345.   
  1346. ! static char rcsid[] = "@(#)$Id: encode.c,v 5.1 1992/10/03 22:58:40 syd Exp $";
  1347.   
  1348.   /*******************************************************************************
  1349. !  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
  1350.    *
  1351.    *            Copyright (c) 1988-1992 USENET Community Trust
  1352.    *            Copyright (c) 1986,1987 Dave Taylor
  1353. --- 1,8 ----
  1354.   
  1355. ! static char rcsid[] = "@(#)$Id: encode.c,v 5.2 1992/12/07 02:34:56 syd Exp $";
  1356.   
  1357.   /*******************************************************************************
  1358. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  1359.    *
  1360.    *            Copyright (c) 1988-1992 USENET Community Trust
  1361.    *            Copyright (c) 1986,1987 Dave Taylor
  1362. ***************
  1363. *** 14,19 ****
  1364. --- 14,26 ----
  1365.    *
  1366.    *******************************************************************************
  1367.    * $Log: encode.c,v $
  1368. +  * Revision 5.2  1992/12/07  02:34:56  syd
  1369. +  * Traditional C used 'unsigned preserving' rules when an integral data
  1370. +  * value is widened to integer and ANSI C changed the rules to 'value
  1371. +  * preserving'. This is one of the few things that the ANSI X3J11 comitte
  1372. +  * did that might break existing programs.  Casting to (int)
  1373. +  * From: Bo.Asbjorn.Muldbak <bam@jutland.ColumbiaSC.NCR.COM>
  1374. +  *
  1375.    * Revision 5.1  1992/10/03  22:58:40  syd
  1376.    * Initial checkin as of 2.4 Release at PL0
  1377.    *
  1378. ***************
  1379. *** 136,145 ****
  1380.           for ( j = 0; j < RN; j++ )        /* rotor forwards */
  1381.             i = r[(i+p[j])%RTRSZ][j];
  1382.   
  1383. !         i = ((h[(i+ph)%RTRSZ])-ph+RTRSZ)%RTRSZ;    /* half rotor */
  1384.   
  1385.           for ( j--  ; j >= 0; j-- )        /* rotor backwards */
  1386. !           i = (ir[i][j]+RTRSZ-p[j])%RTRSZ;
  1387.   
  1388.           j = 0;                /* rotate rotors */
  1389.           p[0]++;
  1390. --- 143,152 ----
  1391.           for ( j = 0; j < RN; j++ )        /* rotor forwards */
  1392.             i = r[(i+p[j])%RTRSZ][j];
  1393.   
  1394. !         i = (((int)h[(i+ph)%RTRSZ])-ph+RTRSZ)%RTRSZ;    /* half rotor */
  1395.   
  1396.           for ( j--  ; j >= 0; j-- )        /* rotor backwards */
  1397. !           i = ((int)ir[i][j]+RTRSZ-p[j])%RTRSZ;
  1398.   
  1399.           j = 0;                /* rotate rotors */
  1400.           p[0]++;
  1401.  
  1402. Index: src/expires.c
  1403. Prereq: 5.1
  1404. *** ../elm2.4/src/expires.c    Sat Oct  3 18:58:53 1992
  1405. --- src/expires.c    Sun Dec  6 21:59:02 1992
  1406. ***************
  1407. *** 1,8 ****
  1408.   
  1409. ! static char rcsid[] = "@(#)$Id: expires.c,v 5.1 1992/10/03 22:58:40 syd Exp $";
  1410.   
  1411.   /*******************************************************************************
  1412. !  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
  1413.    *
  1414.    *            Copyright (c) 1988-1992 USENET Community Trust
  1415.    *            Copyright (c) 1986,1987 Dave Taylor
  1416. --- 1,8 ----
  1417.   
  1418. ! static char rcsid[] = "@(#)$Id: expires.c,v 5.2 1992/12/07 02:58:56 syd Exp $";
  1419.   
  1420.   /*******************************************************************************
  1421. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  1422.    *
  1423.    *            Copyright (c) 1988-1992 USENET Community Trust
  1424.    *            Copyright (c) 1986,1987 Dave Taylor
  1425. ***************
  1426. *** 14,19 ****
  1427. --- 14,23 ----
  1428.    *
  1429.    *******************************************************************************
  1430.    * $Log: expires.c,v $
  1431. +  * Revision 5.2  1992/12/07  02:58:56  syd
  1432. +  * Fix long -> time_t
  1433. +  * From: Syd
  1434. +  *
  1435.    * Revision 5.1  1992/10/03  22:58:40  syd
  1436.    * Initial checkin as of 2.4 Release at PL0
  1437.    *
  1438. ***************
  1439. *** 47,58 ****
  1440.   int  *message_status;
  1441.   {
  1442.       struct tm *timestruct;
  1443. !     long thetime;
  1444.       char word1[WLEN], word2[WLEN], word3[WLEN], word4[WLEN], word5[WLEN];
  1445.       int  month = 0, day = 0, year = 0, hour = 0, minute = 0;
  1446.   #ifndef    _POSIX_SOURCE
  1447.       struct tm *localtime();
  1448. !     long time();
  1449.   #endif
  1450.   
  1451.       /** first step is to break down the date given into MM DD YY HH MM
  1452. --- 51,62 ----
  1453.   int  *message_status;
  1454.   {
  1455.       struct tm *timestruct;
  1456. !     time_t thetime;
  1457.       char word1[WLEN], word2[WLEN], word3[WLEN], word4[WLEN], word5[WLEN];
  1458.       int  month = 0, day = 0, year = 0, hour = 0, minute = 0;
  1459.   #ifndef    _POSIX_SOURCE
  1460.       struct tm *localtime();
  1461. !     time_t time();
  1462.   #endif
  1463.   
  1464.       /** first step is to break down the date given into MM DD YY HH MM
  1465. ***************
  1466. *** 115,121 ****
  1467.   
  1468.       /** next let's get the current time and date, please **/
  1469.   
  1470. !     thetime = time((long *) 0);
  1471.   
  1472.       timestruct = localtime(&thetime);
  1473.   
  1474. --- 119,125 ----
  1475.   
  1476.       /** next let's get the current time and date, please **/
  1477.   
  1478. !     thetime = time((time_t *) 0);
  1479.   
  1480.       timestruct = localtime(&thetime);
  1481.   
  1482.  
  1483. Index: src/file.c
  1484. Prereq: 5.5
  1485. *** ../elm2.4/src/file.c    Mon Nov  2 15:51:46 1992
  1486. --- src/file.c    Sun Dec  6 21:38:46 1992
  1487. ***************
  1488. *** 1,8 ****
  1489.   
  1490. ! static char rcsid[] = "@(#)$Id: file.c,v 5.5 1992/10/30 21:01:49 syd Exp $";
  1491.   
  1492.   /*******************************************************************************
  1493. !  *  The Elm Mail System  -  $Revision: 5.5 $   $State: Exp $
  1494.    *
  1495.    *            Copyright (c) 1988-1992 USENET Community Trust
  1496.    *            Copyright (c) 1986,1987 Dave Taylor
  1497. --- 1,8 ----
  1498.   
  1499. ! static char rcsid[] = "@(#)$Id: file.c,v 5.7 1992/12/07 02:38:45 syd Exp $";
  1500.   
  1501.   /*******************************************************************************
  1502. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  1503.    *
  1504.    *            Copyright (c) 1988-1992 USENET Community Trust
  1505.    *            Copyright (c) 1986,1987 Dave Taylor
  1506. ***************
  1507. *** 14,19 ****
  1508. --- 14,38 ----
  1509.    *
  1510.    *******************************************************************************
  1511.    * $Log: file.c,v $
  1512. +  * Revision 5.7  1992/12/07  02:38:45  syd
  1513. +  * When ELM is reporting "appending to <foldername>" I never get to see
  1514. +  * but a flash of light, before the message line has been replaced by a
  1515. +  * dummy "Messages saved" string.  And if you happen to have mistyped the
  1516. +  * foldername or the leading '=', you never see the foldername.
  1517. +  *
  1518. +  * This fix will change file.c to show either
  1519. +  *
  1520. +  *     Message <what> to <foldername>
  1521. +  *
  1522. +  * or
  1523. +  *     <#> messages <what> to <foldername>
  1524. +  * From: Bo.Asbjorn.Muldbak <bam@jutland.ColumbiaSC.NCR.COM>
  1525. +  *
  1526. +  * Revision 5.6  1992/11/26  01:46:26  syd
  1527. +  * add Decode option to copy_message, convert copy_message to
  1528. +  * use bit or for options.
  1529. +  * From: Syd and bjoerns@stud.cs.uit.no (Bjoern Stabell)
  1530. +  *
  1531.    * Revision 5.5  1992/10/30  21:01:49  syd
  1532.    * More changes to folder creation confirmation
  1533.    * From: Larry Philps <larryp@sco.COM>
  1534. ***************
  1535. *** 155,161 ****
  1536.       **/
  1537.   
  1538.       register int    tagged = 0, i, oldstat, appending = 0,
  1539. !             is_ordinary_file;
  1540.       int mesgnum;    /* message whose address is used for save-by-name fn */
  1541.       char    filename[SLEN], address[LONG_STRING], buffer[LONG_STRING],
  1542.           ch;
  1543. --- 174,180 ----
  1544.       **/
  1545.   
  1546.       register int    tagged = 0, i, oldstat, appending = 0,
  1547. !             is_ordinary_file, scount = 0;
  1548.       int mesgnum;    /* message whose address is used for save-by-name fn */
  1549.       char    filename[SLEN], address[LONG_STRING], buffer[LONG_STRING],
  1550.           ch;
  1551. ***************
  1552. *** 339,347 ****
  1553.       if(*redraw) silently = TRUE;
  1554.   
  1555.       for (i=0; i < message_count; i++)     /* save each tagged msg */
  1556. !       if (headers[i]->status & TAGGED)
  1557.           save_message(i, filename, save_file, (tagged > 1), appending++, 
  1558.                silently, delete);
  1559.   
  1560.       fclose(save_file);
  1561.   
  1562. --- 358,368 ----
  1563.       if(*redraw) silently = TRUE;
  1564.   
  1565.       for (i=0; i < message_count; i++)     /* save each tagged msg */
  1566. !       if (headers[i]->status & TAGGED) {
  1567.           save_message(i, filename, save_file, (tagged > 1), appending++, 
  1568.                silently, delete);
  1569. +         scount++;
  1570. +       }
  1571.   
  1572.       fclose(save_file);
  1573.   
  1574. ***************
  1575. *** 348,358 ****
  1576.       restore_file_stats(filename);
  1577.   
  1578.       if (tagged == 1)
  1579. !       error1(catgets(elm_msg_cat, ElmSet, ElmMessageSaved,
  1580. !         "Message %s."), delete ? saved_word: copied_word);
  1581.       else if (tagged > 1)
  1582. !       error1(catgets(elm_msg_cat, ElmSet, ElmMessagesSaved,
  1583. !           "Messages %s."), delete ? saved_word: copied_word);
  1584.       return(1);
  1585.   }
  1586.   
  1587. --- 369,382 ----
  1588.       restore_file_stats(filename);
  1589.   
  1590.       if (tagged == 1)
  1591. !       error2(catgets(elm_msg_cat, ElmSet, ElmMessageSaved,
  1592. !         "Message %s to %s."), delete ? saved_word: copied_word,
  1593. !         filename);
  1594.       else if (tagged > 1)
  1595. !       error3(catgets(elm_msg_cat, ElmSet, ElmMessagesSaved,
  1596. !           "%d messages %s to %s."), scount, 
  1597. !           delete ? saved_word: copied_word,
  1598. !           filename);
  1599.       return(1);
  1600.   }
  1601.   
  1602. ***************
  1603. *** 386,392 ****
  1604.        */
  1605.       if(is_new = ison(headers[number]->status, NEW))
  1606.         clearit(headers[number]->status, NEW);
  1607. !     copy_message("", fd, FALSE, FALSE, TRUE, FALSE, FALSE);
  1608.       if(is_new)
  1609.         setit(headers[number]->status, NEW);
  1610.       current = save_current;
  1611. --- 410,416 ----
  1612.        */
  1613.       if(is_new = ison(headers[number]->status, NEW))
  1614.         clearit(headers[number]->status, NEW);
  1615. !     copy_message("", fd, CM_UPDATE_STATUS);
  1616.       if(is_new)
  1617.         setit(headers[number]->status, NEW);
  1618.       current = save_current;
  1619.  
  1620. Index: src/file_util.c
  1621. Prereq: 5.1
  1622. *** ../elm2.4/src/file_util.c    Sat Oct  3 18:58:54 1992
  1623. --- src/file_util.c    Thu Dec 10 20:45:33 1992
  1624. ***************
  1625. *** 1,8 ****
  1626.   
  1627. ! static char rcsid[] = "@(#)$Id: file_util.c,v 5.1 1992/10/03 22:58:40 syd Exp $";
  1628.   
  1629.   /*******************************************************************************
  1630. !  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
  1631.    *
  1632.    *            Copyright (c) 1988-1992 USENET Community Trust
  1633.    *            Copyright (c) 1986,1987 Dave Taylor
  1634. --- 1,8 ----
  1635.   
  1636. ! static char rcsid[] = "@(#)$Id: file_util.c,v 5.3 1992/12/11 01:45:04 syd Exp $";
  1637.   
  1638.   /*******************************************************************************
  1639. !  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
  1640.    *
  1641.    *            Copyright (c) 1988-1992 USENET Community Trust
  1642.    *            Copyright (c) 1986,1987 Dave Taylor
  1643. ***************
  1644. *** 14,19 ****
  1645. --- 14,29 ----
  1646.    *
  1647.    *******************************************************************************
  1648.    * $Log: file_util.c,v $
  1649. +  * Revision 5.3  1992/12/11  01:45:04  syd
  1650. +  * remove sys/types.h include, it is now included by defs.h
  1651. +  * and this routine includes defs.h or indirectly includes defs.h
  1652. +  * From: Syd
  1653. +  *
  1654. +  * Revision 5.2  1992/11/26  00:46:13  syd
  1655. +  * changes to first change screen back (Raw off) and then issue final
  1656. +  * error message.
  1657. +  * From: Syd
  1658. +  *
  1659.    * Revision 5.1  1992/10/03  22:58:40  syd
  1660.    * Initial checkin as of 2.4 Release at PL0
  1661.    *
  1662. ***************
  1663. *** 26,32 ****
  1664.   
  1665.   #include "headers.h"
  1666.   #include "s_elm.h"
  1667. - #include <sys/types.h>
  1668.   #include <sys/stat.h>
  1669.   #include <ctype.h>
  1670.   #include <errno.h>
  1671. --- 36,41 ----
  1672. ***************
  1673. *** 50,55 ****
  1674. --- 59,65 ----
  1675.   bytes(name)
  1676.   char *name;
  1677.   {
  1678. +     int err;
  1679.       /** return the number of bytes in the specified file.  This
  1680.           is to check to see if new mail has arrived....  (also
  1681.           see "fsize()" to see how we can get the same information
  1682. ***************
  1683. *** 57,74 ****
  1684.       **/
  1685.   
  1686.       int ok = 1;
  1687. -     extern int errno;    /* system error number! */
  1688.       struct stat buffer;
  1689.   
  1690.       if (stat(name, &buffer) != 0)
  1691.         if (errno != 2) {
  1692.           dprint(1,(debugfile,
  1693.                "Error: errno %s on fstat of file %s (bytes)\n", 
  1694. !              error_description(errno), name));
  1695. !         Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmErrorFstat,
  1696. !              "\n\rError attempting fstat on file %s!\n\r"),
  1697. !              1, name);
  1698. !         Write_to_screen("** %s. **\n\r", 1, error_description(errno));
  1699.           emergency_exit();
  1700.         }
  1701.         else
  1702. --- 67,86 ----
  1703.       **/
  1704.   
  1705.       int ok = 1;
  1706.       struct stat buffer;
  1707.   
  1708.       if (stat(name, &buffer) != 0)
  1709.         if (errno != 2) {
  1710. +         err = errno;
  1711. +         MoveCursor(LINES, 0);
  1712. +         Raw(OFF);
  1713.           dprint(1,(debugfile,
  1714.                "Error: errno %s on fstat of file %s (bytes)\n", 
  1715. !              error_description(err), name));
  1716. !         printf(catgets(elm_msg_cat, ElmSet, ElmErrorFstat,
  1717. !              "\nError attempting fstat on file %s!\n"),
  1718. !              name);
  1719. !         printf("** %s. **\n", error_description(err));
  1720.           emergency_exit();
  1721.         }
  1722.         else
  1723. ***************
  1724. *** 146,153 ****
  1725.       }
  1726.   
  1727.       if (prefix_str != NULL && fputs(prefix_str, fd) == EOF) {
  1728. !       Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmWriteFailedAppend,
  1729. !         "\n\rWrite failed to tempfile in append\n\r"), 0);
  1730.         perror(filename);
  1731.         rm_temps_exit();
  1732.       }
  1733. --- 158,167 ----
  1734.       }
  1735.   
  1736.       if (prefix_str != NULL && fputs(prefix_str, fd) == EOF) {
  1737. !       MoveCursor(LINES, 0);
  1738. !       Raw(OFF);
  1739. !       printf(catgets(elm_msg_cat, ElmSet, ElmWriteFailedAppend,
  1740. !         "\nWrite failed to tempfile in append\n"));
  1741.         perror(filename);
  1742.         rm_temps_exit();
  1743.       }
  1744. ***************
  1745. *** 154,168 ****
  1746.   
  1747.       while (len = fread(buffer, 1, VERY_LONG_STRING, my_fd))
  1748.         if (fwrite(buffer, 1, len, fd) != len) {
  1749. !           Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmWriteFailedAppend,
  1750. !               "\n\rWrite failed to tempfile in append\n\r"), 0);
  1751.             perror(filename);
  1752.             rm_temps_exit();
  1753.         }
  1754.   
  1755.       if (fclose(my_fd) == EOF) {
  1756. !       Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmCloseFailedAppend,
  1757. !           "\n\rClose failed on tempfile in append\n\r"), 0);
  1758.         perror(filename);
  1759.         rm_temps_exit();
  1760.       }
  1761. --- 168,186 ----
  1762.   
  1763.       while (len = fread(buffer, 1, VERY_LONG_STRING, my_fd))
  1764.         if (fwrite(buffer, 1, len, fd) != len) {
  1765. !           MoveCursor(LINES, 0);
  1766. !           Raw(OFF);
  1767. !           printf(catgets(elm_msg_cat, ElmSet, ElmWriteFailedAppend,
  1768. !               "\nWrite failed to tempfile in append\n"));
  1769.             perror(filename);
  1770.             rm_temps_exit();
  1771.         }
  1772.   
  1773.       if (fclose(my_fd) == EOF) {
  1774. !       MoveCursor(LINES, 0);
  1775. !       Raw(OFF);
  1776. !       printf(catgets(elm_msg_cat, ElmSet, ElmCloseFailedAppend,
  1777. !           "\nClose failed on tempfile in append\n"));
  1778.         perror(filename);
  1779.         rm_temps_exit();
  1780.       }
  1781.  
  1782. Index: src/lock.c
  1783. Prereq: 5.6
  1784. *** ../elm2.4/src/lock.c    Tue Oct 27 11:17:29 1992
  1785. --- src/lock.c    Thu Dec 10 20:45:36 1992
  1786. ***************
  1787. *** 1,8 ****
  1788.   
  1789. ! static char rcsid[] = "@(#)$Id: lock.c,v 5.6 1992/10/27 01:52:16 syd Exp $";
  1790.   
  1791.   /*******************************************************************************
  1792. !  *  The Elm Mail System  -  $Revision: 5.6 $   $State: Exp $
  1793.    *
  1794.    *            Copyright (c) 1988-1992 USENET Community Trust
  1795.    *            Copyright (c) 1986,1987 Dave Taylor
  1796. --- 1,8 ----
  1797.   
  1798. ! static char rcsid[] = "@(#)$Id: lock.c,v 5.10 1992/12/11 01:45:04 syd Exp $";
  1799.   
  1800.   /*******************************************************************************
  1801. !  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
  1802.    *
  1803.    *            Copyright (c) 1988-1992 USENET Community Trust
  1804.    *            Copyright (c) 1986,1987 Dave Taylor
  1805. ***************
  1806. *** 14,19 ****
  1807. --- 14,38 ----
  1808.    *
  1809.    *******************************************************************************
  1810.    * $Log: lock.c,v $
  1811. +  * Revision 5.10  1992/12/11  01:45:04  syd
  1812. +  * remove sys/types.h include, it is now included by defs.h
  1813. +  * and this routine includes defs.h or indirectly includes defs.h
  1814. +  * From: Syd
  1815. +  *
  1816. +  * Revision 5.9  1992/12/07  03:49:49  syd
  1817. +  * use BSD or not apollo on file.h include as its not valid
  1818. +  * for Apollos under sys5.3 compile type
  1819. +  * From: gordonb@mcil.comm.mot.com (Gordon Berkley)
  1820. +  *
  1821. +  * Revision 5.8  1992/12/07  02:23:35  syd
  1822. +  * Always init fcntlerr and flockerr so useage after ifdef code doesnt cause problem
  1823. +  * From: Syd via prompt from wdh@grouper.mkt.csd.harris.com (W. David Higgins)
  1824. +  *
  1825. +  * Revision 5.7  1992/11/26  00:46:13  syd
  1826. +  * changes to first change screen back (Raw off) and then issue final
  1827. +  * error message.
  1828. +  * From: Syd
  1829. +  *
  1830.    * Revision 5.6  1992/10/27  01:52:16  syd
  1831.    * Always include <sys/ioctl.h> in curses.c When calling ioctl()
  1832.    *
  1833. ***************
  1834. *** 50,56 ****
  1835.   
  1836.   #include "headers.h"
  1837.   #include "s_elm.h"
  1838. - #include <sys/types.h>
  1839.   #include <sys/stat.h>
  1840.   
  1841.   #ifdef USE_FCNTL_LOCKING
  1842. --- 69,74 ----
  1843. ***************
  1844. *** 62,68 ****
  1845.   #endif
  1846.   
  1847.   #ifdef SYSCALL_LOCKING
  1848. ! #include <sys/file.h>
  1849.   #endif
  1850.   #include <errno.h>
  1851.   #ifdef I_TIME
  1852. --- 80,88 ----
  1853.   #endif
  1854.   
  1855.   #ifdef SYSCALL_LOCKING
  1856. ! #  if (defined(BSD) || !defined(apollo))
  1857. ! #    include <sys/file.h>
  1858. ! #  endif
  1859.   #endif
  1860.   #include <errno.h>
  1861.   #ifdef I_TIME
  1862. ***************
  1863. *** 153,160 ****
  1864.   {
  1865.       int    fcntlret = 0,
  1866.       flockret = 0,
  1867. !     fcntlerr,
  1868. !     flockerr;
  1869.   
  1870.   #ifdef    USE_FLOCK_LOCKING
  1871.       errno = 0;
  1872. --- 173,180 ----
  1873.   {
  1874.       int    fcntlret = 0,
  1875.       flockret = 0,
  1876. !     fcntlerr = 0,
  1877. !     flockerr = 0;
  1878.   
  1879.   #ifdef    USE_FLOCK_LOCKING
  1880.       errno = 0;
  1881. ***************
  1882. *** 231,247 ****
  1883.           if (kill_status != 0 && errno != EPERM) {
  1884.             close(create_fd);
  1885.             if (unlink(lockfile) != 0) {
  1886.           dprint(1, (debugfile,
  1887.             "Error %s\n\ttrying to unlink file %s (%s)\n", 
  1888.             error_description(errno), lockfile, "lock"));
  1889. !         PutLine1(LINES, 0, catgets(elm_msg_cat, ElmSet, ElmLeaveCouldntRemoveCurLock,
  1890. !           "\n\rCouldn't remove the current lock file %s\n\r"), lockfile);
  1891. !         PutLine1(LINES, 0, "** %s **\n\r", error_description(errno));
  1892.   #ifdef SAVE_GROUP_MAILBOX_ID
  1893.           setgid(groupid);
  1894.   #endif
  1895.           if (direction == INCOMING)
  1896. !           leave();
  1897.           else
  1898.             emergency_exit();
  1899.             }
  1900. --- 251,269 ----
  1901.           if (kill_status != 0 && errno != EPERM) {
  1902.             close(create_fd);
  1903.             if (unlink(lockfile) != 0) {
  1904. +             MoveCursor(LINES, 0);
  1905. +         Raw(OFF);
  1906.           dprint(1, (debugfile,
  1907.             "Error %s\n\ttrying to unlink file %s (%s)\n", 
  1908.             error_description(errno), lockfile, "lock"));
  1909. !         printf(catgets(elm_msg_cat, ElmSet, ElmLeaveCouldntRemoveCurLock,
  1910. !           "\nCouldn't remove the current lock file %s\n"), lockfile);
  1911. !         printf("** %s **\n", error_description(errno));
  1912.   #ifdef SAVE_GROUP_MAILBOX_ID
  1913.           setgid(groupid);
  1914.   #endif
  1915.           if (direction == INCOMING)
  1916. !           leave(0);
  1917.           else
  1918.             emergency_exit();
  1919.             }
  1920. ***************
  1921. *** 262,288 ****
  1922.         if(errno != EEXIST) {
  1923.           /* Creation of lock failed NOT because it already exists!!! */
  1924.   
  1925.           if (direction == OUTGOING) {
  1926.             dprint(1, (debugfile, 
  1927.           "Error encountered attempting to create lock %s\n", lockfile));
  1928.             dprint(1, (debugfile, "** %s **\n", error_description(errno)));
  1929. -           MoveCursor(LINES, 0);
  1930.             printf(catgets(elm_msg_cat, ElmSet, ElmLeaveErrorCreatingLock,
  1931. !        "\n\rError encountered while attempting to create lock file %s;\n\r"),
  1932.           lockfile);
  1933. !           printf("** %s.**\n\r\n\r", error_description(errno));
  1934.           } else {    /* incoming - permission denied in the middle?  Odd. */
  1935.             dprint(1, (debugfile,
  1936.              "Can't create lock file: creat(%s) raises error %s (lock)\n", 
  1937.           lockfile, error_description(errno)));
  1938. !           error1(catgets(elm_msg_cat, ElmSet, ElmLeaveCantCreateLock,
  1939. !            "Can't create lock file! Need write permission in \"%s\".\n\r"),
  1940.           mailhome);
  1941.           }
  1942.   #ifdef SAVE_GROUP_MAILBOX_ID
  1943.           setgid(groupid);
  1944.   #endif
  1945. !         leave();
  1946.         }
  1947.       }
  1948.       dprint(2, (debugfile,"File '%s' already exists!  Waiting...(lock)\n", 
  1949. --- 284,311 ----
  1950.         if(errno != EEXIST) {
  1951.           /* Creation of lock failed NOT because it already exists!!! */
  1952.   
  1953. +         MoveCursor(LINES, 0);
  1954. +         Raw(OFF);
  1955.           if (direction == OUTGOING) {
  1956.             dprint(1, (debugfile, 
  1957.           "Error encountered attempting to create lock %s\n", lockfile));
  1958.             dprint(1, (debugfile, "** %s **\n", error_description(errno)));
  1959.             printf(catgets(elm_msg_cat, ElmSet, ElmLeaveErrorCreatingLock,
  1960. !        "\nError encountered while attempting to create lock file %s;\n"),
  1961.           lockfile);
  1962. !           printf("** %s.**\n\n", error_description(errno));
  1963.           } else {    /* incoming - permission denied in the middle?  Odd. */
  1964.             dprint(1, (debugfile,
  1965.              "Can't create lock file: creat(%s) raises error %s (lock)\n", 
  1966.           lockfile, error_description(errno)));
  1967. !           printf(catgets(elm_msg_cat, ElmSet, ElmLeaveCantCreateLock,
  1968. !            "Can't create lock file! Need write permission in \"%s\".\n"),
  1969.           mailhome);
  1970.           }
  1971.   #ifdef SAVE_GROUP_MAILBOX_ID
  1972.           setgid(groupid);
  1973.   #endif
  1974. !         leave(0);
  1975.         }
  1976.       }
  1977.       dprint(2, (debugfile,"File '%s' already exists!  Waiting...(lock)\n", 
  1978. ***************
  1979. *** 311,327 ****
  1980.           "Throwing away the current lock file!"));
  1981.   
  1982.       if (unlink(lockfile) != 0) {
  1983.         dprint(1, (debugfile,
  1984.           "Error %s\n\ttrying to unlink file %s (%s)\n", 
  1985.           error_description(errno), lockfile, "lock"));
  1986. !       PutLine1(LINES, 0, catgets(elm_msg_cat, ElmSet, ElmLeaveCouldntRemoveCurLock,
  1987. !         "\n\rCouldn't remove the current lock file %s\n\r"), lockfile);
  1988. !       PutLine1(LINES, 0, "** %s **\n\r", error_description(errno));
  1989.   #ifdef SAVE_GROUP_MAILBOX_ID
  1990.         setgid(groupid);
  1991.   #endif
  1992.         if (direction == INCOMING)
  1993. !         leave();
  1994.         else
  1995.           emergency_exit();
  1996.       }
  1997. --- 334,352 ----
  1998.           "Throwing away the current lock file!"));
  1999.   
  2000.       if (unlink(lockfile) != 0) {
  2001. +       MoveCursor(LINES, 0);
  2002. +       Raw(OFF);
  2003.         dprint(1, (debugfile,
  2004.           "Error %s\n\ttrying to unlink file %s (%s)\n", 
  2005.           error_description(errno), lockfile, "lock"));
  2006. !       printf(catgets(elm_msg_cat, ElmSet, ElmLeaveCouldntRemoveCurLock,
  2007. !         "\nCouldn't remove the current lock file %s\n"), lockfile);
  2008. !       printf("** %s **\n", error_description(errno));
  2009.   #ifdef SAVE_GROUP_MAILBOX_ID
  2010.         setgid(groupid);
  2011.   #endif
  2012.         if (direction == INCOMING)
  2013. !         leave(0);
  2014.         else
  2015.           emergency_exit();
  2016.       }
  2017. ***************
  2018. *** 334,358 ****
  2019.           "Error encountered attempting to create lock %s\n", lockfile));
  2020.         dprint(1, (debugfile, "** %s **\n", error_description(errno)));
  2021.         MoveCursor(LINES, 0);
  2022.         printf(catgets(elm_msg_cat, ElmSet, ElmLeaveErrorCreatingLock,
  2023. !       "\n\rError encountered while attempting to create lock file %s;\n\r"),
  2024.           lockfile);
  2025. !       printf("** %s. **\n\r\n\r", error_description(errno));
  2026.   #ifdef SAVE_GROUP_MAILBOX_ID
  2027.         setgid(groupid);
  2028.   #endif
  2029. !       leave();
  2030.       }
  2031.   #else
  2032.       /* Okay...we die and leave, not updating the mailfile mbox or
  2033.          any of those! */
  2034.   
  2035.       if (direction == INCOMING) {
  2036. !       PutLine1(LINES, 0, catgets(elm_msg_cat, ElmSet, ElmLeaveGivingUp,
  2037. !         "\n\r\n\rGiving up after %d iterations.\n\r"), 
  2038.           create_iteration);
  2039. !       PutLine0(LINES, 0, catgets(elm_msg_cat, ElmSet, ElmLeavePleaseTryAgain,
  2040. !       "\n\rPlease try to read your mail again in a few minutes.\n\r\n\r"));
  2041.         dprint(1, (debugfile, 
  2042.           "Warning: bailing out after %d iterations...(lock)\n",
  2043.           create_iteration));
  2044. --- 359,386 ----
  2045.           "Error encountered attempting to create lock %s\n", lockfile));
  2046.         dprint(1, (debugfile, "** %s **\n", error_description(errno)));
  2047.         MoveCursor(LINES, 0);
  2048. +       Raw(OFF);
  2049.         printf(catgets(elm_msg_cat, ElmSet, ElmLeaveErrorCreatingLock,
  2050. !       "\nError encountered while attempting to create lock file %s;\n"),
  2051.           lockfile);
  2052. !       printf("** %s. **\n\n", error_description(errno));
  2053.   #ifdef SAVE_GROUP_MAILBOX_ID
  2054.         setgid(groupid);
  2055.   #endif
  2056. !       leave(0);
  2057.       }
  2058.   #else
  2059.       /* Okay...we die and leave, not updating the mailfile mbox or
  2060.          any of those! */
  2061.   
  2062. +     MoveCursor(LINES, 0);
  2063. +     Raw(OFF);
  2064.       if (direction == INCOMING) {
  2065. !       printf(catgets(elm_msg_cat, ElmSet, ElmLeaveGivingUp,
  2066. !         "\n\nGiving up after %d iterations.\n"), 
  2067.           create_iteration);
  2068. !       printf(catgets(elm_msg_cat, ElmSet, ElmLeavePleaseTryAgain,
  2069. !       "\nPlease try to read your mail again in a few minutes.\n\n"));
  2070.         dprint(1, (debugfile, 
  2071.           "Warning: bailing out after %d iterations...(lock)\n",
  2072.           create_iteration));
  2073. ***************
  2074. *** 367,374 ****
  2075.   #ifdef SAVE_GROUP_MAILBOX_ID
  2076.         setgid(groupid);
  2077.   #endif
  2078. !       leave(error(catgets(elm_msg_cat, ElmSet, ElmLeaveErrorTimedOutLock,
  2079. !         "Timed out on locking mailbox.  Leaving program.")));
  2080.       }
  2081.   #endif
  2082.         }
  2083. --- 395,403 ----
  2084.   #ifdef SAVE_GROUP_MAILBOX_ID
  2085.         setgid(groupid);
  2086.   #endif
  2087. !       printf(catgets(elm_msg_cat, ElmSet, ElmLeaveErrorTimedOutLock,
  2088. !         "Timed out on locking mailbox.  Leaving program.\n"));
  2089. !       leave(0);
  2090.       }
  2091.   #endif
  2092.         }
  2093. ***************
  2094. *** 397,410 ****
  2095.           "Error encountered attempting to reopen %s for lock\n", cur_folder));
  2096.       dprint(1, (debugfile, "** %s **\n", error_description(errno)));
  2097.       MoveCursor(LINES, 0);
  2098.       printf(catgets(elm_msg_cat, ElmSet, ElmLeaveErrorReopenMailbox,
  2099. !  "\n\rError encountered while attempting to reopen mailbox %s for lock;\n\r"), 
  2100.             cur_folder);
  2101. !     printf("** %s. **\n\r\n\r", error_description(errno));
  2102.   #ifdef    USE_DOTLOCK_LOCKING
  2103.       (void)unlink(lockfile);
  2104.   #endif /* USE_DOTLOCK_LOCKING */
  2105. !     leave();
  2106.         }
  2107.   
  2108.         /* try to assert lock MAX_ATTEMPTS times */
  2109. --- 426,440 ----
  2110.           "Error encountered attempting to reopen %s for lock\n", cur_folder));
  2111.       dprint(1, (debugfile, "** %s **\n", error_description(errno)));
  2112.       MoveCursor(LINES, 0);
  2113. +     Raw(OFF);
  2114.       printf(catgets(elm_msg_cat, ElmSet, ElmLeaveErrorReopenMailbox,
  2115. !  "\nError encountered while attempting to reopen mailbox %s for lock;\n"), 
  2116.             cur_folder);
  2117. !     printf("** %s. **\n\n", error_description(errno));
  2118.   #ifdef    USE_DOTLOCK_LOCKING
  2119.       (void)unlink(lockfile);
  2120.   #endif /* USE_DOTLOCK_LOCKING */
  2121. !     leave(0);
  2122.         }
  2123.   
  2124.         /* try to assert lock MAX_ATTEMPTS times */
  2125. ***************
  2126. *** 426,439 ****
  2127.               cur_folder));
  2128.           dprint (1, (debugfile, "** %s **\n", error_description(errno)));
  2129.           MoveCursor(LINES, 0);
  2130.           printf (catgets(elm_msg_cat, ElmSet, ElmLeaveErrorFlockMailbox,
  2131. !      "\n\rError encountered while attempting to flock mailbox %s;\n\r"), 
  2132.             cur_folder);
  2133. !         printf("** %s. **\n\r\n\r", error_description(errno));
  2134.   #ifdef    USE_DOTLOCK_LOCKING
  2135.           (void)unlink(lockfile);
  2136.   #endif /* USE_DOTLOCK_LOCKING */
  2137. !         leave();
  2138.   
  2139.           break;
  2140.   
  2141. --- 456,470 ----
  2142.               cur_folder));
  2143.           dprint (1, (debugfile, "** %s **\n", error_description(errno)));
  2144.           MoveCursor(LINES, 0);
  2145. +         Raw(OFF);
  2146.           printf (catgets(elm_msg_cat, ElmSet, ElmLeaveErrorFlockMailbox,
  2147. !      "\nError encountered while attempting to flock mailbox %s;\n"), 
  2148.             cur_folder);
  2149. !         printf("** %s. **\n\n", error_description(errno));
  2150.   #ifdef    USE_DOTLOCK_LOCKING
  2151.           (void)unlink(lockfile);
  2152.   #endif /* USE_DOTLOCK_LOCKING */
  2153. !         leave(0);
  2154.   
  2155.           break;
  2156.   
  2157. ***************
  2158. *** 453,467 ****
  2159.   
  2160.         if(errno != 0) {
  2161.   
  2162.       /* We couldn't lock the file. We die and leave not updating
  2163.        * the mailfile mbox or any of those! */
  2164.   
  2165.       if (direction == INCOMING) {
  2166. !       PutLine1(LINES, 0, catgets(elm_msg_cat, ElmSet, ElmLeaveGivingUp,
  2167. !         "\n\r\n\rGiving up after %d iterations.\n\r"), 
  2168.           flock_iteration);
  2169. !       PutLine0(LINES, 0, catgets(elm_msg_cat, ElmSet, ElmLeavePleaseTryAgain,
  2170. !       "\n\rPlease try to read your mail again in a few minutes.\n\r\n\r"));
  2171.         dprint(1, (debugfile, 
  2172.           "Warning: bailing out after %d iterations...(lock)\n",
  2173.           flock_iteration));
  2174. --- 484,500 ----
  2175.   
  2176.         if(errno != 0) {
  2177.   
  2178. +     MoveCursor(LINES, 0);
  2179. +     Raw(OFF);
  2180.       /* We couldn't lock the file. We die and leave not updating
  2181.        * the mailfile mbox or any of those! */
  2182.   
  2183.       if (direction == INCOMING) {
  2184. !       printf(catgets(elm_msg_cat, ElmSet, ElmLeaveGivingUp,
  2185. !         "\n\nGiving up after %d iterations.\n"), 
  2186.           flock_iteration);
  2187. !       printf(catgets(elm_msg_cat, ElmSet, ElmLeavePleaseTryAgain,
  2188. !       "\nPlease try to read your mail again in a few minutes.\n\n"));
  2189.         dprint(1, (debugfile, 
  2190.           "Warning: bailing out after %d iterations...(lock)\n",
  2191.           flock_iteration));
  2192. ***************
  2193. *** 473,480 ****
  2194.   #ifdef    USE_DOTLOCK_LOCKING
  2195.       (void)unlink(lockfile);
  2196.   #endif
  2197. !     leave(error(catgets(elm_msg_cat, ElmSet, ElmLeaveErrorTimedOutLock,
  2198. !         "Timed out on locking mailbox.  Leaving program.")));
  2199.         }
  2200.   
  2201.         /* We locked the file */
  2202. --- 506,514 ----
  2203.   #ifdef    USE_DOTLOCK_LOCKING
  2204.       (void)unlink(lockfile);
  2205.   #endif
  2206. !     printf(catgets(elm_msg_cat, ElmSet, ElmLeaveErrorTimedOutLock,
  2207. !         "Timed out on locking mailbox.  Leaving program.\n"));
  2208. !     leave(0);
  2209.         }
  2210.   
  2211.         /* We locked the file */
  2212.  
  2213. Index: src/mailmsg2.c
  2214. Prereq: 5.7
  2215. *** ../elm2.4/src/mailmsg2.c    Wed Nov 25 14:10:39 1992
  2216. --- src/mailmsg2.c    Thu Dec 10 20:58:52 1992
  2217. ***************
  2218. *** 1,8 ****
  2219.   
  2220. ! static char rcsid[] = "@(#)$Id: mailmsg2.c,v 5.7 1992/11/22 01:14:20 syd Exp $";
  2221.   
  2222.   /*******************************************************************************
  2223. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  2224.    *
  2225.    *             Copyright (c) 1988-1992 USENET Community Trust
  2226.    *             Copyright (c) 1986,1987 Dave Taylor
  2227. --- 1,8 ----
  2228.   
  2229. ! static char rcsid[] = "@(#)$Id: mailmsg2.c,v 5.12 1992/12/11 01:58:50 syd Exp $";
  2230.   
  2231.   /*******************************************************************************
  2232. !  *  The Elm Mail System  -  $Revision: 5.12 $   $State: Exp $
  2233.    *
  2234.    *             Copyright (c) 1988-1992 USENET Community Trust
  2235.    *             Copyright (c) 1986,1987 Dave Taylor
  2236. ***************
  2237. *** 14,19 ****
  2238. --- 14,44 ----
  2239.    *
  2240.    *******************************************************************************
  2241.    * $Log: mailmsg2.c,v $
  2242. +  * Revision 5.12  1992/12/11  01:58:50  syd
  2243. +  * Allow for use from restricted shell by putting SHELL=/bin/sh in the
  2244. +  * environment of spawned mail transport program.
  2245. +  * From: chip@tct.com (Chip Salzenberg)
  2246. +  *
  2247. +  * Revision 5.11  1992/12/07  04:26:26  syd
  2248. +  * add missing err declare
  2249. +  * From: Syd
  2250. +  *
  2251. +  * Revision 5.10  1992/12/07  03:20:30  syd
  2252. +  * Change $HOME/Cancelled.mail in message to /fullpath/Cancelled.mail
  2253. +  * as AFS uses different meaning for $HOME than Elm does and it was
  2254. +  * confusing to some users.
  2255. +  * From: Syd
  2256. +  *
  2257. +  * Revision 5.9  1992/11/26  01:46:26  syd
  2258. +  * add Decode option to copy_message, convert copy_message to
  2259. +  * use bit or for options.
  2260. +  * From: Syd and bjoerns@stud.cs.uit.no (Bjoern Stabell)
  2261. +  *
  2262. +  * Revision 5.8  1992/11/26  00:46:13  syd
  2263. +  * changes to first change screen back (Raw off) and then issue final
  2264. +  * error message.
  2265. +  * From: Syd
  2266. +  *
  2267.    * Revision 5.7  1992/11/22  01:14:20  syd
  2268.    * Allow SCO MMDF to use the mmdf library for mailer via execmail.
  2269.    * From: Larry Philps <larryp@sco.com>
  2270. ***************
  2271. *** 163,168 ****
  2272. --- 188,194 ----
  2273.       int      already_has_text = FALSE;        /* we need an ADDRESS */
  2274.       int     signature_done = FALSE;
  2275.       int     need_redraw = 0;
  2276. +     int     err;
  2277.   
  2278.       static int cancelled_msg = 0;
  2279.   
  2280. ***************
  2281. *** 185,197 ****
  2282.   
  2283.       if (! retransmit)
  2284.         if ((reply = fopen(filename,"w")) == NULL) {
  2285.           dprint(1, (debugfile, 
  2286.                  "Attempt to write to temp file %s failed with error %s (mail)\n",
  2287. !          filename, error_description(errno)));
  2288.           if(batch_only) {
  2289.             MCprintf(catgets(elm_msg_cat, ElmSet, ElmCouldNotCreateFile,
  2290.           "Could not create file %s (%s)."),
  2291. !         filename, error_description(errno));
  2292.             printf("\n");
  2293.           } else
  2294.             error2(catgets(elm_msg_cat, ElmSet, ElmCouldNotCreateFile,
  2295. --- 211,224 ----
  2296.   
  2297.       if (! retransmit)
  2298.         if ((reply = fopen(filename,"w")) == NULL) {
  2299. +         err = errno;
  2300.           dprint(1, (debugfile, 
  2301.                  "Attempt to write to temp file %s failed with error %s (mail)\n",
  2302. !          filename, error_description(err)));
  2303.           if(batch_only) {
  2304.             MCprintf(catgets(elm_msg_cat, ElmSet, ElmCouldNotCreateFile,
  2305.           "Could not create file %s (%s)."),
  2306. !         filename, error_description(err));
  2307.             printf("\n");
  2308.           } else
  2309.             error2(catgets(elm_msg_cat, ElmSet, ElmCouldNotCreateFile,
  2310. ***************
  2311. *** 267,277 ****
  2312.           fputs("Forwarded message:\n", reply);
  2313.         }
  2314.         if (edit_message) {
  2315. !         copy_message(prefixchars, reply, noheader,FALSE,FALSE,TRUE,FALSE);
  2316.           already_has_text = TRUE;    /* we just added it, right? */
  2317.         }
  2318.         else
  2319. !         copy_message("", reply, noheader, FALSE, FALSE, TRUE, FALSE);
  2320.       }
  2321.   
  2322.           /* append signature now if we are going to use an external editor */
  2323. --- 294,306 ----
  2324.           fputs("Forwarded message:\n", reply);
  2325.         }
  2326.         if (edit_message) {
  2327. !         copy_message(prefixchars, reply,
  2328. !         ( noheader ? CM_REMOVE_HEADER : 0 ) | CM_MMDF_HEAD | CM_DECODE);
  2329.           already_has_text = TRUE;    /* we just added it, right? */
  2330.         }
  2331.         else
  2332. !         copy_message(prefixchars, reply,
  2333. !         ( noheader ? CM_REMOVE_HEADER : 0 ) | CM_MMDF_HEAD);
  2334.       }
  2335.   
  2336.           /* append signature now if we are going to use an external editor */
  2337. ***************
  2338. *** 359,378 ****
  2339.           }
  2340.   
  2341.         if ((reply = fopen(filename,"r")) == NULL) {
  2342.             dprint(1, (debugfile,
  2343.           "Attempt to open file %s for reading failed with error %s (mail)\n",
  2344. !                 filename, error_description(errno)));
  2345.             error1(catgets(elm_msg_cat, ElmSet, ElmCouldNotOpenReply,
  2346. !         "Could not open reply file (%s)."), error_description(errno));
  2347.             return(need_redraw);
  2348.         }
  2349.       }
  2350.       else if ((reply = fopen(filename,"r")) == NULL) {
  2351.         dprint(1, (debugfile, 
  2352.           "Attempt to open file %s for reading failed with error %s (mail)\n",
  2353. !              filename, error_description(errno)));
  2354.         printf(catgets(elm_msg_cat, ElmSet, ElmCouldNotOpenReply,
  2355. !         "Could not open reply file (%s)."), error_description(errno));
  2356.         printf("\n");
  2357.         return(need_redraw);
  2358.       }
  2359. --- 388,409 ----
  2360.           }
  2361.   
  2362.         if ((reply = fopen(filename,"r")) == NULL) {
  2363. +           err = errno;
  2364.             dprint(1, (debugfile,
  2365.           "Attempt to open file %s for reading failed with error %s (mail)\n",
  2366. !                 filename, error_description(err)));
  2367.             error1(catgets(elm_msg_cat, ElmSet, ElmCouldNotOpenReply,
  2368. !         "Could not open reply file (%s)."), error_description(err));
  2369.             return(need_redraw);
  2370.         }
  2371.       }
  2372.       else if ((reply = fopen(filename,"r")) == NULL) {
  2373. +       err = errno;
  2374.         dprint(1, (debugfile, 
  2375.           "Attempt to open file %s for reading failed with error %s (mail)\n",
  2376. !              filename, error_description(err)));
  2377.         printf(catgets(elm_msg_cat, ElmSet, ElmCouldNotOpenReply,
  2378. !         "Could not open reply file (%s)."), error_description(err));
  2379.         printf("\n");
  2380.         return(need_redraw);
  2381.       }
  2382. ***************
  2383. *** 536,542 ****
  2384.   
  2385.       /* Take note of mailer return value */
  2386.   
  2387. !     if ( sys_status = system_call(very_long_buffer, 0) ) {
  2388.           /* problem case: */
  2389.           if (mail_only || batch_only) {
  2390.              printf("\r\n");
  2391. --- 567,573 ----
  2392.   
  2393.       /* Take note of mailer return value */
  2394.   
  2395. !     if ( sys_status = system_call(very_long_buffer, SY_ENV_SHELL) ) {
  2396.           /* problem case: */
  2397.           if (mail_only || batch_only) {
  2398.              printf("\r\n");
  2399. ***************
  2400. *** 727,734 ****
  2401.                  fclose(deadfd);
  2402.                  restore_file_stats(fname);
  2403.   
  2404. !                error1(catgets(elm_msg_cat, ElmSet, ElmMessageSavedIn,
  2405. !                 "Message saved in file \"$HOME/%s\"."), dead_letter);
  2406.   
  2407.               }
  2408.                  } else if (user_level != 0)
  2409. --- 758,765 ----
  2410.                  fclose(deadfd);
  2411.                  restore_file_stats(fname);
  2412.   
  2413. !                error2(catgets(elm_msg_cat, ElmSet, ElmMessageSavedIn,
  2414. !                 "Message saved in file \"%s/%s\"."), home, dead_letter);
  2415.   
  2416.               }
  2417.                  } else if (user_level != 0)
  2418. ***************
  2419. *** 821,826 ****
  2420. --- 852,858 ----
  2421.       char *ctime();
  2422.       static FILE *filedesc;        /* our friendly file descriptor  */
  2423.           char to_buf[VERY_LONG_STRING];
  2424. +     int err;
  2425.   
  2426.   #ifdef SITE_HIDING
  2427.       char  buffer[SLEN];
  2428. ***************
  2429. *** 844,856 ****
  2430.         filedesc = fopen(filename, "w+");
  2431.   
  2432.       if (filedesc == NULL) {
  2433.         dprint(1, (debugfile,
  2434.           "Attempt to open file %s for writing failed! (write_header_info)\n",
  2435.            filename));
  2436. !       dprint(1, (debugfile, "** %s **\n\n", error_description(errno)));
  2437.         error2(catgets(elm_msg_cat, ElmSet, ElmErrorTryingToWrite,
  2438.           "Error %s encountered trying to write to %s."), 
  2439. !         error_description(errno), filename);
  2440.         sleep(2);
  2441.         return(NULL);        /* couldn't open it!! */
  2442.       }
  2443. --- 876,889 ----
  2444.         filedesc = fopen(filename, "w+");
  2445.   
  2446.       if (filedesc == NULL) {
  2447. +       err = errno;
  2448.         dprint(1, (debugfile,
  2449.           "Attempt to open file %s for writing failed! (write_header_info)\n",
  2450.            filename));
  2451. !       dprint(1, (debugfile, "** %s **\n\n", error_description(err)));
  2452.         error2(catgets(elm_msg_cat, ElmSet, ElmErrorTryingToWrite,
  2453.           "Error %s encountered trying to write to %s."), 
  2454. !         error_description(err), filename);
  2455.         sleep(2);
  2456.         return(NULL);        /* couldn't open it!! */
  2457.       }
  2458. ***************
  2459. *** 1080,1087 ****
  2460.         else if (crypted) {
  2461.           if (batch_only) {
  2462.             printf(catgets(elm_msg_cat, ElmSet, ElmNoEncryptInBatch,
  2463. !         "Sorry. Cannot send encrypted mail in \"batch mode\".\n\r"));
  2464. !           leave();
  2465.           } else if (! gotten_key++)
  2466.             getkey(ON);
  2467.           else if (! encoded_lines)
  2468. --- 1113,1120 ----
  2469.         else if (crypted) {
  2470.           if (batch_only) {
  2471.             printf(catgets(elm_msg_cat, ElmSet, ElmNoEncryptInBatch,
  2472. !         "Sorry. Cannot send encrypted mail in \"batch mode\".\n"));
  2473. !           leave(0);
  2474.           } else if (! gotten_key++)
  2475.             getkey(ON);
  2476.           else if (! encoded_lines)
  2477. ***************
  2478. *** 1117,1124 ****
  2479.           /* Add in the > to a From on our copy */
  2480.           fprintf(dest, ">");
  2481.           if (fwrite(buffer, 1, line_len, dest) != line_len) {
  2482.           Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmWriteFailedCopyAcross,
  2483. !             "\n\rWrite failed in copy_message_across\n\r"), 0);
  2484.           emergency_exit();
  2485.           }
  2486.         }
  2487. --- 1150,1159 ----
  2488.           /* Add in the > to a From on our copy */
  2489.           fprintf(dest, ">");
  2490.           if (fwrite(buffer, 1, line_len, dest) != line_len) {
  2491. +         MoveCursor(LINES, 0);
  2492. +         Raw(OFF);
  2493.           Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmWriteFailedCopyAcross,
  2494. !             "\nWrite failed in copy_message_across\n"), 0);
  2495.           emergency_exit();
  2496.           }
  2497.         }
  2498. ***************
  2499. *** 1132,1139 ****
  2500.           else
  2501.   #endif /* DONT_ESCAPE_MESSAGES */
  2502.             if (fwrite(buffer, 1, line_len, dest) != line_len) {
  2503.           Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmWriteFailedCopyAcross,
  2504. !             "\n\rWrite failed in copy_message_across\n\r"), 0);
  2505.           emergency_exit();
  2506.           }
  2507.       } 
  2508. --- 1167,1176 ----
  2509.           else
  2510.   #endif /* DONT_ESCAPE_MESSAGES */
  2511.             if (fwrite(buffer, 1, line_len, dest) != line_len) {
  2512. +         MoveCursor(LINES, 0);
  2513. +         Raw(OFF);
  2514.           Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmWriteFailedCopyAcross,
  2515. !             "\nWrite failed in copy_message_across\n"), 0);
  2516.           emergency_exit();
  2517.           }
  2518.       } 
  2519.  
  2520. Index: lib/getarpdate.c
  2521. Prereq: 5.4
  2522. *** ../elm2.4/lib/getarpdate.c    Tue Nov 17 14:10:56 1992
  2523. --- lib/getarpdate.c    Fri Dec 11 20:29:27 1992
  2524. ***************
  2525. *** 1,7 ****
  2526. ! static char rcsid[] = "@(#)$Id: getarpdate.c,v 5.4 1992/11/15 02:18:15 syd Exp $";
  2527.   
  2528.   /*******************************************************************************
  2529. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  2530.    *
  2531.    *            Copyright (c) 1988-1992 USENET Community Trust
  2532.    *            Copyright (c) 1986,1987 Dave Taylor
  2533. --- 1,7 ----
  2534. ! static char rcsid[] = "@(#)$Id: getarpdate.c,v 5.5 1992/12/12 01:29:26 syd Exp $";
  2535.   
  2536.   /*******************************************************************************
  2537. !  *  The Elm Mail System  -  $Revision: 5.5 $   $State: Exp $
  2538.    *
  2539.    *            Copyright (c) 1988-1992 USENET Community Trust
  2540.    *            Copyright (c) 1986,1987 Dave Taylor
  2541. ***************
  2542. *** 13,18 ****
  2543. --- 13,22 ----
  2544.    *
  2545.    *******************************************************************************
  2546.    * $Log: getarpdate.c,v $
  2547. +  * Revision 5.5  1992/12/12  01:29:26  syd
  2548. +  * Fix double inclusion of sys/types.h
  2549. +  * From: Tom Moore <tmoore@wnas.DaytonOH.NCR.COM>
  2550. +  *
  2551.    * Revision 5.4  1992/11/15  02:18:15  syd
  2552.    * Change most of the rest of the BSDs to TZNAME
  2553.    * From: Syd
  2554. ***************
  2555. *** 37,43 ****
  2556.   **/
  2557.   
  2558.   #include "headers.h"
  2559. - #include <sys/types.h>
  2560.   
  2561.   #ifdef I_TIME
  2562.   #  include <time.h>
  2563. --- 41,46 ----
  2564.  
  2565. Index: lib/opt_utils.c
  2566. Prereq: 5.3
  2567. *** ../elm2.4/lib/opt_utils.c    Mon Nov  2 15:51:42 1992
  2568. --- lib/opt_utils.c    Fri Dec 11 20:29:29 1992
  2569. ***************
  2570. *** 1,8 ****
  2571.   
  2572. ! static char rcsid[] = "@(#)$Id: opt_utils.c,v 5.3 1992/10/30 21:49:38 syd Exp $";
  2573.   
  2574.   /*******************************************************************************
  2575. !  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
  2576.    *
  2577.    *            Copyright (c) 1988-1992 USENET Community Trust
  2578.    *            Copyright (c) 1986,1987 Dave Taylor
  2579. --- 1,8 ----
  2580.   
  2581. ! static char rcsid[] = "@(#)$Id: opt_utils.c,v 5.4 1992/12/12 01:29:26 syd Exp $";
  2582.   
  2583.   /*******************************************************************************
  2584. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  2585.    *
  2586.    *            Copyright (c) 1988-1992 USENET Community Trust
  2587.    *            Copyright (c) 1986,1987 Dave Taylor
  2588. ***************
  2589. *** 14,19 ****
  2590. --- 14,23 ----
  2591.    *
  2592.    *******************************************************************************
  2593.    * $Log: opt_utils.c,v $
  2594. +  * Revision 5.4  1992/12/12  01:29:26  syd
  2595. +  * Fix double inclusion of sys/types.h
  2596. +  * From: Tom Moore <tmoore@wnas.DaytonOH.NCR.COM>
  2597. +  *
  2598.    * Revision 5.3  1992/10/30  21:49:38  syd
  2599.    * Add init of buf
  2600.    * From: Syd via request from hessmann@unipas.fmi.uni-passau.de (Georg Hessmann)
  2601. ***************
  2602. *** 51,57 ****
  2603.   
  2604.   #ifndef GETHOSTNAME
  2605.   # ifdef DOUNAME
  2606. - #  include <sys/types.h>
  2607.   #  include <sys/utsname.h>
  2608.   # endif
  2609.   #endif
  2610. --- 55,60 ----
  2611.  
  2612. -- 
  2613. ========================================================================
  2614. Sydney S. Weinstein, CDP, CCP          Elm Coordinator - Current 2.4PL17
  2615. Datacomp Systems, Inc.                 Projected 3.0 Release: ??? ?,1994
  2616. syd@DSI.COM or dsinc!syd      Voice: (215) 947-9900, FAX: (215) 938-0235
  2617.