home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / com / utils / elm / sources / patches.os2 < prev    next >
Text File  |  1992-10-04  |  162KB  |  5,903 lines

  1. Only in new: README.OS2
  2. Only in new: FILES.BIN
  3. Only in new: FILES.SRC
  4. Only in new: patches.os2
  5. Only in new: config.h
  6. Only in new: crypt
  7. Only in new: os2
  8. diff -cbr orig/filter/actions.c new/filter/actions.c
  9. *** orig/filter/actions.c    Sun Oct 04 14:36:27 1992
  10. --- new/filter/actions.c    Sun Mar 29 10:09:13 1992
  11. ***************
  12. *** 68,74 ****
  13.              username, address);
  14.   
  15.       if (! show_only) {
  16. !       sprintf(tempfile, "%s.%d", filter_temp, getpid());
  17.   
  18.         if ((tempfd = fopen(tempfile, "r")) == NULL) {
  19.           if (outfd != NULL)
  20. --- 68,74 ----
  21.              username, address);
  22.   
  23.       if (! show_only) {
  24. !       sprintf(tempfile, "%s%d.fil", tempdir, getpid());
  25.   
  26.         if ((tempfd = fopen(tempfile, "r")) == NULL) {
  27.           if (outfd != NULL)
  28. ***************
  29. *** 84,91 ****
  30.             if (contains(from, username)) {
  31.           if (outfd != NULL)
  32.                 fprintf(outfd,
  33. !     "filter (%s): Filter loop detected!  Message left in file %s.%d\n", 
  34. !             username, filter_temp, getpid());
  35.               if (outfd != NULL) fclose(outfd);
  36.               exit(0);
  37.             }
  38. --- 84,91 ----
  39.             if (contains(from, username)) {
  40.           if (outfd != NULL)
  41.                 fprintf(outfd,
  42. !     "filter (%s): Filter loop detected!  Message left in file %s\n",
  43. !             username, tempfile);
  44.               if (outfd != NULL) fclose(outfd);
  45.               exit(0);
  46.             }
  47. ***************
  48. *** 94,112 ****
  49.           if (strcmp(sendmail, mailer) == 0)
  50.             sprintf(buffer, "%s %s %s", sendmail, smflags, address);
  51.           else
  52. !           sprintf(buffer, "%s %s", mailer, address);
  53.   
  54.           if ((pipefd = popen(buffer, "w")) == NULL) {
  55.             if (outfd != NULL)
  56.               fprintf(outfd, "filter (%s): popen %s failed!\n", username, buffer);
  57. !           sprintf(buffer, "((%s %s %s ; %s %s) & ) < %s &",
  58. !               sendmail , smflags, address, remove_cmd, tempfile, tempfile);
  59.             system(buffer);
  60.             return;
  61.           }
  62.   
  63.           fprintf(pipefd, "Subject: \"%s\"\n", subject);
  64. !         fprintf(pipefd, "From: The Filter of %s@%s <%s>\n", 
  65.               username, hostname, username);
  66.           fprintf(pipefd, "To: %s\n", address);
  67.           fprintf(pipefd, "X-Filtered-By: filter, version %s\n\n", VERSION);
  68. --- 94,112 ----
  69.           if (strcmp(sendmail, mailer) == 0)
  70.             sprintf(buffer, "%s %s %s", sendmail, smflags, address);
  71.           else
  72. !           sprintf(buffer, "%s -t", mailer);
  73.   
  74.           if ((pipefd = popen(buffer, "w")) == NULL) {
  75.             if (outfd != NULL)
  76.               fprintf(outfd, "filter (%s): popen %s failed!\n", username, buffer);
  77. !           sprintf(buffer, "%s -t <%s", mailer, tempfile);
  78.             system(buffer);
  79. +               unlink(tempfile);
  80.             return;
  81.           }
  82.   
  83.           fprintf(pipefd, "Subject: \"%s\"\n", subject);
  84. !         fprintf(pipefd, "From: %s@%s (The Filter of %s)\n",
  85.               username, hostname, username);
  86.           fprintf(pipefd, "To: %s\n", address);
  87.           fprintf(pipefd, "X-Filtered-By: filter, version %s\n\n", VERSION);
  88. ***************
  89. *** 120,126 ****
  90.               fprintf(pipefd," %s", buffer);
  91.   
  92.           fprintf(pipefd, "\n-- End of filtered message --\n");
  93. !         fclose(pipefd);
  94.           fclose(tempfd);
  95.   
  96.           return;        /* YEAH!  Wot a slick program, eh? */
  97. --- 120,126 ----
  98.               fprintf(pipefd," %s", buffer);
  99.   
  100.           fprintf(pipefd, "\n-- End of filtered message --\n");
  101. !         pclose(pipefd);
  102.           fclose(tempfd);
  103.   
  104.           return;        /* YEAH!  Wot a slick program, eh? */
  105. ***************
  106. *** 146,151 ****
  107. --- 146,155 ----
  108.         else if ((mailfd = emergency_local_delivery()) == NULL)
  109.           exit(1);
  110.   
  111. + #ifdef MMDF
  112. +       fputs(MSG_SEPERATOR, mailfd);
  113. + #endif
  114.         while (fgets(buffer, sizeof(buffer), tempfd) != NULL) {
  115.           line_count++;
  116.           if (the_same(buffer, "From ") && line_count > 1)
  117. ***************
  118. *** 154,160 ****
  119.             fputs(buffer, mailfd);
  120.         }
  121.   
  122. !       fputs("\n", mailfd);
  123.   
  124.         fclose(mailfd);
  125.         unlock();        /* blamo or not?  Let it decide! */
  126. --- 158,164 ----
  127.             fputs(buffer, mailfd);
  128.         }
  129.   
  130. !       fputs("\n\n", mailfd);
  131.   
  132.         fclose(mailfd);
  133.         unlock();        /* blamo or not?  Let it decide! */
  134. ***************
  135. *** 177,183 ****
  136.             username, foldername);
  137.   
  138.       if (!show_only) {
  139. !       sprintf(filename, "%s.%d", filter_temp, getpid());
  140.   
  141.         if ((fdunit = open(foldername, O_APPEND | O_WRONLY | O_CREAT, 0600)) < 0) {
  142.           if (outfd != NULL)
  143. --- 181,187 ----
  144.             username, foldername);
  145.   
  146.       if (!show_only) {
  147. !       sprintf(filename, "%s%d.fil", tempdir, getpid());
  148.   
  149.         if ((fdunit = open(foldername, O_APPEND | O_WRONLY | O_CREAT, 0600)) < 0) {
  150.           if (outfd != NULL)
  151. ***************
  152. *** 196,201 ****
  153. --- 200,209 ----
  154.            return(1);
  155.         }
  156.   
  157. + #ifdef MMDF
  158. +       fputs(MSG_SEPERATOR, fd);
  159. + #endif
  160.         while (fgets(buffer, sizeof(buffer), tempfd) != NULL)
  161.           fputs(buffer, fd);
  162.   
  163. ***************
  164. *** 226,232 ****
  165.         fprintf(outfd, "filter (%s): Executing %s\n", username, command);
  166.   
  167.       if (! show_only) {
  168. !       sprintf(buffer, "%s %s.%d | %s", cat, filter_temp, getpid(), command);
  169.         system(buffer);
  170.       }
  171.   }
  172. --- 234,240 ----
  173.         fprintf(outfd, "filter (%s): Executing %s\n", username, command);
  174.   
  175.       if (! show_only) {
  176. !       sprintf(buffer, "%s <%s%d", command, tempdir, getpid());
  177.         system(buffer);
  178.       }
  179.   }
  180. diff -cbr orig/filter/filter.c new/filter/filter.c
  181. *** orig/filter/filter.c    Sun Oct 04 14:36:27 1992
  182. --- new/filter/filter.c    Sun Mar 29 00:03:23 1992
  183. ***************
  184. *** 59,64 ****
  185. --- 59,66 ----
  186.   #define  MAIN_ROUTINE            /* for the filter.h file, of course! */
  187.   #include "filter.h"
  188.   
  189. + #undef fflush
  190.   main(argc, argv)
  191.   int argc;
  192.   char *argv[];
  193. ***************
  194. *** 76,81 ****
  195. --- 78,85 ----
  196.            summary   = FALSE,            /* a summary is requested?  */
  197.            c;                    /* var for getopt routine   */
  198.   
  199. +         initpaths();
  200.       /* first off, let's get the info from /etc/passwd */
  201.   
  202.       if ((passwd_entry = getpwuid(getuid())) == NULL)
  203. ***************
  204. *** 89,94 ****
  205. --- 93,100 ----
  206.       strncpy(hostname, HOSTNAME, sizeof(hostname));
  207.   #else
  208.       gethostname(hostname, sizeof(hostname));
  209. +     gethostdomain(buffer, sizeof(buffer));
  210. +         strcat(hostname, buffer);
  211.   #endif
  212.   
  213.       /* now parse the starting arguments... */
  214. ***************
  215. *** 105,118 ****
  216.   
  217.           case 'n' : show_only = TRUE;            break;
  218.           case 'v' : verbose = TRUE;                break;
  219. !         case '?' : fprintf(stderr, 
  220. !                "Usage: | filter [-nrv]\n   or: filter [-c] -[s|S]\n");
  221. !                      exit(1);
  222.         }
  223.       }
  224.   
  225. !     if (c < 0) {
  226. !     }
  227.   
  228.       /* let's open our outfd logfile as needed... */
  229.   
  230. --- 111,122 ----
  231.   
  232.           case 'n' : show_only = TRUE;            break;
  233.           case 'v' : verbose = TRUE;                break;
  234. !         case '?' : usage(argv[0]);
  235.         }
  236.       }
  237.   
  238. !     if (isatty(0) && !summary && !long_summary && !printing_rules)
  239. !           usage(argv[0]);
  240.   
  241.       /* let's open our outfd logfile as needed... */
  242.   
  243. ***************
  244. *** 146,152 ****
  245.   
  246.       /* next, create the tempfile and save the incoming message */
  247.   
  248. !     sprintf(filename, "%s.%d", filter_temp, getpid());
  249.   
  250.       if ((fd = fopen(filename,"w")) == NULL)
  251.         leave("Cannot open temporary file!");
  252. --- 150,156 ----
  253.   
  254.       /* next, create the tempfile and save the incoming message */
  255.   
  256. !     sprintf(filename, "%s%d.fil", tempdir, getpid());
  257.   
  258.       if ((fd = fopen(filename,"w")) == NULL)
  259.         leave("Cannot open temporary file!");
  260. ***************
  261. *** 229,234 ****
  262. --- 233,254 ----
  263.       (void) unlink(filename);    /* remove the temp file, please! */
  264.       if (outfd != NULL) fclose(outfd);
  265.       exit(0);
  266. + }
  267. + usage(name)
  268. + char *name;
  269. + {
  270. +   printf("\nUsage: filter [-nrv] [-o output]"
  271. +          "\n   or: filter [-s|-S] [-c] [-o output]\n"
  272. +          "\nWhere: -n   not really, only output what would happen"
  273. +          "\n       -v   be verbose for each message filtered"
  274. +          "\n       -r   list rules currently beeing used"
  275. +          "\n       -s   list summary of message filtered log"
  276. +          "\n       -S   list more verbose summary that -s"
  277. +          "\n       -c   clear log files after summarizing with -s or -S"
  278. +          "\n       -o output    redirect log message to 'output'\n");
  279. +   exit(1);
  280.   }
  281.   
  282.   save_from(buffer)
  283. diff -cbr orig/filter/lock.c new/filter/lock.c
  284. *** orig/filter/lock.c    Sun Oct 04 14:36:27 1992
  285. --- new/filter/lock.c    Sun Mar 22 15:09:08 1992
  286. ***************
  287. *** 59,66 ****
  288.   static    char flock_name[SLEN];
  289.   #endif
  290.   
  291. - extern  int  errno;
  292.   char *
  293.   mk_lockname(home, user)
  294.   char *home, *user;
  295. --- 59,64 ----
  296. ***************
  297. *** 74,80 ****
  298.       sprintf(lockfile, "/tmp/%.10s.mlk", user);
  299.   #else
  300.       /* lock is [file_to_lock].lock */
  301. !     sprintf(lockfile, "%s%s.lock", home, user);
  302.   #endif
  303.       return(lockfile);
  304.   }
  305. --- 72,78 ----
  306.       sprintf(lockfile, "/tmp/%.10s.mlk", user);
  307.   #else
  308.       /* lock is [file_to_lock].lock */
  309. !     sprintf(lockfile, "%s%s.lck", home, user);
  310.   #endif
  311.       return(lockfile);
  312.   }
  313. ***************
  314. *** 112,118 ****
  315.           }
  316.   #endif
  317.   
  318. !     while ((ret = open(lockfile, O_WRONLY | O_CREAT | O_EXCL, 0444)) < 0 
  319.              && attempts++ < 10) {
  320.         sleep(3);    /* wait three seconds each pass, okay?? */
  321.       }
  322. --- 110,116 ----
  323.           }
  324.   #endif
  325.   
  326. !     while ((ret = open(lockfile, O_WRONLY | O_CREAT | O_EXCL, 0666)) < 0
  327.              && attempts++ < 10) {
  328.         sleep(3);    /* wait three seconds each pass, okay?? */
  329.       }
  330. ***************
  331. *** 128,134 ****
  332.   #endif                    /* } !LOCK_FLOCK_ONLY    */
  333.   #ifdef    LOCK_BY_FLOCK            /* { LOCK_BY_FLOCK    */
  334.       (void)sprintf(flock_name,"%s%s",mailhome,username);
  335. !     flock_fd = open(flock_name, O_RDONLY | O_CREAT, 0600);
  336.       if ( flock_fd >= 0 )
  337.         for (attempts = 0; attempts < 10; attempts++) {
  338.           if ( (ret = flock(flock_fd,LOCK_NB|LOCK_EX)) != -1 )
  339. --- 126,132 ----
  340.   #endif                    /* } !LOCK_FLOCK_ONLY    */
  341.   #ifdef    LOCK_BY_FLOCK            /* { LOCK_BY_FLOCK    */
  342.       (void)sprintf(flock_name,"%s%s",mailhome,username);
  343. !     flock_fd = open(flock_name, O_RDONLY | O_CREAT, 0666);
  344.       if ( flock_fd >= 0 )
  345.         for (attempts = 0; attempts < 10; attempts++) {
  346.           if ( (ret = flock(flock_fd,LOCK_NB|LOCK_EX)) != -1 )
  347. diff -cbr orig/filter/Makefile new/filter/Makefile
  348. *** orig/filter/Makefile    Sat Feb 01 15:15:14 1992
  349. --- new/filter/Makefile    Sun Oct 04 14:04:24 1992
  350. ***************
  351. *** 1,143 ****
  352.   #
  353. ! # @(#): Makefile.SH,v 4.1 90/04/28 22:41:51 syd Exp $
  354. ! #  Makefile for the Elm system filter program
  355.   #
  356. ! #    Copyright (c) 1986, 1987 Dave Taylor
  357. ! #    Copyright (c) 1988, 1989, 1990 USENET Community Trust
  358. ! #
  359. ! # Bug reports, patches, comments, suggestions should be sent to:
  360. ! #
  361. ! #    Syd Weinstein - elm@DSI.COM
  362. ! #            dsinc!elm
  363. ! #
  364. ! #  $Log:    Makefile.SH,v $
  365. ! # Revision 4.1  90/04/28  22:41:51  syd
  366. ! # checkin of Elm 2.3 as of Release PL0
  367. ! # 
  368. ! #
  369.   # Variables
  370. ! #    Variables established by Configure
  371. ! CC        =    cc
  372. ! CCFLAGS        =     
  373. ! CHGRP        =    chgrp
  374. ! CHMOD        =    chmod
  375. ! CP        =    cp
  376. ! DEST        =    /bin
  377. ! ECHO        =    echo
  378. ! LFLAGS        =     
  379. ! LIB        =    /usr/local/lib
  380. ! LIB2        =     
  381. ! LIBS        =    -lcurses 
  382. ! LINT        =    /usr/bin/lint
  383. ! MAILGRP        =    bin
  384. ! MAILERMODE    =    755
  385. ! MAKE        =    make
  386. ! MV        =    mv
  387. ! OPTIMIZE    =    -O
  388.   RM        =     rm -f
  389.   TOUCH        =    touch
  390.   
  391. ! #    Variables you may want to manually edit
  392. ! #        If you want debug logging then you'll
  393. ! #        want to uncomment the following.
  394. ! #DEBUG        =    -DDEBUG
  395.   
  396. ! #    Other variables
  397. ! BIN        =    ../bin
  398. ! INCLDIR        =    ../hdrs
  399. ! CFLAGS        =    $(CCFLAGS) $(OPTIMIZE) -I$(INCLDIR) $(DEBUG) $(DACSNET) 
  400. ! LINTFLAGS    =    -I$(INCLDIR)
  401. ! SHELL        =    /bin/sh
  402. ! # Definitions of variables
  403. ! FILTER_SRC    =    actions.c    \
  404. !             buffer.c    \
  405. !             filter.c    \
  406. !             lock.c        \
  407. !             parse.c        \
  408. !             rules.c        \
  409. !             summarize.c    \
  410. !             utils.c        \
  411. !             ../src/opt_utils.c
  412. ! FILTER_OBJ    =    actions.obj    \
  413. !             buffer.obj    \
  414. !             filter.obj    \
  415. !             lock.obj        \
  416. !             parse.obj        \
  417. !             rules.obj        \
  418. !             summarize.obj    \
  419. !             utils.obj        \
  420. !             ../src/opt_utils.obj
  421.   
  422.   # Standard targets
  423. - all:        $(BIN)/filter
  424.           
  425. ! install:    $(DEST)/filter
  426.   
  427. ! uninstall:    
  428. !         $(RM) $(DEST)/filter
  429.   
  430. ! #    This is the only target that gets installed even if not out-of-date
  431. ! #    with respect the files from which it is installed.
  432. ! rmt-install:    rmt-defined
  433. !         -$(MV) $(DEST)/filter $(DEST)/filter.old
  434. !         -$(RM) $(DEST)/filter.old
  435. !         $(CP) $(REMOTE)$(DEST)/filter $(DEST)/filter
  436. !         $(CHGRP) $(MAILGRP) $(DEST)/filter
  437. !         $(CHMOD) $(MAILERMODE) $(DEST)/filter
  438. ! rmt-defined:
  439. !     @(if [ "$(REMOTE)" = "" ];\
  440. !       then\
  441. !         $(ECHO) "You need to define 'REMOTE' as the remote file system";\
  442. !         $(ECHO) "for this particular command. The easiest way to do this";\
  443. !         $(ECHO) "to type:";\
  444. !         $(ECHO) "        make REMOTE=<remote file system> rmt-install";\
  445. !         exit 1;\
  446. !       fi);
  447.   
  448. ! lint:        
  449. !         $(LINT) $(LINTFLAGS) $(FILTER_SRC) > LINT.OUT
  450.   
  451. ! clean:        
  452. !         $(RM) $(FILTER_OBJ) $(BIN)/filter
  453.   
  454. ! # Dependencies and rules
  455.   #    Dependencies of header files upon other header files they include
  456.   .PRECIOUS:        $(INCLDIR)/defs.h $(INCLDIR)/elm.h $(INCLDIR)/headers.h
  457.   
  458. ! $(INCLDIR)/defs.h:    $(INCLDIR)/../config.h $(INCLDIR)/sysdefs.h
  459. !             $(CHMOD) u+w $@
  460.               $(TOUCH) $@
  461.   
  462.   $(INCLDIR)/elm.h:    $(INCLDIR)/curses.h $(INCLDIR)/defs.h
  463. -             $(CHMOD) u+w $@
  464.               $(TOUCH) $@
  465.   
  466.   $(INCLDIR)/headers.h:    $(INCLDIR)/curses.h $(INCLDIR)/defs.h
  467. -             $(CHMOD) u+w $@
  468.               $(TOUCH) $@
  469.   
  470.   #    Dependencies and rules for C object files
  471. - actions.obj:        $(INCLDIR)/defs.h $(INCLDIR)/filter.h
  472. - filter.obj:        $(INCLDIR)/defs.h $(INCLDIR)/filter.h
  473. - lock.obj:            $(INCLDIR)/defs.h $(INCLDIR)/filter.h
  474. - parse.obj:        $(INCLDIR)/defs.h $(INCLDIR)/filter.h
  475. - rules.obj:        $(INCLDIR)/defs.h $(INCLDIR)/filter.h
  476. - summarize.obj:        $(INCLDIR)/defs.h $(INCLDIR)/filter.h
  477. - utils.obj:        $(INCLDIR)/defs.h $(INCLDIR)/filter.h
  478. - ../src/opt_utils.obj:
  479. -             rem cd ../src; $(MAKE) -$(MAKEFLAGS) $(@F)
  480. - #    Dependencies and rules for compiling programs
  481. - $(BIN)/filter:    $(FILTER_OBJ)
  482. -         $(CC) $(LFLAGS) -o $@ $(FILTER_OBJ) $(LIB2)
  483.   
  484. ! #    Dependencies and rules for installing programs from bin directory
  485. ! $(DEST)/filter:        $(BIN)/filter
  486. !             -$(MV) $(DEST)/filter $(DEST)/filter.old
  487. !             -$(RM) $(DEST)/filter.old
  488. !             $(CP) $? $@
  489. !             $(CHGRP) $(MAILGRP) $@
  490. !             $(CHMOD) $(MAILERMODE) $@
  491. --- 1,77 ----
  492.   #
  493. ! #  Makefile for the Elm system filter program for OS/2
  494.   #
  495. ! default:
  496. !     @echo "Make target msc, gcc or ibm."
  497. ! msc:
  498. !     $(MAKE) all CC="cl -nologo -AL -Gs -Ocegt" O=".obj" \
  499. !     CFLAGS="-W1 -Zep1 -Gt16 -D__STDC__ -G2 -J" \
  500. !     LFLAGS="-Lp -F 8000" LIBS="..\os2\elm.def -link /noe /packc /packd"
  501. ! gcc:
  502. !     $(MAKE) all CC="gcc -O -Zomf -Zmt" O=".obj" \
  503. !     CFLAGS="" LFLAGS="" LIBS="../os2/elm.def -los2"
  504.   # Variables
  505. ! INCLDIR        = ../hdrs
  506. ! OS2DIR        = ../os2
  507. ! DEFINES        = -DOS2 -I$(INCLDIR) -I$(OS2DIR)
  508.   RM        = rm -f
  509.   TOUCH        = touch
  510.   
  511. ! # Lists
  512.   
  513. ! OS2_OBJ        = getopt$O os2util$O
  514. ! FILTER_OBJ    = actions$O buffer$O filter$O lock$O parse$O \
  515. !           rules$O summarize$O utils$O opt_utils$O $(OS2_OBJ)
  516.   
  517.   # Standard targets
  518.   
  519. ! all:        filter.exe
  520.           
  521. ! clean:        
  522. !         $(RM) $(FILTER_OBJ)
  523.   
  524. ! # Dependencies and rules for compiling programs
  525.   
  526. ! filter.exe:    $(FILTER_OBJ) $(DEF)
  527. diff -cbr orig/filter/rules.c new/filter/rules.c
  528. *** orig/filter/rules.c    Sat Apr 28 19:42:00 1990
  529. --- new/filter/rules.c    Sun Oct 04 13:37:28 1992
  530. ***************
  531. *** 120,126 ****
  532.   
  533.   #ifndef    _POSIX_SOURCE
  534.       struct tm *localtime();
  535. !     long    time();
  536.   #endif
  537.       struct tm *timerec;
  538.       long    thetime;
  539. --- 120,126 ----
  540.   
  541.   #ifndef    _POSIX_SOURCE
  542.       struct tm *localtime();
  543. !     time_t time();
  544.   #endif
  545.       struct tm *timerec;
  546.       long    thetime;
  547. diff -cbr orig/filter/utils.c new/filter/utils.c
  548. *** orig/filter/utils.c    Sun Oct 04 14:36:27 1992
  549. --- new/filter/utils.c    Sun Mar 22 14:27:13 1992
  550. ***************
  551. *** 40,45 ****
  552. --- 40,47 ----
  553.   #include "defs.h"
  554.   #include "filter.h"
  555.   
  556. + #undef fflush
  557.   leave(reason)
  558.   char *reason;
  559.   {
  560. diff -cbr orig/hdrs/defs.h new/hdrs/defs.h
  561. *** orig/hdrs/defs.h    Sun Oct 04 14:36:28 1992
  562. --- new/hdrs/defs.h    Sun Oct 04 09:56:18 1992
  563. ***************
  564. *** 36,41 ****
  565. --- 36,45 ----
  566.   #include "../config.h"
  567.   #include "sysdefs.h"    /* system/configurable defines */
  568.   
  569. + #ifdef OS2
  570. + #include "../os2/os2elm.h"
  571. + #endif
  572.   
  573.   # define VERSION         "2.3"        /* Version number... */
  574.   # define VERS_DATE    "May 1, 1990"        /* for elm -v option */
  575. ***************
  576. *** 113,125 ****
  577.   #define DONT_SAVE    "[no save]"
  578.   #define DONT_SAVE2    "[nosave]"
  579.   
  580. - #define alias_file    ".aliases"
  581. - #define group_file    ".groups"
  582. - #define system_file    ".systems"
  583. - #define default_folders        "Mail"
  584. - #define default_recvdmail    "=received"
  585. - #define default_sentmail    "=sent"
  586.   
  587.   /** some defines for the 'userlevel' variable... **/
  588.   
  589. --- 117,122 ----
  590. ***************
  591. *** 169,176 ****
  592.   #define DECEMBER    11
  593.   
  594.   #define equal(s,w)    (strcmp(s,w) == 0)
  595. ! #define min(a,b)    a < b? a : b
  596. ! #define ctrl(c)            c - 'A' + 1    /* control character mapping */
  597.   #define plural(n)    n == 1 ? "" : "s"
  598.   #define lastch(s)    s[strlen(s)-1]
  599.   
  600. --- 166,173 ----
  601.   #define DECEMBER    11
  602.   
  603.   #define equal(s,w)    (strcmp(s,w) == 0)
  604. ! #define min(a,b)    (a < b? a : b)
  605. ! #define ctrl(c)            (c == '?' ? 127 : c - 'A' + 1)    /* control character mapping */
  606.   #define plural(n)    n == 1 ? "" : "s"
  607.   #define lastch(s)    s[strlen(s)-1]
  608.   
  609. ***************
  610. *** 258,263 ****
  611. --- 255,261 ----
  612.   
  613.   #define PMALLOC_THRESHOLD    256    /* if greater, then just use malloc */
  614.   #define PMALLOC_BUFFER_SIZE    2048    /* internal [memory] buffer size... */
  615.   
  616.   /** the following macro is as suggested by Larry McVoy.  Thanks! **/
  617.   
  618. diff -cbr orig/hdrs/elm.h new/hdrs/elm.h
  619. *** orig/hdrs/elm.h    Sun Oct 04 14:36:28 1992
  620. --- new/hdrs/elm.h    Sun Oct 04 09:57:15 1992
  621. ***************
  622. *** 34,40 ****
  623.   #include "../hdrs/curses.h"
  624.   #include "../hdrs/defs.h"
  625.   
  626. ! #ifdef    BSD
  627.   #include <setjmp.h>
  628.   #endif
  629.   
  630. --- 34,40 ----
  631.   #include "../hdrs/curses.h"
  632.   #include "../hdrs/defs.h"
  633.   
  634. ! #if defined(BSD) || defined(OS2)
  635.   #include <setjmp.h>
  636.   #endif
  637.   
  638. ***************
  639. *** 57,62 ****
  640. --- 57,64 ----
  641.   int headers_per_page;        /* number of headers/page  */
  642.   int original_umask = 0;        /* original umask, for restore before subshell */
  643.   int sendmail_verbose = 0;       /* Extended mail debugging */
  644. + int no_save = 0;        /* Do not save outgoing mail */
  645. + int mmdf_strict = 0;        /* Strict MMDF mailbox scanning */
  646.   char cur_folder[SLEN];          /* name of current folder */
  647.   char cur_tempfolder[SLEN];      /* name of temp folder open for a mailbox */
  648.   char defaultfile[SLEN];         /* name of default folder */
  649. ***************
  650. *** 177,183 ****
  651.   int userid;            /* uid for current user          */
  652.   int groupid;            /* groupid for current user   */
  653.   
  654. ! #ifdef    BSD
  655.   jmp_buf GetPromptBuf;        /* setjmp buffer */
  656.   int InGetPrompt;        /* set if in GetPrompt() in read() */
  657.   #endif
  658. --- 179,185 ----
  659.   int userid;            /* uid for current user          */
  660.   int groupid;            /* groupid for current user   */
  661.   
  662. ! #if defined(BSD) || defined(OS2)
  663.   jmp_buf GetPromptBuf;        /* setjmp buffer */
  664.   int InGetPrompt;        /* set if in GetPrompt() in read() */
  665.   #endif
  666. diff -cbr orig/hdrs/filter.h new/hdrs/filter.h
  667. *** orig/hdrs/filter.h    Sun Oct 04 14:36:28 1992
  668. --- new/hdrs/filter.h    Sun Mar 22 13:46:06 1992
  669. ***************
  670. *** 42,54 ****
  671.   
  672.   /** some of the files we'll be using, where they are, and so on... **/
  673.   
  674. ! #define  filter_temp    "/tmp/filter"
  675. ! #define  filterfile    ".elm/filter-rules"
  676. ! #define  filterlog    ".elm/filterlog"
  677. ! #define  filtersum    ".elm/filtersum"
  678.   
  679. ! #define  EMERGENCY_MAILBOX    "EMERGENCY_MBOX"
  680. ! #define  EMERG_MBOX        "MBOX.EMERGENCY"
  681.   
  682.   /** and now the hardwired constraint of the program.. **/
  683.   
  684. --- 42,54 ----
  685.   
  686.   /** some of the files we'll be using, where they are, and so on... **/
  687.   
  688. ! #define  filter_temp    "filter"
  689. ! #define  filterfile    "elm/filter.rul"
  690. ! #define  filterlog    "elm/filter.log"
  691. ! #define  filtersum    "elm/filter.sum"
  692.   
  693. ! #define  EMERGENCY_MAILBOX      "emergenc.mbx"
  694. ! #define  EMERG_MBOX             "emerg.mbx"
  695.   
  696.   /** and now the hardwired constraint of the program.. **/
  697.   
  698. ***************
  699. *** 87,93 ****
  700.   
  701.   /** A funky way to open a file using open() to avoid file locking hassles **/
  702.   
  703. ! #define  FOLDERMODE    O_WRONLY | O_APPEND | O_CREAT | O_SYNCIO
  704.   
  705.   /** cheap but easy way to have two files share the same #include file **/
  706.   
  707. --- 87,93 ----
  708.   
  709.   /** A funky way to open a file using open() to avoid file locking hassles **/
  710.   
  711. ! #define  FOLDERMODE    O_WRONLY | O_APPEND | O_CREAT
  712.   
  713.   /** cheap but easy way to have two files share the same #include file **/
  714.   
  715. diff -cbr orig/hdrs/headers.h new/hdrs/headers.h
  716. *** orig/hdrs/headers.h    Sun Oct 04 14:36:28 1992
  717. --- new/hdrs/headers.h    Sun Oct 04 09:56:18 1992
  718. ***************
  719. *** 33,38 ****
  720. --- 33,43 ----
  721.   #include "curses.h"
  722.   #include "defs.h"
  723.   
  724. + #ifdef OS2
  725. + #include "../os2/os2elm.h"
  726. + #include <setjmp.h>
  727. + #endif
  728.   #ifdef    BSD
  729.   #include <setjmp.h>
  730.   #endif
  731. ***************
  732. *** 51,56 ****
  733. --- 56,63 ----
  734.   extern int headers_per_page;    /* number of headers/page  */
  735.   extern int original_umask;    /* original umask, for restore before subshell */
  736.   extern int sendmail_verbose;    /* Allow extended debugging on sendmail */
  737. + extern int no_save;        /* Do not save outgoing mail */
  738. + extern int mmdf_strict;        /* Strict MMDF mailbox scanning */
  739.   extern char cur_folder[SLEN];    /* name of current folder */
  740.   extern char cur_tempfolder[SLEN]; /* name of temp folder open for a mailbox */
  741.   extern char defaultfile[SLEN];    /* name of default folder */
  742. ***************
  743. *** 172,178 ****
  744.   extern int userid;        /* uid for current user          */
  745.   extern int groupid;        /* groupid for current user   */
  746.   
  747. ! #ifdef    BSD
  748.   extern jmp_buf GetPromptBuf;    /* setjmp buffer */
  749.   extern int InGetPrompt;        /* set if in GetPrompt() in read() */
  750.   #endif
  751. --- 179,185 ----
  752.   extern int userid;        /* uid for current user          */
  753.   extern int groupid;        /* groupid for current user   */
  754.   
  755. ! #if defined(BSD) || defined(OS2)
  756.   extern jmp_buf GetPromptBuf;    /* setjmp buffer */
  757.   extern int InGetPrompt;        /* set if in GetPrompt() in read() */
  758.   #endif
  759. diff -cbr orig/src/addr_util.c new/src/addr_util.c
  760. *** orig/src/addr_util.c    Sun Oct 04 14:36:29 1992
  761. --- new/src/addr_util.c    Wed Apr 01 12:13:25 1992
  762. ***************
  763. *** 109,114 ****
  764. --- 109,115 ----
  765.        (char *) 0, 0
  766.   };
  767.   
  768. + #ifndef OS2
  769.   char *
  770.   gcos_name(gcos_field, logname)
  771.   char *logname, *gcos_field;
  772. ***************
  773. *** 169,174 ****
  774. --- 170,176 ----
  775.   #endif
  776.   #endif
  777.   }
  778. + #endif
  779.   
  780.   char *
  781.   get_full_name(logname)
  782. ***************
  783. *** 493,499 ****
  784.   
  785.       struct header_rec temp_rec, *rec_ptr;
  786.       char junk[STRING], timebuff[STRING], holding_from[SLEN], hold_tz[12];
  787. !     char mybuf[BUFSIZ], *p, *q;
  788.       int  eight_fields = 0;
  789.           int mday, month, year, minutes, seconds, tz, i;
  790.           long gmttime;
  791. --- 495,501 ----
  792.   
  793.       struct header_rec temp_rec, *rec_ptr;
  794.       char junk[STRING], timebuff[STRING], holding_from[SLEN], hold_tz[12];
  795. !     char mybuf[BUFSIZ], timebuf2[STRING], *p, *q;
  796.       int  eight_fields = 0;
  797.           int mday, month, year, minutes, seconds, tz, i;
  798.           long gmttime;
  799. ***************
  800. *** 509,517 ****
  801.   
  802.       /* From <user> <day> <month> <day> <hr:min:sec> <year> */
  803.   
  804. !     sscanf(buffer, "%*s %*s %*s %*s %*s %s %*s %s", timebuff, junk);
  805.   
  806. !     if (strlen(timebuff) < 3) {
  807.         dprint(3,(debugfile,
  808.           "Real_from returns FAIL [no time field] on\n-> %s\n",
  809.           buffer));
  810. --- 511,519 ----
  811.   
  812.       /* From <user> <day> <month> <day> <hr:min:sec> <year> */
  813.   
  814. !     sscanf(buffer, "%*s %*s %*s %*s %*s %s %s %s", timebuff, timebuf2, junk);
  815.   
  816. !     if (strlen(timebuff) < 3 && strlen(timebuf2) < 3) {
  817.         dprint(3,(debugfile,
  818.           "Real_from returns FAIL [no time field] on\n-> %s\n",
  819.           buffer));
  820. ***************
  821. *** 518,524 ****
  822.         return(FALSE);
  823.       }
  824.   
  825. !     if (timebuff[1] != ':' && timebuff[2] != ':') { 
  826.         dprint(3,(debugfile,
  827.           "Real_from returns FAIL [bad time field] on\n-> %s\n",
  828.           buffer));
  829. --- 520,527 ----
  830.         return(FALSE);
  831.       }
  832.   
  833. !     if (timebuff[1] != ':' && timebuff[2] != ':' &&
  834. !         timebuf2[1] != ':' && timebuf2[2] != ':') { /* UUPC ! */
  835.         dprint(3,(debugfile,
  836.           "Real_from returns FAIL [bad time field] on\n-> %s\n",
  837.           buffer));
  838. ***************
  839. *** 526,534 ****
  840.       }
  841.       if (junk[0] != '\0') {    /* try for 8 field entry */
  842.         junk[0] = '\0';
  843. !       sscanf(buffer, "%*s %*s %*s %*s %*s %s %*s %*s %s", timebuff, junk);
  844. !       if (junk[0] != '\0') {
  845. !         dprint(3, (debugfile, 
  846.             "Real_from returns FAIL [too many fields] on\n-> %s\n",
  847.             buffer));
  848.           return(FALSE);
  849. --- 529,537 ----
  850.       }
  851.       if (junk[0] != '\0') {    /* try for 8 field entry */
  852.         junk[0] = '\0';
  853. !       sscanf(buffer, "%*s %*s %*s %*s %*s %*s %*s %*s %s", junk);
  854. !       if (junk[0] != '\0' && strcmp(junk, "remote")) {
  855. !         dprint(3, (debugfile,             /* ^ UUPC ! */
  856.             "Real_from returns FAIL [too many fields] on\n-> %s\n",
  857.             buffer));
  858.           return(FALSE);
  859. ***************
  860. *** 547,552 ****
  861. --- 550,571 ----
  862.                   junk, holding_from, rec_ptr->dayname, rec_ptr->month,
  863.                       rec_ptr->day, rec_ptr->time, rec_ptr->year);
  864.   
  865. +         /* non-standard UUPC From line? */
  866. +         /* This is from UUPC rmail: */
  867. +         /* From fkk Sat, 14 Mar 1992 14:53:27 MET remote from stasys */
  868. +         /* while this were normal: */
  869. +         /* From fkk Sat Mar 14 14:53:27 1992 [MET] */
  870. +         if ( rec_ptr->dayname[strlen(rec_ptr->dayname) - 1] == ',' )
  871. +         {
  872. +       sscanf(buffer, "%s %s %s %s %s %s %s %s",
  873. +              junk, holding_from, rec_ptr->dayname, rec_ptr->day,
  874. +                  rec_ptr->month, rec_ptr->year, rec_ptr->time, hold_tz);
  875. +           rec_ptr->dayname[strlen(rec_ptr->dayname) - 1] = 0;
  876. +         }
  877.       strncpy(rec_ptr->from, holding_from, STRING-1);
  878.       rec_ptr->from[STRING-1] = '\0';
  879.       resolve_received(rec_ptr);
  880. ***************
  881. *** 815,821 ****
  882.   /* Return smallest i such that table[i] is a prefix of str.  Return -1 if not
  883.    * found.
  884.    */
  885. ! static int prefix(table, str)
  886.   char **table;
  887.   char *str;
  888.   {
  889. --- 834,840 ----
  890.   /* Return smallest i such that table[i] is a prefix of str.  Return -1 if not
  891.    * found.
  892.    */
  893. ! int prefix(table, str)
  894.   char **table;
  895.   char *str;
  896.   {
  897. ***************
  898. *** 925,931 ****
  899.    * Unlike the preceding routines, the result is not an updated pointer, but
  900.    * simply 1 for success and 0 for failure.
  901.    */
  902. ! static int
  903.   get_unix_date(p,y,d,m,s,t)
  904.   char *p;
  905.   int *y, *d, *m, *s, *t;
  906. --- 944,950 ----
  907.    * Unlike the preceding routines, the result is not an updated pointer, but
  908.    * simply 1 for success and 0 for failure.
  909.    */
  910. ! int
  911.   get_unix_date(p,y,d,m,s,t)
  912.   char *p;
  913.   int *y, *d, *m, *s, *t;
  914. diff -cbr orig/src/alias.c new/src/alias.c
  915. *** orig/src/alias.c    Sun Oct 04 14:36:29 1992
  916. --- new/src/alias.c    Sun Oct 04 14:35:02 1992
  917. ***************
  918. *** 44,50 ****
  919. --- 44,52 ----
  920.   char *get_alias_address();
  921.   char *error_name(), *error_description(), *strip_parens(), *index();
  922.   
  923. + #ifndef OS2
  924.   extern int errno;
  925. + #endif
  926.   
  927.   #ifndef DONT_TOUCH_ADDRESSES
  928.   char *expand_system();
  929. ***************
  930. *** 80,90 ****
  931.   
  932.       struct stat hst;
  933.       static time_t system_ctime, system_mtime;
  934.   
  935.       /* If hash file hasn't changed, don't bother re-reading. */
  936.   
  937.       if (system_data != -1
  938. !      && stat(system_hash_file, &hst) == 0
  939.        && hst.st_ctime == system_ctime
  940.        && hst.st_mtime == system_mtime)
  941.         return;
  942. --- 82,95 ----
  943.   
  944.       struct stat hst;
  945.       static time_t system_ctime, system_mtime;
  946. +         char syshash[SLEN], sysdata[SLEN];
  947.   
  948.       /* If hash file hasn't changed, don't bother re-reading. */
  949. +         sprintf(syshash, "%s/%s", elmhome, system_hash_file);
  950. +         sprintf(sysdata, "%s/%s", elmhome, system_data_file);
  951.   
  952.       if (system_data != -1
  953. !      && stat(syshash, &hst) == 0
  954.        && hst.st_ctime == system_ctime
  955.        && hst.st_mtime == system_mtime)
  956.         return;
  957. ***************
  958. *** 98,113 ****
  959.   
  960.       /* Read system hash table.  If we can't, just return. */
  961.   
  962. !     if (read_hash_file(system_hash_file, (char *) system_hash_table,
  963.                   sizeof system_hash_table) < 0)
  964.         return;
  965.   
  966.       /* Open system data table. */
  967.   
  968. !     if ((system_data = open(system_data_file, O_RDONLY)) == -1) {
  969.         dprint(1, (debugfile,
  970.                 "Warning: Can't open system alias data file %s\n",
  971. !               system_data_file));
  972.         return;
  973.       }
  974.   
  975. --- 103,118 ----
  976.   
  977.       /* Read system hash table.  If we can't, just return. */
  978.   
  979. !     if (read_hash_file(syshash, (char *) system_hash_table,
  980.                   sizeof system_hash_table) < 0)
  981.         return;
  982.   
  983.       /* Open system data table. */
  984.   
  985. !     if ((system_data = open(sysdata, O_RDONLY)) == -1) {
  986.         dprint(1, (debugfile,
  987.                 "Warning: Can't open system alias data file %s\n",
  988. !               sysdata));
  989.         return;
  990.       }
  991.   
  992. ***************
  993. *** 396,402 ****
  994.       FILE *file;
  995.       char fname[SLEN];
  996.   
  997. !     sprintf(fname,"%s/%s", home, ALIAS_TEXT);
  998.   
  999.       save_file_stats(fname);
  1000.       if ((file = fopen(fname, "a")) == NULL) {
  1001. --- 401,407 ----
  1002.       FILE *file;
  1003.       char fname[SLEN];
  1004.   
  1005. !     sprintf(fname, "%s/%s", home, ALIAS_TEXT);
  1006.   
  1007.       save_file_stats(fname);
  1008.       if ((file = fopen(fname, "a")) == NULL) {
  1009. ***************
  1010. *** 441,448 ****
  1011.       strcpy(name_with_equals, name);
  1012.       strcat(name_with_equals, " =");
  1013.   
  1014. !     sprintf(fname,"%s/%s", home, ALIAS_TEXT);
  1015. !     sprintf(tmpfname,"%s/%s.t", home, ALIAS_TEXT);
  1016.   
  1017.       save_file_stats(fname);
  1018.   
  1019. --- 446,453 ----
  1020.       strcpy(name_with_equals, name);
  1021.       strcat(name_with_equals, " =");
  1022.   
  1023. !     sprintf(fname, "%s/%s", home, ALIAS_TEXT);
  1024. !     sprintf(tmpfname, "%s/%s", home, ALIAS_TEMP);
  1025.   
  1026.       save_file_stats(fname);
  1027.   
  1028. ***************
  1029. *** 485,490 ****
  1030. --- 490,496 ----
  1031.       }
  1032.       fclose(file);
  1033.       fclose(tmp_file);
  1034. +         unlink(fname);
  1035.       if (rename(tmpfname, fname) != 0)
  1036.       {
  1037.           error1("Couldn't rename tempfile %s after deleting alias!", tmpfname);
  1038. ***************
  1039. *** 498,504 ****
  1040.   
  1041.   show_alias_menu()
  1042.   {
  1043. !     MoveCursor(LINES-7,0); CleartoEOS();    
  1044.   
  1045.       PutLine0(LINES-7,COLUMNS-45, "Alias commands");
  1046.       Centerline(LINES-6,
  1047. --- 504,510 ----
  1048.   
  1049.   show_alias_menu()
  1050.   {
  1051. !     MoveCursor(LINES-8,0); CleartoEOS();
  1052.   
  1053.       PutLine0(LINES-7,COLUMNS-45, "Alias commands");
  1054.       Centerline(LINES-6,
  1055. ***************
  1056. *** 645,658 ****
  1057.       /** run the 'newalias' program and update the
  1058.           aliases before going back to the main program!
  1059.       **/
  1060.   
  1061.       error("Updating aliases...");
  1062. !     sleep(2);
  1063.   
  1064. !     if (system_call(newalias, SH, FALSE, FALSE) == 0) {
  1065.         error("Re-reading the database in...");
  1066. !       sleep(2);
  1067.         read_alias_files();
  1068.         set_error("Aliases updated successfully.");
  1069.       }
  1070. --- 651,665 ----
  1071.       /** run the 'newalias' program and update the
  1072.           aliases before going back to the main program!
  1073.       **/
  1074. !         char cmd[SLEN];
  1075.   
  1076.       error("Updating aliases...");
  1077. !     /* sleep(2); */
  1078. !         sprintf(cmd, "%s", newalias);
  1079.   
  1080. !     if (system_call(cmd, SH, FALSE, FALSE) == 0) {
  1081.         error("Re-reading the database in...");
  1082. !       /* sleep(2); */
  1083.         read_alias_files();
  1084.         set_error("Aliases updated successfully.");
  1085.       }
  1086. ***************
  1087. *** 722,728 ****
  1088.   {
  1089.       char fname[SLEN];
  1090.   
  1091. !     sprintf(fname,"%s/%s", home, ALIAS_TEXT);
  1092.       display_file(fname);
  1093.       ClearScreen();
  1094.       return;
  1095. --- 729,735 ----
  1096.   {
  1097.       char fname[SLEN];
  1098.   
  1099. !     sprintf(fname, "%s/%s", home, ALIAS_TEXT);
  1100.       display_file(fname);
  1101.       ClearScreen();
  1102.       return;
  1103. diff -cbr orig/src/aliasdb.c new/src/aliasdb.c
  1104. *** orig/src/aliasdb.c    Sun Oct 04 14:37:00 1992
  1105. --- new/src/aliasdb.c    Mon Mar 16 09:47:22 1992
  1106. ***************
  1107. *** 35,41 ****
  1108. --- 35,43 ----
  1109.   #include <sys/stat.h>
  1110.   #include <errno.h>
  1111.   
  1112. + #ifndef OS2
  1113.   extern int errno;
  1114. + #endif
  1115.   
  1116.   #ifdef USE_DBM
  1117.   # include <dbm.h>
  1118. ***************
  1119. *** 324,338 ****
  1120.   
  1121.       struct stat buffer;
  1122.       char   *path_filename;
  1123. - #ifdef USE_DBM
  1124.       char buf[BUFSIZ];
  1125.   
  1126. !     sprintf(buf,"%s.pag", pathfile);
  1127. !     path_filename = buf;
  1128.   #else
  1129. !     path_filename = pathfile;
  1130.   #endif
  1131.   
  1132.       if (stat(path_filename, &buffer) == -1) {
  1133.         dprint(2, (debugfile,
  1134. --- 326,339 ----
  1135.   
  1136.       struct stat buffer;
  1137.       char   *path_filename;
  1138.       char buf[BUFSIZ];
  1139.   
  1140. ! #ifdef USE_DBM
  1141. !     sprintf(buf,"%s/%s.pag", elmhome, pathfile);
  1142.   #else
  1143. !     sprintf(buf,"%s/%s", elmhome, pathfile);
  1144.   #endif
  1145. +     path_filename = buf;
  1146.   
  1147.       if (stat(path_filename, &buffer) == -1) {
  1148.         dprint(2, (debugfile,
  1149. diff -cbr orig/src/args.c new/src/args.c
  1150. *** orig/src/args.c    Sun Oct 04 14:37:00 1992
  1151. --- new/src/args.c    Sun Aug 16 22:56:14 1992
  1152. ***************
  1153. *** 51,57 ****
  1154.       to_whom[0] = '\0';
  1155.       batch_subject[0] = '\0';
  1156.   
  1157. !         while ((c = getopt(argc, argv, "?acd:f:hkKms:Vvwz")) != EOF) {
  1158.          switch (c) {
  1159.            case 'a' : arrow_cursor++;        break;
  1160.            case 'c' : check_only++;        break;
  1161. --- 51,57 ----
  1162.       to_whom[0] = '\0';
  1163.       batch_subject[0] = '\0';
  1164.   
  1165. !         while ((c = getopt(argc, argv, "?acd:f:hkKmns:uVvwz")) != EOF) {
  1166.          switch (c) {
  1167.            case 'a' : arrow_cursor++;        break;
  1168.            case 'c' : check_only++;        break;
  1169. ***************
  1170. *** 62,68 ****
  1171. --- 62,70 ----
  1172.            case 'k' : hp_terminal++;    break;
  1173.            case 'K' : hp_terminal++; hp_softkeys++;    break;
  1174.            case 'm' : mini_menu = 0;    break;
  1175. +          case 'n' : no_save++;    break;
  1176.            case 's' : strcpy(batch_subject, optarg);    break;
  1177. +          case 'u' : mmdf_strict++;    break; /* i.e. UUPC */
  1178.                case 'V' : sendmail_verbose++;     break;
  1179.            case 'v' : args_version();
  1180.            case 'w' : warnings = 0;    break;
  1181. ***************
  1182. *** 122,128 ****
  1183. --- 124,132 ----
  1184.       printf("\t -k \t\tKeypad - enable HP 2622 terminal keyboard\n");
  1185.       printf("\t -K \t\tKeypad&softkeys - enable use of softkeys + \"-k\"\n");
  1186.       printf("\t -m \t\tMenu - Turn off menu, using more of the screen\n");
  1187. +     printf("\t -n \t\tNosave - Do not save outgoing mail - for batchmailing\n");
  1188.       printf("\t -sx\t\tSubject 'x' - for batchmailing\n");
  1189. +     printf("\t -u \t\tMore restrictive mailbox scanning - for UUPC mailboxes\n");
  1190.           printf("\t -V \t\tEnable sendmail voyeur mode.\n");
  1191.       printf("\t -v \t\tPrint out ELM version information.\n");
  1192.       printf("\t -w \t\tSupress warning messages...\n");
  1193. diff -cbr orig/src/builtin.c new/src/builtin.c
  1194. *** orig/src/builtin.c    Sun Oct 04 14:37:00 1992
  1195. --- new/src/builtin.c    Sun Mar 29 00:05:01 1992
  1196. ***************
  1197. *** 98,105 ****
  1198.             iptr++;
  1199.           break;
  1200.         } else if (*iptr == '\n' || *iptr == '\r') {    /*newline or return */
  1201. -         *optr++ = '\n';
  1202.           *optr++ = '\r';
  1203.           iptr++;
  1204.           break;            /* end of line */
  1205.         } else if(*iptr == '\f') {        /* formfeed */
  1206. --- 98,105 ----
  1207.             iptr++;
  1208.           break;
  1209.         } else if (*iptr == '\n' || *iptr == '\r') {    /*newline or return */
  1210.           *optr++ = '\r';
  1211. +         *optr++ = '\n';
  1212.           iptr++;
  1213.           break;            /* end of line */
  1214.         } else if(*iptr == '\f') {        /* formfeed */
  1215. ***************
  1216. *** 113,120 ****
  1217.           break;
  1218.         } else if(*iptr == '\t') {        /* tab stop */
  1219.           if((nt=next_tab(chars_output+1)) > width) {
  1220. !           *optr++ = '\n';        /* won't fit on this line - autowrap */
  1221. !           *optr++ = '\r';        /* tab by tabbing so-to-speak to 1st */
  1222.             iptr++;            /* column of next line */
  1223.             break;
  1224.           } else {        /* will fit - output proper num of spaces */
  1225. --- 113,122 ----
  1226.           break;
  1227.         } else if(*iptr == '\t') {        /* tab stop */
  1228.           if((nt=next_tab(chars_output+1)) > width) {
  1229. ! #ifndef OS2
  1230. !           *optr++ = '\r';        /* won't fit on this line - autowrap */
  1231. !           *optr++ = '\n';        /* tab by tabbing so-to-speak to 1st */
  1232. ! #endif
  1233.             iptr++;            /* column of next line */
  1234.             break;
  1235.           } else {        /* will fit - output proper num of spaces */
  1236. ***************
  1237. *** 161,166 ****
  1238. --- 163,170 ----
  1239.       char *pending, footer[SLEN], display_buffer[SLEN], ch;
  1240.       int formfeed, lines_more;
  1241.   
  1242. +         fixline(input_line);
  1243.   #ifdef MMDF
  1244.       if (strcmp(input_line, MSG_SEPERATOR) == 0)
  1245.         strcpy(input_line," ");
  1246. ***************
  1247. *** 291,297 ****
  1248.   
  1249.       /* truncate or pad title2 portion on the right
  1250.        * so that line fits exactly to the rightmost column */
  1251. !     padding = COLUMNS - (t1_len + t2_len + strlen(title3));
  1252.   
  1253.       sprintf(titlebuf, "%s%-*.*s%s\n\r\n\r", title1, t2_len+padding,
  1254.           t2_len+padding, title2, title3);
  1255. --- 295,301 ----
  1256.   
  1257.       /* truncate or pad title2 portion on the right
  1258.        * so that line fits exactly to the rightmost column */
  1259. !     padding = COLUMNS - 1 - (t1_len + t2_len + strlen(title3));
  1260.   
  1261.       sprintf(titlebuf, "%s%-*.*s%s\n\r\n\r", title1, t2_len+padding,
  1262.           t2_len+padding, title2, title3);
  1263. diff -cbr orig/src/calendar.c new/src/calendar.c
  1264. *** orig/src/calendar.c    Sun Oct 04 14:37:00 1992
  1265. --- new/src/calendar.c    Sun Mar 29 00:05:05 1992
  1266. ***************
  1267. *** 43,49 ****
  1268. --- 43,51 ----
  1269.   
  1270.   #include <errno.h>
  1271.   
  1272. + #ifndef OS2
  1273.   extern int errno;
  1274. + #endif
  1275.   
  1276.   char *error_name(), *error_description(), *strcpy();
  1277.   
  1278. diff -cbr orig/src/conn_to.c new/src/conn_to.c
  1279. *** orig/src/conn_to.c    Sun Oct 04 14:37:01 1992
  1280. --- new/src/conn_to.c    Sun Mar 15 14:17:02 1992
  1281. ***************
  1282. *** 56,62 ****
  1283.         return;
  1284.       }
  1285.   
  1286. !     sprintf(filename, "%s%s%d", temp_dir, temp_uuname, getpid());
  1287.       sprintf(buffer,"%s > %s", uuname, filename);
  1288.   
  1289.       if (system_call(buffer, SH, FALSE, FALSE) != 0) {
  1290. --- 56,62 ----
  1291.         return;
  1292.       }
  1293.   
  1294. !     sprintf(filename, "%s%d%s", temp_dir, getpid(), temp_uuname);
  1295.       sprintf(buffer,"%s > %s", uuname, filename);
  1296.   
  1297.       if (system_call(buffer, SH, FALSE, FALSE) != 0) {
  1298. diff -cbr orig/src/curses.c new/src/curses.c
  1299. *** orig/src/curses.c    Sun Oct 04 14:37:01 1992
  1300. --- new/src/curses.c    Mon Apr 06 15:53:24 1992
  1301. ***************
  1302. *** 119,127 ****
  1303.        *_setbold, *_clearbold, *_setunderline, *_clearunderline,
  1304.        *_sethalfbright, *_clearhalfbright, *_setinverse, *_clearinverse,
  1305.        *_cleartoeoln, *_cleartoeos, *_transmit_on, *_transmit_off,
  1306. !      *_set_memlock, *_clear_memlock;
  1307.   
  1308. ! static int _lines, _columns, _automargin, _eatnewlineglitch;
  1309.   int tabspacing;
  1310.   
  1311.   static char _terminal[1024];              /* Storage for terminal entry */
  1312. --- 119,127 ----
  1313.        *_setbold, *_clearbold, *_setunderline, *_clearunderline,
  1314.        *_sethalfbright, *_clearhalfbright, *_setinverse, *_clearinverse,
  1315.        *_cleartoeoln, *_cleartoeos, *_transmit_on, *_transmit_off,
  1316. !      *_set_memlock, *_clear_memlock, *_initscreen, *_exitscreen;
  1317.   
  1318. ! static int _lines, _columns, _automargin, _eatnewlineglitch, initialized;
  1319.   int tabspacing;
  1320.   
  1321.   static char _terminal[1024];              /* Storage for terminal entry */
  1322. ***************
  1323. *** 145,154 ****
  1324.       char termname[40];
  1325.       char *strcpy(), *getenv();
  1326.   
  1327. !     if (getenv("TERM") == NULL) return(-1);
  1328. !     if (strcpy(termname, getenv("TERM")) == NULL)
  1329. !         return(-1);
  1330.   
  1331.       if ((err = tgetent(_terminal, termname)) != 1)
  1332.           return(err-2);
  1333. --- 145,154 ----
  1334.       char termname[40];
  1335.       char *strcpy(), *getenv();
  1336.   
  1337. !     if (getenv("TERM") == NULL)
  1338. !             strcpy(termname, "ansi");
  1339. !         else
  1340. !         strcpy(termname, getenv("TERM"));
  1341.   
  1342.       if ((err = tgetent(_terminal, termname)) != 1)
  1343.           return(err-2);
  1344. ***************
  1345. *** 157,162 ****
  1346. --- 157,164 ----
  1347.       _col   =  0;        /* assume zero, zero...     */
  1348.   
  1349.       /* load in all those pesky values */
  1350. +     _initscreen        = tgetstr("ti", &ptr);
  1351. +     _exitscreen        = tgetstr("te", &ptr);
  1352.       _clearscreen       = tgetstr("cl", &ptr);
  1353.       _moveto            = tgetstr("cm", &ptr);
  1354.       _up                = tgetstr("up", &ptr);
  1355. ***************
  1356. *** 188,196 ****
  1357. --- 190,211 ----
  1358.           _left = "\b";
  1359.       }
  1360.   
  1361. +     tputs(_initscreen, 1, outchar);
  1362. +     fflush(stdout);
  1363. +         initialized = 1;
  1364.       return(0);
  1365.   }
  1366.   
  1367. + ExitScreen()
  1368. + {
  1369. +         if ( initialized )
  1370. +         {
  1371. +         tputs(_exitscreen, 1, outchar);
  1372. +         fflush(stdout);
  1373. +         }
  1374. + }
  1375.   char *return_value_of(termcap_label)
  1376.   char *termcap_label;
  1377.   {
  1378. ***************
  1379. *** 268,273 ****
  1380. --- 283,291 ----
  1381.   {
  1382.       /** returns the number of lines and columns on the display. **/
  1383.   
  1384. + #ifdef OS2
  1385. +         _ScreenSize(&_lines, &_columns);
  1386. + #endif
  1387.   #ifdef TIOCGWINSZ
  1388.       struct winsize w;
  1389.   
  1390. ***************
  1391. *** 838,844 ****
  1392. --- 856,873 ----
  1393.       /** clear to end of screen **/
  1394.   
  1395.       if (!_cleartoeos)
  1396. + #ifdef OS2
  1397. +         {
  1398. +           int i;
  1399. +           printf("\033[s\033[K");
  1400. +           for ( i = _line + 1; i < _lines; i++ )
  1401. +             printf("\033[%d;1H\033[K", i + 1);
  1402. +           printf("\033[u");
  1403. +           fflush(stdout);
  1404. +         }
  1405. + #else
  1406.           return(-1);
  1407. + #endif
  1408.   
  1409.       tputs(_cleartoeos, 1, outchar);
  1410.       fflush(stdout);  /* clear the output buffer */
  1411. ***************
  1412. *** 861,866 ****
  1413. --- 890,898 ----
  1414.       if (state == OFF && _inraw) {
  1415.         (void) ttsetattr(TTYIN,&_original_tty);
  1416.         _inraw = 0;
  1417. + #ifdef OS2
  1418. +           setmode(1, O_TEXT);
  1419. + #endif
  1420.       }
  1421.       else if (state == ON && ! _inraw) {
  1422.   
  1423. ***************
  1424. *** 879,886 ****
  1425. --- 911,934 ----
  1426.   #endif
  1427.         (void) ttsetattr(TTYIN, &_raw_tty);
  1428.         _inraw = 1;
  1429. + #ifdef OS2
  1430. +           setmode(1, O_BINARY);
  1431. + #endif
  1432. +     }
  1433. + }
  1434. + #ifdef OS2
  1435. + char cbuffer[1024];
  1436. + int cbufsize;
  1437. + tflush()
  1438. + {
  1439. +         if ( cbufsize ) {
  1440. +           write(1, cbuffer, cbufsize);
  1441. +           cbufsize = 0;
  1442.           }
  1443.   }
  1444. + #endif
  1445.   
  1446.   int
  1447.   ReadCh()
  1448. ***************
  1449. *** 889,896 ****
  1450. --- 937,949 ----
  1451.   
  1452.       register int result;
  1453.       char ch;
  1454. + #ifdef OS2
  1455. +         tflush();
  1456. +         return readkey();
  1457. + #else
  1458.       result = read(0, &ch, 1);
  1459.           return((result <= 0 ) ? EOF : ch);
  1460. + #endif
  1461.   }
  1462.   
  1463.   outchar(c)
  1464. ***************
  1465. *** 899,904 ****
  1466. --- 952,964 ----
  1467.       /** output the given character.  From tputs... **/
  1468.       /** Note: this CANNOT be a macro!              **/
  1469.   
  1470. + #ifdef OS2
  1471. +         cbuffer[cbufsize++] = c;
  1472. +         if ( cbufsize == sizeof(cbuffer) )
  1473. +           tflush();
  1474. + #else
  1475.       putc(c, stdout);
  1476. + #endif
  1477.   }
  1478.   
  1479. diff -cbr orig/src/date.c new/src/date.c
  1480. *** orig/src/date.c    Sun Oct 04 14:37:01 1992
  1481. --- new/src/date.c    Sun Oct 04 09:53:21 1992
  1482. ***************
  1483. *** 41,47 ****
  1484.   
  1485.   #ifndef    _POSIX_SOURCE
  1486.   extern struct tm *localtime();
  1487. ! extern long      time();
  1488.   #endif
  1489.   
  1490.   #ifdef BSD
  1491. --- 41,47 ----
  1492.   
  1493.   #ifndef    _POSIX_SOURCE
  1494.   extern struct tm *localtime();
  1495. ! extern time_t      time();
  1496.   #endif
  1497.   
  1498.   #ifdef BSD
  1499. ***************
  1500. *** 69,75 ****
  1501. --- 69,77 ----
  1502.   #ifdef BSD
  1503.     char *timezone();
  1504.   #else
  1505. + #ifndef OS2
  1506.     extern char *tzname[];
  1507. + #endif
  1508.   #endif
  1509.   
  1510.   char *get_arpa_date()
  1511. diff -cbr orig/src/domains.c new/src/domains.c
  1512. *** orig/src/domains.c    Sun Oct 04 14:37:01 1992
  1513. --- new/src/domains.c    Mon Mar 16 09:48:22 1992
  1514. ***************
  1515. *** 67,75 ****
  1516.   
  1517.   open_domain_file()
  1518.   {
  1519. !     if ((domainfd = fopen(domains, "r")) == NULL) {
  1520.         dprint(2, (debugfile,"Warning: can't open file %s as domains file\n",
  1521. !         domains));
  1522.       }
  1523.       else {
  1524.         dprint(3, (debugfile,
  1525. --- 67,79 ----
  1526.   
  1527.   open_domain_file()
  1528.   {
  1529. !         char domainsfile[SLEN];
  1530. !         sprintf(domainsfile, "%s/%s", elmhome, domains);
  1531. !     if ((domainfd = fopen(domainsfile, "r")) == NULL) {
  1532.         dprint(2, (debugfile,"Warning: can't open file %s as domains file\n",
  1533. !         domainsfile));
  1534.       }
  1535.       else {
  1536.         dprint(3, (debugfile,
  1537. diff -cbr orig/src/edit.c new/src/edit.c
  1538. *** orig/src/edit.c    Sun Oct 04 14:37:02 1992
  1539. --- new/src/edit.c    Tue May 26 22:31:03 1992
  1540. ***************
  1541. *** 38,44 ****
  1542. --- 38,46 ----
  1543.   #include "headers.h"
  1544.   #include <errno.h>
  1545.   
  1546. + #ifndef OS2
  1547.   extern int errno;
  1548. + #endif
  1549.   
  1550.   char   *error_name(), *error_description(), *strcpy();
  1551.   long   bytes();
  1552. ***************
  1553. *** 83,88 ****
  1554. --- 85,93 ----
  1555.   
  1556.       Raw(OFF);
  1557.   
  1558. +     fclose(mailfile);
  1559. +     mailfile = NULL;
  1560.       if (system_call(buffer, SH, TRUE, FALSE) != 0) {
  1561.         error1("Problems invoking editor %s!", alternative_editor);
  1562.         Raw(ON);
  1563. ***************
  1564. *** 91,96 ****
  1565. --- 96,102 ----
  1566.       }
  1567.   
  1568.       Raw(ON);
  1569. +         ClearScreen();
  1570.       SetXYLocation(0, 40);    /* a location not near the next request, so an absolute is used */
  1571.   
  1572.       if (folder_type == SPOOL) {    /* uh oh... now the toughie...  */
  1573. ***************
  1574. *** 192,198 ****
  1575.       } else
  1576.         error("Resynchronizing with new version of folder...");
  1577.   
  1578. !     sleep(2);
  1579.       ClearScreen();
  1580.       newmbox(cur_folder, FALSE);
  1581.       showscreen();
  1582. --- 198,204 ----
  1583.       } else
  1584.         error("Resynchronizing with new version of folder...");
  1585.   
  1586. !     /* sleep(2); */
  1587.       ClearScreen();
  1588.       newmbox(cur_folder, FALSE);
  1589.       showscreen();
  1590. diff -cbr orig/src/editmsg.c new/src/editmsg.c
  1591. *** orig/src/editmsg.c    Sun Oct 04 14:37:02 1992
  1592. --- new/src/editmsg.c    Tue Mar 17 00:40:01 1992
  1593. ***************
  1594. *** 55,61 ****
  1595. --- 55,63 ----
  1596.   #undef        tolower
  1597.   #endif
  1598.   
  1599. + #ifndef OS2
  1600.   extern int errno;
  1601. + #endif
  1602.   
  1603.   char *error_name(), *error_description(), *strcpy(), *format_long();
  1604.   unsigned long sleep();
  1605. ***************
  1606. *** 109,114 ****
  1607. --- 111,117 ----
  1608.       if (old_raw == ON)
  1609.          Raw(ON);
  1610.   
  1611. +         ClearScreen();
  1612.       SetXYLocation(0, 40);    /* a location not near the next request, so an absolute is used */
  1613.       MoveCursor(LINES, 0);    /* dont know where we are, force last row, col 0 */
  1614.   
  1615. ***************
  1616. *** 286,292 ****
  1617.                    Write_to_screen(
  1618.            "(You need to use a specific command here. Continue.)\n\r");
  1619.                  else {
  1620. !                  sprintf(buf, " > %s%s.%d 2>&1", temp_dir, temp_edit, getpid());
  1621.                    strcat(buffer, buf);
  1622.                    if (( old_raw = RawState()) == ON)
  1623.                      Raw(OFF);
  1624. --- 289,295 ----
  1625.                    Write_to_screen(
  1626.            "(You need to use a specific command here. Continue.)\n\r");
  1627.                  else {
  1628. !                  sprintf(buf, " > %s%d.%s", temp_dir, getpid(), temp_edit);
  1629.                    strcat(buffer, buf);
  1630.                    if (( old_raw = RawState()) == ON)
  1631.                      Raw(OFF);
  1632. ***************
  1633. *** 293,299 ****
  1634.                    (void) system_call((char *) buffer+2, SH, TRUE, TRUE);
  1635.                    if (old_raw == ON)
  1636.                       Raw(ON);
  1637. !                  sprintf(buffer, "~r %s%s.%d", temp_dir, temp_edit, getpid());
  1638.                              read_in_file(edit_fd, (char *) buffer + 3, 0);
  1639.                    (void) unlink((char *) buffer+3);
  1640.                    SetXYLocation(0, 40);    /* a location not near the next request, so an absolute is used */
  1641. --- 296,302 ----
  1642.                    (void) system_call((char *) buffer+2, SH, TRUE, TRUE);
  1643.                    if (old_raw == ON)
  1644.                       Raw(ON);
  1645. !                  sprintf(buffer, "~r %s%d.%s", temp_dir, getpid(), temp_edit);
  1646.                              read_in_file(edit_fd, (char *) buffer + 3, 0);
  1647.                    (void) unlink((char *) buffer+3);
  1648.                    SetXYLocation(0, 40);    /* a location not near the next request, so an absolute is used */
  1649. ***************
  1650. *** 359,365 ****
  1651.   
  1652.       char    buf[SLEN];
  1653.   
  1654. !     Write_to_screen("\n\r(Available options at this point are:\n\r\n\r", 0);
  1655.       sprintf(buf, "\t%c?\tPrint this help menu.\n\r", escape_char);
  1656.       Write_to_screen(buf, 0);
  1657.       if (escape_char == TILDE_ESCAPE) /* doesn't make sense otherwise... */
  1658. --- 362,368 ----
  1659.   
  1660.       char    buf[SLEN];
  1661.   
  1662. !     Write_to_screen("\n\rAvailable options at this point are:\n\r\n\r", 0);
  1663.       sprintf(buf, "\t%c?\tPrint this help menu.\n\r", escape_char);
  1664.       Write_to_screen(buf, 0);
  1665.       if (escape_char == TILDE_ESCAPE) /* doesn't make sense otherwise... */
  1666. ***************
  1667. *** 423,429 ****
  1668.       sprintf(buf,
  1669.         "\t.  \tby itself on a line (or a control-D) ends the message.\n\r");
  1670.       Write_to_screen(buf, 0);
  1671. !     Write_to_screen("Continue.)\n\r", 0);
  1672.   }
  1673.   
  1674.   read_in_file(fd, filename, show_user_filename)
  1675. --- 426,432 ----
  1676.       sprintf(buf,
  1677.         "\t.  \tby itself on a line (or a control-D) ends the message.\n\r");
  1678.       Write_to_screen(buf, 0);
  1679. !     Write_to_screen("(Continue.)\n\r", 0);
  1680.   }
  1681.   
  1682.   read_in_file(fd, filename, show_user_filename)
  1683. diff -cbr orig/src/elm.c new/src/elm.c
  1684. *** orig/src/elm.c    Sun Oct 04 14:37:02 1992
  1685. --- new/src/elm.c    Mon Apr 06 20:34:15 1992
  1686. ***************
  1687. *** 53,59 ****
  1688. --- 53,63 ----
  1689.            last_in_folder;    /** for when we receive new mail too...      **/
  1690.       long num;        /** another variable for fun..               **/
  1691.       extern char version_buff[];
  1692. + #ifndef OS2
  1693.       extern int errno;
  1694. + #endif
  1695. +         initpaths();
  1696.   
  1697.       req_mfile = parse_arguments(argc, argv, to_whom);
  1698.   
  1699. ***************
  1700. *** 720,731 ****
  1701.       ClearScreen();
  1702.       Raw(OFF);
  1703.   
  1704. !     PutLine2(0,0,"Current message number = %d\t\t%d message(s) total\n",
  1705.           current, message_count);
  1706. !     PutLine2(2,0,"Header_page = %d           \t\t%d possible page(s)\n",
  1707.           header_page, (int) (message_count / headers_per_page) + 1);
  1708.   
  1709. !     PutLine1(4,0,"\nCurrent mailfile is %s.\n\n", cur_folder);
  1710.   
  1711.       i = header_page*headers_per_page;    /* starting header */
  1712.   
  1713. --- 724,735 ----
  1714.       ClearScreen();
  1715.       Raw(OFF);
  1716.   
  1717. !     PutLine2(0,0,"Current message number = %d\t\t%d message(s) total\r\n",
  1718.           current, message_count);
  1719. !     PutLine2(2,0,"Header_page = %d           \t\t%d possible page(s)\r\n",
  1720.           header_page, (int) (message_count / headers_per_page) + 1);
  1721.   
  1722. !     PutLine1(4,0,"\r\nCurrent mailfile is %s.\n\r\n\r", cur_folder);
  1723.   
  1724.       i = header_page*headers_per_page;    /* starting header */
  1725.   
  1726. ***************
  1727. *** 737,743 ****
  1728.   
  1729.       while (i <= j) {
  1730.          sprintf(buffer,
  1731. !        "%3d  %-16.16s  %-40.40s  %4d  %d\n\r",
  1732.               i+1,
  1733.               headers[i]->from,
  1734.               headers[i]->subject,
  1735. --- 741,747 ----
  1736.   
  1737.       while (i <= j) {
  1738.          sprintf(buffer,
  1739. !        "%3d  %-16.16s  %-40.40s  %4d  %ld\n\r",
  1740.               i+1,
  1741.               headers[i]->from,
  1742.               headers[i]->subject,
  1743. ***************
  1744. *** 837,841 ****
  1745.       dprint(3, (debugfile, "Check-only: checking \n-> \"%s\"\n",
  1746.           format_long(to_whom, 3)));
  1747.       (void) build_address(strip_commas(to_whom), buffer);
  1748. !     printf("Expands to: %s", format_long(buffer, strlen("Expands to: ")));
  1749.       }
  1750. --- 841,845 ----
  1751.       dprint(3, (debugfile, "Check-only: checking \n-> \"%s\"\n",
  1752.           format_long(to_whom, 3)));
  1753.       (void) build_address(strip_commas(to_whom), buffer);
  1754. !     printf("\r\nExpands to: %s\r\n", format_long(buffer, strlen("Expands to: ")));
  1755.       }
  1756. diff -cbr orig/src/expires.c new/src/expires.c
  1757. *** orig/src/expires.c    Sat Apr 28 19:43:01 1990
  1758. --- new/src/expires.c    Sun Oct 04 09:58:01 1992
  1759. ***************
  1760. *** 52,58 ****
  1761.       int  month = 0, day = 0, year = 0, hour = 0, minute = 0;
  1762.   #ifndef    _POSIX_SOURCE
  1763.       struct tm *localtime();
  1764. !     long time();
  1765.   #endif
  1766.   
  1767.       /** first step is to break down the date given into MM DD YY HH MM
  1768. --- 52,58 ----
  1769.       int  month = 0, day = 0, year = 0, hour = 0, minute = 0;
  1770.   #ifndef    _POSIX_SOURCE
  1771.       struct tm *localtime();
  1772. !     time_t time();
  1773.   #endif
  1774.   
  1775.       /** first step is to break down the date given into MM DD YY HH MM
  1776. diff -cbr orig/src/file.c new/src/file.c
  1777. *** orig/src/file.c    Sun Oct 04 14:37:03 1992
  1778. --- new/src/file.c    Sat Feb 01 15:37:24 1992
  1779. ***************
  1780. *** 42,48 ****
  1781. --- 42,50 ----
  1782.   #undef tolower
  1783.   #endif
  1784.   
  1785. + #ifndef OS2
  1786.   extern int errno;
  1787. + #endif
  1788.   
  1789.   char *error_name(), *error_description(), *strcpy(), *getenv(), *nameof();
  1790.   unsigned long sleep();
  1791. diff -cbr orig/src/file_util.c new/src/file_util.c
  1792. *** orig/src/file_util.c    Sun Oct 04 14:37:03 1992
  1793. --- new/src/file_util.c    Fri Mar 20 23:41:26 1992
  1794. ***************
  1795. *** 35,47 ****
  1796.   #endif
  1797.   
  1798.   #include <signal.h>
  1799. - #include <errno.h>
  1800.   
  1801.   #ifdef BSD
  1802.   # include <sys/wait.h>
  1803.   #endif
  1804.   
  1805.   extern int errno;        /* system error number */
  1806.   
  1807.   char *error_name(), *error_description(), *strcpy(), *getlogin();
  1808.   long  fsize();
  1809. --- 35,48 ----
  1810.   #endif
  1811.   
  1812.   #include <signal.h>
  1813.   
  1814.   #ifdef BSD
  1815.   # include <sys/wait.h>
  1816.   #endif
  1817.   
  1818. + #ifndef OS2
  1819.   extern int errno;        /* system error number */
  1820. + #endif
  1821.   
  1822.   char *error_name(), *error_description(), *strcpy(), *getlogin();
  1823.   long  fsize();
  1824. ***************
  1825. *** 57,63 ****
  1826.       **/
  1827.   
  1828.       int ok = 1;
  1829. -     extern int errno;    /* system error number! */
  1830.       struct stat buffer;
  1831.   
  1832.       if (stat(name, &buffer) != 0)
  1833. --- 58,63 ----
  1834. ***************
  1835. *** 86,91 ****
  1836. --- 86,95 ----
  1837.   
  1838.       int the_stat = 0, pid, w;
  1839.       struct stat stat_buf;
  1840. + #ifdef OS2
  1841. +         the_stat = (access(file, mode) == 0) ? 0 : (errno == 0) ? 1 : errno;
  1842. + #else
  1843.       void _exit(), exit();
  1844.   #if defined(BSD) && !defined(WEXITSTATUS)
  1845.       union wait status;
  1846. ***************
  1847. *** 134,139 ****
  1848. --- 138,145 ----
  1849.   
  1850.       signal(SIGINT, istat);
  1851.       signal(SIGQUIT, qstat);
  1852. + #endif
  1853.       if (the_stat == 0) {
  1854.         if (stat(file, &stat_buf) == 0) {
  1855.           w = stat_buf.st_mode & S_IFMT;
  1856. ***************
  1857. *** 159,164 ****
  1858. --- 165,183 ----
  1859.   
  1860.       FILE *fd;
  1861.       int the_stat = 0, pid, w, preexisted = 0;
  1862. + #ifdef OS2
  1863. +     errno = 0;
  1864. +     if (access(file, ACCESS_EXISTS) == 0)
  1865. +       preexisted = 1;
  1866. +     if ((fd = fopen(file, mode)) == NULL)
  1867. +       the_stat = errno;
  1868. +     else {
  1869. +       fclose(fd);        /* don't just leave it open! */
  1870. +       if(!preexisted)    /* don't leave it if this test created it! */
  1871. +         unlink(file);
  1872. +       the_stat = 0;
  1873. +     }
  1874. + #else
  1875.       void _exit(), exit();
  1876.   #if defined(BSD) && !defined(WEXITSTATUS)
  1877.       union wait status;
  1878. ***************
  1879. *** 210,215 ****
  1880. --- 229,235 ----
  1881.   
  1882.       signal(SIGINT, istat);
  1883.       signal(SIGQUIT, qstat);
  1884. + #endif
  1885.   
  1886.       return(the_stat);
  1887.   }
  1888. ***************
  1889. *** 339,347 ****
  1890.       /* now display the appropriate message if there isn't mail in it */
  1891.       switch(retcode) {
  1892.   
  1893. !     case -1:    printf("You have no permission to read %s!\n\r", mfile);
  1894.               break;
  1895. !     case 1:        printf("You have no mail.\n\r");
  1896.               break;
  1897.       case 2:        no_ret(firstline) /* remove newline before using */
  1898.               printf("Your mail is being forwarded to %s.\n\r",
  1899. --- 359,367 ----
  1900.       /* now display the appropriate message if there isn't mail in it */
  1901.       switch(retcode) {
  1902.   
  1903. !     case -1:    printf("\r\nYou have no permission to read %s!\r\n", mfile);
  1904.               break;
  1905. !     case 1:        printf("\r\nYou have no mail.\r\n");
  1906.               break;
  1907.       case 2:        no_ret(firstline) /* remove newline before using */
  1908.               printf("Your mail is being forwarded to %s.\n\r",
  1909. diff -cbr orig/src/fileio.c new/src/fileio.c
  1910. *** orig/src/fileio.c    Sun Oct 04 14:37:03 1992
  1911. --- new/src/fileio.c    Sun Mar 15 16:37:22 1992
  1912. ***************
  1913. *** 38,44 ****
  1914. --- 38,46 ----
  1915.   #undef tolower
  1916.   #endif
  1917.   
  1918. + #ifndef OS2
  1919.   extern int errno;
  1920. + #endif
  1921.   
  1922.   char *error_name(), *index();
  1923.   
  1924. ***************
  1925. *** 103,108 ****
  1926. --- 105,111 ----
  1927.         if (fgets(buffer, SLEN, mailfile) == NULL)
  1928.           break;
  1929.   
  1930. +       fixline(buffer);
  1931.         front_line = next_front;
  1932.   
  1933.         if(buffer[strlen(buffer)-1] == '\n') {
  1934. diff -cbr orig/src/forms.c new/src/forms.c
  1935. *** orig/src/forms.c    Sun Oct 04 14:37:04 1992
  1936. --- new/src/forms.c    Sun Mar 15 14:19:07 1992
  1937. ***************
  1938. *** 49,55 ****
  1939. --- 49,57 ----
  1940.   #include "headers.h"
  1941.   #include <errno.h>
  1942.   
  1943. + #ifndef OS2
  1944.   extern int errno;
  1945. + #endif
  1946.   
  1947.   char *error_name(), *strcat(), *strcpy();
  1948.   
  1949. ***************
  1950. *** 103,109 ****
  1951.         return(-1);
  1952.       }
  1953.   
  1954. !     sprintf(newfname, "%s%s%d", temp_dir, temp_form_file, getpid());
  1955.   
  1956.       if ((newform = fopen(newfname, "w")) == NULL) {
  1957.         error("Couldn't open newform file for form output!");
  1958. --- 105,111 ----
  1959.         return(-1);
  1960.       }
  1961.   
  1962. !     sprintf(newfname, "%s%d%s", temp_dir, getpid(), temp_form_file);
  1963.   
  1964.       if ((newform = fopen(newfname, "w")) == NULL) {
  1965.         error("Couldn't open newform file for form output!");
  1966. ***************
  1967. *** 136,149 ****
  1968.           error2("Error %s unlinking file %s.", error_name(errno), filename);
  1969.           return(-1);
  1970.         }
  1971. !       if (link(newfname, filename)) {
  1972. !         error3("Error %s linking %s to %s.", error_name(errno), 
  1973.               newfname, filename);
  1974.           return(-1);
  1975.         }
  1976.       }
  1977. !     if (unlink(newfname)) {
  1978.         error2("Error %s unlinking file %s.", error_name(errno), newfname);
  1979.         return(-1);
  1980.       }
  1981. --- 138,150 ----
  1982.           error2("Error %s unlinking file %s.", error_name(errno), filename);
  1983.           return(-1);
  1984.         }
  1985. !       if (rename(newfname, filename)) {
  1986. !         error3("Error %s renaming %s to %s.", error_name(errno),
  1987.               newfname, filename);
  1988.           return(-1);
  1989.         }
  1990.       }
  1991. !         else if (unlink(newfname)) {
  1992.         error2("Error %s unlinking file %s.", error_name(errno), newfname);
  1993.         return(-1);
  1994.       }
  1995. diff -cbr orig/src/in_utils.c new/src/in_utils.c
  1996. *** orig/src/in_utils.c    Sun Oct 04 14:37:04 1992
  1997. --- new/src/in_utils.c    Tue Aug 04 21:45:12 1992
  1998. ***************
  1999. *** 32,40 ****
  2000.   #  undef tolower
  2001.   #endif
  2002.   
  2003.   extern int errno;        /* system error number */
  2004.   unsigned alarm();
  2005.   
  2006.   #define isstopchar(c)        (c == ' ' || c == '\t' || c == '/')
  2007.   #define isslash(c)        (c == '/')
  2008. --- 32,41 ----
  2009.   #  undef tolower
  2010.   #endif
  2011.   
  2012. + #ifndef OS2
  2013.   extern int errno;        /* system error number */
  2014.   unsigned alarm();
  2015. + #endif
  2016.   
  2017.   #define isstopchar(c)        (c == ' ' || c == '\t' || c == '/')
  2018.   #define isslash(c)        (c == '/')
  2019. ***************
  2020. *** 479,485 ****
  2021.   
  2022.       if (timeout > 0) {
  2023.         alarm((unsigned) timeout);
  2024. ! #ifdef    BSD
  2025.         if (setjmp(GetPromptBuf)) {
  2026.           InGetPrompt = 0;
  2027.           ch = NO_OP_COMMAND;
  2028. --- 480,486 ----
  2029.   
  2030.       if (timeout > 0) {
  2031.         alarm((unsigned) timeout);
  2032. ! #if defined(BSD) || defined(OS2)
  2033.         if (setjmp(GetPromptBuf)) {
  2034.           InGetPrompt = 0;
  2035.           ch = NO_OP_COMMAND;
  2036. diff -cbr orig/src/init.c new/src/init.c
  2037. *** orig/src/init.c    Sun Oct 04 14:37:04 1992
  2038. --- new/src/init.c    Sat May 23 19:38:10 1992
  2039. ***************
  2040. *** 80,86 ****
  2041. --- 80,88 ----
  2042.   #undef tolower
  2043.   #endif
  2044.   
  2045. + #ifndef OS2
  2046.   extern int errno;        /* system error number on failure */
  2047. + #endif
  2048.   extern char version_buff[];
  2049.   
  2050.   char *error_name(), *error_description();
  2051. ***************
  2052. *** 188,215 ****
  2053.         if ((i = InitScreen()) < 0) {
  2054.           if (i == -1) {
  2055.             printf(
  2056. ! "Sorry, but you must specify what type of terminal you're on if you want to\n");
  2057.             printf(
  2058. ! "run the \"elm\" program. (You need your environment variable \"TERM\" set.)\n"
  2059.                );
  2060.             dprint(1,(debugfile,"No $TERM variable in environment!\n"));
  2061.           }
  2062.           else if (i == -2) {
  2063.             printf(
  2064. ! "You need a cursor-addressable terminal to run \"elm\" and I can't find any\n");
  2065.             printf(
  2066. ! "kind of termcap entry for \"%s\" - check your \"TERM\" setting...\n",
  2067.              getenv("TERM"));
  2068.             dprint(1,
  2069.           (debugfile,"$TERM variable is an unknown terminal type!\n"));
  2070.           } else {
  2071. !           printf("Failed trying to initialize your terminal entry: unknown return code %d\n", i);
  2072. !           dprint(1, (debugfile, "Initscreen returned unknown code: %d\n",
  2073.             i));
  2074.           }
  2075.           Raw(OFF);
  2076.           exit(1);    /* all the errors share this exit statement */
  2077.         }
  2078.       }
  2079.   
  2080.       if (debug < 5) {    /* otherwise let the system trap 'em! */
  2081. --- 190,222 ----
  2082.         if ((i = InitScreen()) < 0) {
  2083.           if (i == -1) {
  2084.             printf(
  2085. ! "Sorry, but you must specify what type of terminal you're on if you want to\r\n");
  2086.             printf(
  2087. ! "run the \"elm\" program. (You need your environment variable \"TERM\" set.)\r\n"
  2088.                );
  2089.             dprint(1,(debugfile,"No $TERM variable in environment!\n"));
  2090.           }
  2091.           else if (i == -2) {
  2092.             printf(
  2093. ! "You need a cursor-addressable terminal to run \"elm\" and I can't find any\r\n");
  2094.             printf(
  2095. ! "kind of termcap entry for \"%s\" - check your \"TERM\" setting...\r\n",
  2096.              getenv("TERM"));
  2097. +           printf(
  2098. + "Or check your TERMCAP setting or termcap database file.\r\n");
  2099.             dprint(1,
  2100.           (debugfile,"$TERM variable is an unknown terminal type!\n"));
  2101.           } else {
  2102. !           printf("Failed trying to initialize your terminal entry: unknown return code %d\r\n", i);
  2103. !           dprint(1, (debugfile, "Initscreen returned unknown code: %d\r\n",
  2104.             i));
  2105.           }
  2106.           Raw(OFF);
  2107.           exit(1);    /* all the errors share this exit statement */
  2108.         }
  2109. +           EndBold();
  2110. +           EndHalfbright();
  2111. +           EndInverse();
  2112.       }
  2113.   
  2114.       if (debug < 5) {    /* otherwise let the system trap 'em! */
  2115. ***************
  2116. *** 217,225 ****
  2117.         signal(SIGTERM, term_signal);     /* Terminate signal         */
  2118.         signal(SIGILL,  ill_signal);        /* Illegal instruction      */
  2119.         signal(SIGFPE,  fpe_signal);        /* Floating point exception */
  2120.         signal(SIGBUS,  bus_signal);        /* Bus error              */
  2121. -       signal(SIGSEGV, segv_signal);        /* Segmentation Violation   */
  2122.         signal(SIGHUP,  hup_signal);        /* HangUp (line dropped)    */
  2123.       }
  2124.       else {
  2125.         dprint(3,(debugfile,
  2126. --- 224,234 ----
  2127.         signal(SIGTERM, term_signal);     /* Terminate signal         */
  2128.         signal(SIGILL,  ill_signal);        /* Illegal instruction      */
  2129.         signal(SIGFPE,  fpe_signal);        /* Floating point exception */
  2130. + #ifndef OS2
  2131.         signal(SIGBUS,  bus_signal);        /* Bus error              */
  2132.         signal(SIGHUP,  hup_signal);        /* HangUp (line dropped)    */
  2133. + #endif
  2134. +       signal(SIGSEGV, segv_signal);        /* Segmentation Violation   */
  2135.       }
  2136.       else {
  2137.         dprint(3,(debugfile,
  2138. ***************
  2139. *** 233,239 ****
  2140. --- 242,250 ----
  2141.   #else
  2142.       signal(SIGALRM, alarm_signal);        /* Process Timer Alarm      */
  2143.   #endif
  2144. + #ifndef OS2
  2145.       signal(SIGPIPE, pipe_signal);        /* Illegal Pipe Operation   */
  2146. + #endif
  2147.   #ifdef SIGTSTP
  2148.       signal(SIGTSTP, sig_user_stop);        /* Suspend signal from tty  */
  2149.       signal(SIGCONT, sig_return_from_user_stop);    /* Continue Process */
  2150. ***************
  2151. *** 301,307 ****
  2152.        * use then mailhome if it is not found
  2153.        */
  2154.       if ((cp = getenv("MAIL")) == NULL)
  2155. !         sprintf(defaultfile, "%s%s", mailhome, username);
  2156.       else
  2157.           strcpy(defaultfile, cp);
  2158.   
  2159. --- 312,323 ----
  2160.        * use then mailhome if it is not found
  2161.        */
  2162.       if ((cp = getenv("MAIL")) == NULL)
  2163. ! #ifdef OS2
  2164. !         if (maildir)
  2165. !         sprintf(defaultfile, "%s%s/newmail%s", mailhome, username, mailext);
  2166. !         else
  2167. ! #endif
  2168. !         sprintf(defaultfile, "%s%s%s", mailhome, username, mailext);
  2169.       else
  2170.           strcpy(defaultfile, cp);
  2171.   
  2172. ***************
  2173. *** 352,361 ****
  2174. --- 368,379 ----
  2175.   
  2176.       /** fix the shell if needed **/
  2177.   
  2178. + #ifndef OS2
  2179.       if (shell[0] != '/') {
  2180.          sprintf(buffer, "/bin/%s", shell);
  2181.          strcpy(shell, buffer);
  2182.       }
  2183. + #endif
  2184.   
  2185.       if (! mail_only && ! check_only) {
  2186.   
  2187. diff -cbr orig/src/leavembox.c new/src/leavembox.c
  2188. *** orig/src/leavembox.c    Sun Oct 04 14:37:05 1992
  2189. --- new/src/leavembox.c    Sun Oct 04 10:19:26 1992
  2190. ***************
  2191. *** 51,56 ****
  2192. --- 51,57 ----
  2193.   **/
  2194.   
  2195.   #include "headers.h"
  2196. + #include <string.h>
  2197.   #include <sys/types.h>
  2198.   #include <sys/stat.h>
  2199.   #ifdef LOCK_BY_FLOCK
  2200. ***************
  2201. *** 84,90 ****
  2202. --- 85,93 ----
  2203.   # endif /* NOUTIMBUF */
  2204.   #endif /* BSD */
  2205.   
  2206. + #ifndef OS2
  2207.   extern int errno;
  2208. + #endif
  2209.   
  2210.   char *error_name(), *error_description(), *strcpy(), *rindex();
  2211.   unsigned short getegid();
  2212. ***************
  2213. *** 437,443 ****
  2214.        * temp file, then remove original and copy whole temp file over.
  2215.        */
  2216.       if (to_keep > 0) {
  2217. !       sprintf(temp_keep_file, "%s%s%d", temp_dir, temp_file, getpid());
  2218.         if ((errno = can_open(temp_keep_file, "w"))) {
  2219.           error1(
  2220.   "Permission to create temp file %s for writing denied! Leaving folder intact.",
  2221. --- 440,446 ----
  2222.        * temp file, then remove original and copy whole temp file over.
  2223.        */
  2224.       if (to_keep > 0) {
  2225. !       sprintf(temp_keep_file, "%s%d%s", temp_dir, getpid(), temp_file);
  2226.         if ((errno = can_open(temp_keep_file, "w"))) {
  2227.           error1(
  2228.   "Permission to create temp file %s for writing denied! Leaving folder intact.",
  2229. ***************
  2230. *** 486,491 ****
  2231. --- 489,495 ----
  2232.          * folder and we aren't keeping empty non-spool folders,
  2233.          * simply remove the old original folder and that's it!
  2234.          */
  2235. +           fclose(mailfile);
  2236.         (void)unlink(cur_folder);
  2237.   #ifdef SIGTSTP
  2238.         signal(SIGTSTP, oldstop);
  2239. ***************
  2240. *** 534,539 ****
  2241. --- 538,544 ----
  2242.           need_to_copy = TRUE;
  2243.   
  2244.         if(!need_to_copy) {
  2245. +             fclose(mailfile);
  2246.           unlink(cur_folder);
  2247.           if (link(temp_keep_file, cur_folder) != 0) {
  2248.             if(errno == EXDEV || errno == EEXIST) {
  2249. ***************
  2250. *** 651,656 ****
  2251. --- 656,662 ----
  2252.           get_folder_type()), and put it in the static area lock_name.
  2253.           Return lock_name for informational purposes.
  2254.        **/
  2255. +     char *ptr;
  2256.   
  2257.   #ifdef XENIX
  2258.       /* lock is /tmp/[basename of file_to_lock].mlk */
  2259. ***************
  2260. *** 657,663 ****
  2261.       sprintf(lock_name, "/tmp/%.10s.mlk", rindex(file_to_lock, '/')+1);
  2262.   #else
  2263.       /* lock is [file_to_lock].lock */
  2264. !     sprintf(lock_name, "%s.lock", file_to_lock);
  2265.   #endif
  2266.       return(lock_name);
  2267.   }
  2268. --- 663,675 ----
  2269.       sprintf(lock_name, "/tmp/%.10s.mlk", rindex(file_to_lock, '/')+1);
  2270.   #else
  2271.       /* lock is [file_to_lock].lock */
  2272. !     strcpy(lock_name, file_to_lock);
  2273. ! #ifdef OS2
  2274. !     if ( (ptr = strrchr(lock_name, '.')) != NULL
  2275. !          && strcmp(ptr, mailext) == 0 )
  2276. !       *ptr = 0;
  2277. ! #endif
  2278. !     strcat(lock_name, ".lck");
  2279.   #endif
  2280.       return(lock_name);
  2281.   }
  2282. ***************
  2283. *** 730,736 ****
  2284.         do {
  2285.   
  2286.       errno = 0;
  2287. !     if((create_fd=open(lock_name,O_WRONLY | O_CREAT | O_EXCL,0444)) != -1)
  2288.         break;
  2289.       else {
  2290.         if(errno != EEXIST) {
  2291. --- 742,748 ----
  2292.         do {
  2293.   
  2294.       errno = 0;
  2295. !     if((create_fd=open(lock_name,O_WRONLY | O_CREAT | O_EXCL,0666)) != -1)
  2296.         break;
  2297.       else {
  2298.         if(errno != EEXIST) {
  2299. ***************
  2300. *** 767,773 ****
  2301.         } while (create_iteration++ < MAX_ATTEMPTS);
  2302.         clear_error();
  2303.   
  2304. !       if(errno != 0) {
  2305.   
  2306.       /* we weren't able to create the lock file */
  2307.   
  2308. --- 779,785 ----
  2309.         } while (create_iteration++ < MAX_ATTEMPTS);
  2310.         clear_error();
  2311.   
  2312. !       if(errno != 0 && errno != ENOENT) {
  2313.   
  2314.       /* we weren't able to create the lock file */
  2315.   
  2316. ***************
  2317. *** 796,802 ****
  2318.       }
  2319.   
  2320.       /* we've removed the bad lock, let's try to assert lock once more */
  2321. !     if((create_fd=open(lock_name,O_WRONLY | O_CREAT | O_EXCL,0444)) == -1){
  2322.   
  2323.         /* still can't lock it - just give up */
  2324.         dprint(1, (debugfile,
  2325. --- 808,814 ----
  2326.       }
  2327.   
  2328.       /* we've removed the bad lock, let's try to assert lock once more */
  2329. !     if((create_fd=open(lock_name,O_WRONLY | O_CREAT | O_EXCL,0666)) == -1){
  2330.   
  2331.         /* still can't lock it - just give up */
  2332.         dprint(1, (debugfile,
  2333. diff -cbr orig/src/mailmsg2.c new/src/mailmsg2.c
  2334. *** orig/src/mailmsg2.c    Sun Oct 04 14:37:06 1992
  2335. --- new/src/mailmsg2.c    Sun Oct 04 11:42:08 1992
  2336. ***************
  2337. *** 68,74 ****
  2338. --- 68,76 ----
  2339.   #undef toupper
  2340.   #endif
  2341.   
  2342. + #ifndef OS2
  2343.   extern int errno;
  2344. + #endif
  2345.   extern char version_buff[];
  2346.   
  2347.   char *error_name(), *error_description(), *strip_parens();
  2348. ***************
  2349. *** 111,117 ****
  2350.       **/
  2351.   
  2352.       FILE *reply, *real_reply; /* second is post-input buffer */
  2353. !     char *whole_msg_file, *tempnam();
  2354.       char filename[SLEN], fname[SLEN], copy_file[SLEN],
  2355.                very_long_buffer[VERY_LONG_STRING], mailerflags[NLEN];
  2356.       int ch, sys_status;
  2357. --- 113,119 ----
  2358.       **/
  2359.   
  2360.       FILE *reply, *real_reply; /* second is post-input buffer */
  2361. !     char *whole_msg_file = NULL, *tempnam();
  2362.       char filename[SLEN], fname[SLEN], copy_file[SLEN],
  2363.                very_long_buffer[VERY_LONG_STRING], mailerflags[NLEN];
  2364.       int ch, sys_status;
  2365. ***************
  2366. *** 129,135 ****
  2367.   
  2368.       /** first generate the temporary filename **/
  2369.   
  2370. !     sprintf(filename,"%s%s%d", temp_dir, temp_file, getpid());
  2371.   
  2372.       /** if possible, let's try to recall the last message? **/
  2373.   
  2374. --- 131,137 ----
  2375.   
  2376.       /** first generate the temporary filename **/
  2377.   
  2378. !     sprintf(filename,"%s%d%s", temp_dir, getpid(), temp_file);
  2379.   
  2380.       /** if possible, let's try to recall the last message? **/
  2381.   
  2382. ***************
  2383. *** 162,168 ****
  2384.       }
  2385.   
  2386.       if (copy_msg == FORM) {
  2387. !       sprintf(fname, "%s%s%d", temp_dir, temp_form_file, getpid());
  2388.         fclose(reply);    /* we can't retransmit a form! */
  2389.         if (access(fname,ACCESS_EXISTS) != 0) {
  2390.           if(batch_only)
  2391. --- 164,170 ----
  2392.       }
  2393.   
  2394.       if (copy_msg == FORM) {
  2395. !       sprintf(fname, "%s%d%s", temp_dir, getpid(), temp_form_file);
  2396.         fclose(reply);    /* we can't retransmit a form! */
  2397.         if (access(fname,ACCESS_EXISTS) != 0) {
  2398.           if(batch_only)
  2399. ***************
  2400. *** 176,188 ****
  2401.         rename(fname, filename);
  2402.       }
  2403.       else if (copy_msg && ! retransmit) {  /* if retransmit we have it! */
  2404. !       if (attribution[0]) {
  2405.           fprintf(reply, attribution, headers[current-1]->from);
  2406.           fputc('\n', reply);
  2407.         }
  2408. -       else if (forwarding) {
  2409. -         fputs("Forwarded message:\n", reply);
  2410. -       }
  2411.         if (edit_message) {
  2412.           copy_message(prefixchars, reply, noheader,FALSE,FALSE,TRUE,FALSE);
  2413.           already_has_text = TRUE;    /* we just added it, right? */
  2414. --- 178,190 ----
  2415.         rename(fname, filename);
  2416.       }
  2417.       else if (copy_msg && ! retransmit) {  /* if retransmit we have it! */
  2418. !       if (forwarding) {
  2419. !         fputs("Forwarded message:\n", reply);
  2420. !       }
  2421. !       else if (attribution[0]) {
  2422.           fprintf(reply, attribution, headers[current-1]->from);
  2423.           fputc('\n', reply);
  2424.         }
  2425.         if (edit_message) {
  2426.           copy_message(prefixchars, reply, noheader,FALSE,FALSE,TRUE,FALSE);
  2427.           already_has_text = TRUE;    /* we just added it, right? */
  2428. ***************
  2429. *** 197,203 ****
  2430.           if (already_has_text ||
  2431.              (strcmp(editor,"builtin") != 0 && strcmp(editor,"none") != 0)) {
  2432.            signature_done = TRUE;
  2433. !              if (!retransmit && copy_msg != FORM)
  2434.              already_has_text |= append_sig(reply);
  2435.       }
  2436.   
  2437. --- 199,206 ----
  2438.           if (already_has_text ||
  2439.              (strcmp(editor,"builtin") != 0 && strcmp(editor,"none") != 0)) {
  2440.            signature_done = TRUE;
  2441. !              if (!(forwarding && !edit_message) &&
  2442. !                  !retransmit && copy_msg != FORM)
  2443.              already_has_text |= append_sig(reply);
  2444.       }
  2445.   
  2446. ***************
  2447. *** 298,310 ****
  2448.   
  2449.       /** grab a copy if the user so desires... **/
  2450.   
  2451. !     if (*copy_file) /* i.e. if copy_file contains a name */
  2452.         save_copy(expanded_to, expanded_cc, expanded_bcc,
  2453.              filename, copy_file, form);
  2454.   
  2455.       /** write all header information into whole_msg_file **/
  2456.   
  2457. !     if((whole_msg_file=tempnam(temp_dir, "snd.")) == NULL) {
  2458.         dprint(1, (debugfile, "couldn't make temp file nam! (mail)\n"));
  2459.         if(batch_only)
  2460.           printf("Sorry - couldn't make temp file name!\n");
  2461. --- 301,313 ----
  2462.   
  2463.       /** grab a copy if the user so desires... **/
  2464.   
  2465. !     if (*copy_file && !no_save) /* i.e. if copy_file contains a name */
  2466.         save_copy(expanded_to, expanded_cc, expanded_bcc,
  2467.              filename, copy_file, form);
  2468.   
  2469.       /** write all header information into whole_msg_file **/
  2470.   
  2471. !     if((whole_msg_file=tempnam(temp_dir, "snd")) == NULL) {
  2472.         dprint(1, (debugfile, "couldn't make temp file nam! (mail)\n"));
  2473.         if(batch_only)
  2474.           printf("Sorry - couldn't make temp file name!\n");
  2475. ***************
  2476. *** 338,345 ****
  2477.         quote_args(very_long_buffer, strip_parens(strip_commas(expanded_to)));
  2478.         strcpy(expanded_to, very_long_buffer);
  2479.   
  2480. !       sprintf(very_long_buffer, "( (%s -s \"%s\" %s ; %s %s) & ) < %s",
  2481. !           mailx, subject, expanded_to, remove_cmd, filename, filename);
  2482.   
  2483.         if(batch_only)
  2484.           printf("Message sent using dumb mailer %s.\n", mailx);
  2485. --- 341,348 ----
  2486.         quote_args(very_long_buffer, strip_parens(strip_commas(expanded_to)));
  2487.         strcpy(expanded_to, very_long_buffer);
  2488.   
  2489. !       sprintf(very_long_buffer, "%s -f %s -s \"%s\" %s",
  2490. !           mailx, filename, subject, expanded_to);
  2491.   
  2492.         if(batch_only)
  2493.           printf("Message sent using dumb mailer %s.\n", mailx);
  2494. ***************
  2495. *** 389,403 ****
  2496.           strcpy(expanded_to, very_long_buffer);
  2497.         }
  2498.   
  2499. !       sprintf(very_long_buffer,"( (%s %s %s ; %s %s) & ) < %s", 
  2500. !         mailer, mailerflags, expanded_to,
  2501. !         remove_cmd, whole_msg_file, whole_msg_file);
  2502.       }
  2503.   
  2504.       fclose(reply);
  2505.   
  2506.       if(batch_only)
  2507. !       printf("Sending mail...\n");
  2508.       else {
  2509.         PutLine0(LINES,0,"Sending mail...");
  2510.         CleartoEOLN();
  2511. --- 392,405 ----
  2512.           strcpy(expanded_to, very_long_buffer);
  2513.         }
  2514.   
  2515. !       sprintf(very_long_buffer,"%s -f %s %s %s 2>nul",
  2516. !           mailer, whole_msg_file, mailerflags, expanded_to);
  2517.       }
  2518.   
  2519.       fclose(reply);
  2520.   
  2521.       if(batch_only)
  2522. !       printf("Sending mail...\r\n");
  2523.       else {
  2524.         PutLine0(LINES,0,"Sending mail...");
  2525.         CleartoEOLN();
  2526. ***************
  2527. *** 416,422 ****
  2528.       } else {
  2529.           /* Success case: */
  2530.           if(batch_only)
  2531. !           printf("Mail sent!\n");
  2532.           else if(mail_only)
  2533.             error("Mail sent!");
  2534.           else
  2535. --- 418,424 ----
  2536.       } else {
  2537.           /* Success case: */
  2538.           if(batch_only)
  2539. !           printf("Mail sent!\r\n");
  2540.           else if(mail_only)
  2541.             error("Mail sent!");
  2542.           else
  2543. ***************
  2544. *** 431,437 ****
  2545.        * file just hang after we're finished with it.
  2546.        */
  2547.       (void)unlink(filename);
  2548.       return(need_redraw);
  2549.   }
  2550.   
  2551. --- 433,440 ----
  2552.        * file just hang after we're finished with it.
  2553.        */
  2554.       (void)unlink(filename);
  2555. !     (void)unlink(whole_msg_file);
  2556. !         free(whole_msg_file);
  2557.       return(need_redraw);
  2558.   }
  2559.   
  2560. ***************
  2561. *** 750,759 ****
  2562.           of headers is irrelevant).  Gahhhhh....
  2563.       **/
  2564.   
  2565. -     fprintf(filedesc, "Subject: %s\n", subject);
  2566. -       fprintf(filedesc, "To: %s\n", format_long(long_to, strlen("To:")));
  2567.       fprintf(filedesc,"Date: %s\n", get_arpa_date());
  2568.   
  2569.   #ifndef DONT_ADD_FROM
  2570. --- 753,758 ----
  2571. ***************
  2572. *** 775,781 ****
  2573.   # else
  2574.   #  ifdef  INTERNET
  2575.   #   ifdef  USE_DOMAIN
  2576. ! #    ifdef MMDF
  2577.       if (is_submit_mailer)
  2578.         fprintf(filedesc,"From: %s <%s>\n", full_username, username);
  2579.       else
  2580. --- 774,780 ----
  2581.   # else
  2582.   #  ifdef  INTERNET
  2583.   #   ifdef  USE_DOMAIN
  2584. ! #    ifdef _MMDF
  2585.       if (is_submit_mailer)
  2586.         fprintf(filedesc,"From: %s <%s>\n", full_username, username);
  2587.       else
  2588. ***************
  2589. *** 783,789 ****
  2590.         fprintf(filedesc,"From: %s <%s@%s>\n", full_username,
  2591.           username, hostfullname);
  2592.   #   else
  2593. ! #    ifdef MMDF
  2594.       if (is_submit_mailer)
  2595.         fprintf(filedesc,"From: %s <%s>\n", full_username, username);
  2596.       else
  2597. --- 782,788 ----
  2598.         fprintf(filedesc,"From: %s <%s@%s>\n", full_username,
  2599.           username, hostfullname);
  2600.   #   else
  2601. ! #    ifdef _MMDF
  2602.       if (is_submit_mailer)
  2603.         fprintf(filedesc,"From: %s <%s>\n", full_username, username);
  2604.       else
  2605. ***************
  2606. *** 803,808 ****
  2607. --- 802,811 ----
  2608.   # endif
  2609.   #endif
  2610.   
  2611. +     fprintf(filedesc, "Subject: %s\n", subject);
  2612. +     fprintf(filedesc, "To: %s\n", format_long(long_to, strlen("To:")));
  2613.       if (cc[0] != '\0')
  2614.           fprintf(filedesc, "Cc: %s\n", format_long(long_cc, strlen("Cc: ")));
  2615.   
  2616. ***************
  2617. *** 833,839 ****
  2618.         fprintf(filedesc, "Content-Type: mailform\n");
  2619.   
  2620.   #ifndef NO_XHEADER
  2621. !     fprintf(filedesc, "X-Mailer: ELM [version %s]\n", version_buff);
  2622.   #endif /* !NO_XHEADER */
  2623.   
  2624.       putc('\n', filedesc);
  2625. --- 836,842 ----
  2626.         fprintf(filedesc, "Content-Type: mailform\n");
  2627.   
  2628.   #ifndef NO_XHEADER
  2629. !     fprintf(filedesc, "X-Mailer: ELM [version %s] for OS/2\n", version_buff);
  2630.   #endif /* !NO_XHEADER */
  2631.   
  2632.       putc('\n', filedesc);
  2633. ***************
  2634. *** 901,907 ****
  2635.           emergency_exit();
  2636.           }
  2637.       }
  2638. ! #ifdef MMDF
  2639.       if (copy) fputs(MSG_SEPERATOR, dest);
  2640.   #else
  2641.       if (copy) fputs("\n", dest);    /* ensure a blank line at the end */
  2642. --- 904,910 ----
  2643.           emergency_exit();
  2644.           }
  2645.       }
  2646. ! #ifdef _MMDF
  2647.       if (copy) fputs(MSG_SEPERATOR, dest);
  2648.   #else
  2649.       if (copy) fputs("\n", dest);    /* ensure a blank line at the end */
  2650. diff -cbr orig/src/mkhdrs.c new/src/mkhdrs.c
  2651. *** orig/src/mkhdrs.c    Sun Oct 04 14:37:06 1992
  2652. --- new/src/mkhdrs.c    Tue Aug 04 21:08:02 1992
  2653. ***************
  2654. *** 110,116 ****
  2655.         command[j++] = buffer[i];
  2656.       command[j] = '\0';
  2657.   
  2658. !     sprintf(fname,"%s%s%d", temp_dir, temp_print, getpid());
  2659.   
  2660.       sprintf(command_buffer, "%s > %s", command, fname);
  2661.   
  2662. --- 110,116 ----
  2663.         command[j++] = buffer[i];
  2664.       command[j] = '\0';
  2665.   
  2666. !     sprintf(fname,"%s%d%s", temp_dir, getpid(), temp_print);
  2667.   
  2668.       sprintf(command_buffer, "%s > %s", command, fname);
  2669.   
  2670. diff -cbr orig/src/newmbox.c new/src/newmbox.c
  2671. *** orig/src/newmbox.c    Sun Oct 04 14:37:06 1992
  2672. --- new/src/newmbox.c    Sun Oct 04 13:29:18 1992
  2673. ***************
  2674. *** 62,71 ****
  2675.   #  include <sys/time.h>
  2676.   #endif
  2677.   
  2678.   extern int errno;
  2679.   
  2680.   char *error_name(), *error_description();
  2681. ! char *malloc(), *realloc(), *strcpy(), *strncpy(), *rindex(), *index();
  2682.   unsigned long sleep();
  2683.   void rewind();
  2684.   void exit();
  2685. --- 62,77 ----
  2686.   #  include <sys/time.h>
  2687.   #endif
  2688.   
  2689. + #ifndef OS2
  2690.   extern int errno;
  2691. + #endif
  2692.   
  2693.   char *error_name(), *error_description();
  2694. ! char *malloc(), *realloc();
  2695. ! #ifndef __GNUC__
  2696. ! char *alloca();
  2697. ! #endif
  2698. ! char *strcpy(), *strncpy(), *rindex(), *index();
  2699.   unsigned long sleep();
  2700.   void rewind();
  2701.   void exit();
  2702. ***************
  2703. *** 96,101 ****
  2704. --- 102,115 ----
  2705.       int err;
  2706.       char new_tempfile[SLEN];
  2707.   
  2708. + #ifdef OS2
  2709. +     char *new_file2 = (char *) alloca(SLEN);
  2710. +     _fullpath(new_file2, new_file, SLEN);
  2711. +     strlwr(new_file2);
  2712. +     unixpath(new_file2);
  2713. + #define new_file new_file2
  2714. + #endif
  2715.       /* determine type of new mailfile and calculate temp file name */
  2716.       if((new_folder_type = get_folder_type(new_file)) == SPOOL)
  2717.         mk_temp_mail_fn(new_tempfile, new_file);
  2718. ***************
  2719. *** 124,129 ****
  2720. --- 138,146 ----
  2721.         }
  2722.       }
  2723.   
  2724. +     if (mailfile != NULL)
  2725. +       (void) fclose(mailfile);  /* close it first, to avoid too many open */
  2726.       /* If we were reading a spool file and we are not just reading
  2727.        * in the additional new messages to the same file, we need to
  2728.        * remove the corresponding tempfile.
  2729. ***************
  2730. *** 147,156 ****
  2731.       clear_error();
  2732.       clear_central_message();
  2733.   
  2734. !     if (mailfile != NULL)
  2735. !       (void) fclose(mailfile);  /* close it first, to avoid too many open */
  2736. !     if ((mailfile = fopen(cur_folder,"r")) == NULL)  {
  2737.         if (errno != ENOENT ) { /* error on anything but file not exist */
  2738.           err = errno;
  2739.           Write_to_screen("\n\rfail on open in newmbox, open %s failed!!\n\r", 1,
  2740. --- 164,170 ----
  2741.       clear_error();
  2742.       clear_central_message();
  2743.   
  2744. !     if ((mailfile = fopen(cur_folder,"rb")) == NULL)  {
  2745.         if (errno != ENOENT ) { /* error on anything but file not exist */
  2746.           err = errno;
  2747.           Write_to_screen("\n\rfail on open in newmbox, open %s failed!!\n\r", 1,
  2748. ***************
  2749. *** 206,216 ****
  2750.        * and the last character of mailhome is last slash in filename,
  2751.        * it's a spool file .
  2752.        */
  2753. !     if((first_word(filename, mailhome)) &&
  2754. !       ((last_slash = rindex(filename, '/')) != NULL) &&
  2755. !       (*(last_slash+1) != '\0') &&
  2756. !       (filename + strlen(mailhome) - 1 == last_slash))
  2757.           return(SPOOL);
  2758.       /* if file name == default mailbox, its a spool file also
  2759.        * even if its not in the spool directory. (SVR4)
  2760.        */
  2761. --- 220,247 ----
  2762.        * and the last character of mailhome is last slash in filename,
  2763.        * it's a spool file .
  2764.        */
  2765. !     if (first_word(filename, mailhome) &&
  2766. !         (last_slash = rindex(filename, '/')) != NULL &&
  2767. !         *(last_slash + 1) != '\0') 
  2768. !     {
  2769. ! #ifdef OS2
  2770. !       if (!maildir && filename + strlen(mailhome) - 1 == last_slash)
  2771. !         return(SPOOL);
  2772. !       if (maildir && strncmp(last_slash, "/newmail", 8) == 0)
  2773. !       { 
  2774. !         char *previous_slash;
  2775. !         *last_slash = 0;
  2776. !         previous_slash = rindex(filename, '/');
  2777. !             *last_slash = '/';
  2778. !         if (previous_slash != NULL &&
  2779. !         filename + strlen(mailhome) - 1 == previous_slash)
  2780. !           return(SPOOL);
  2781. !       }
  2782. ! #else
  2783. !       if (filename + strlen(mailhome) - 1 == last_slash)
  2784.           return(SPOOL);
  2785. + #endif
  2786. +         }
  2787.       /* if file name == default mailbox, its a spool file also
  2788.        * even if its not in the spool directory. (SVR4)
  2789.        */
  2790. ***************
  2791. *** 228,244 ****
  2792.           Strangeness may result if it is not!
  2793.        **/
  2794.   
  2795. !     char *cp;
  2796.   
  2797. !     sprintf(tempfn, "%s%s", default_temp, temp_mbox);
  2798. !     if((cp = rindex(mbox, '/')) != NULL) {
  2799. !       cp++;
  2800. !       if (strcmp(cp, "mbox") == 0 || strcmp(cp, "mailbox") == 0 ||
  2801. !         strcmp(cp, "inbox") == 0 || *cp == '.')
  2802. !         strcat(tempfn, username);
  2803.       else
  2804. !         strcat(tempfn, cp);
  2805.       }
  2806.   }
  2807.   
  2808.   int
  2809. --- 259,292 ----
  2810.           Strangeness may result if it is not!
  2811.        **/
  2812.   
  2813. !     char *cp, mb[128];
  2814.   
  2815. !         strcpy(tempfn, default_temp);
  2816. !     if (tempfn[strlen (tempfn)-1] != '/')
  2817. !                 strcat(tempfn, "/");
  2818. !     if((cp = rindex(mbox, '/')) != NULL)
  2819. !           strcpy(mb, ++cp);
  2820.       else
  2821. !       strcpy(mb, mbox);
  2822. ! #ifdef OS2
  2823. !     if ( (cp = strrchr(mb, '.')) != NULL && strlen(cp) <= 4 )
  2824. !       *cp = 0;
  2825. ! #endif
  2826. !     if (strcmp(mb, "mbox") == 0 || strcmp(mb, "mailbox") == 0 ||
  2827. !         strcmp(mb, "inbox") == 0)
  2828. !       strcat(tempfn, username);
  2829. ! #ifdef OS2
  2830. !     else if (strcmp(mb, "newmail") == 0) {
  2831. !       strcpy(mb, mbox + strlen(mailhome));
  2832. !       cp = strchr(mb, '/');
  2833. !       if (strncmp(cp, "/newmail", 8) == 0)
  2834. !         *cp = 0;
  2835. !       strcat(tempfn, mb);
  2836.       }
  2837. + #endif
  2838. +     else
  2839. +       strcat(tempfn, mb);
  2840. +         strcat(tempfn, temp_mbox);
  2841.   }
  2842.   
  2843.   int
  2844. ***************
  2845. *** 266,271 ****
  2846. --- 314,320 ----
  2847.       static int first_read = 0;
  2848.   #ifdef MMDF
  2849.           int newheader = 0;
  2850. +         int fromtoo = 1;
  2851.   #endif /* MMDF */
  2852.   
  2853.       if (folder_type == SPOOL) {
  2854. ***************
  2855. *** 280,286 ****
  2856.             error("Ahhhh... I give up.");
  2857.             silently_exit();    /* leave without tampering with it! */
  2858.           }
  2859. !         if ((temp = fopen(cur_tempfolder,"w")) == NULL) {
  2860.            err = errno;
  2861.            unlock();    /* remove lock file! */
  2862.            Raw(OFF);
  2863. --- 329,335 ----
  2864.             error("Ahhhh... I give up.");
  2865.             silently_exit();    /* leave without tampering with it! */
  2866.           }
  2867. !         if ((temp = fopen(cur_tempfolder,"wb")) == NULL) {
  2868.            err = errno;
  2869.            unlock();    /* remove lock file! */
  2870.            Raw(OFF);
  2871. ***************
  2872. *** 299,305 ****
  2873.          chmod(cur_tempfolder, 0700);    /* shut off file for other people! */
  2874.        }
  2875.        else {
  2876. !        if ((temp = fopen(cur_tempfolder,"a")) == NULL) {
  2877.            err = errno;
  2878.            unlock();    /* remove lock file! */
  2879.            Raw(OFF);
  2880. --- 348,354 ----
  2881.          chmod(cur_tempfolder, 0700);    /* shut off file for other people! */
  2882.        }
  2883.        else {
  2884. !        if ((temp = fopen(cur_tempfolder,"ab")) == NULL) {
  2885.            err = errno;
  2886.            unlock();    /* remove lock file! */
  2887.            Raw(OFF);
  2888. ***************
  2889. *** 333,338 ****
  2890. --- 382,396 ----
  2891.         PutLine0(LINES-2, 0, "Reading message: 0");
  2892.       }
  2893.   
  2894. + #ifdef MMDF
  2895. + #ifdef OS2
  2896. +     if (fgets(buffer, LONG_STRING, mailfile)) {
  2897. +           fixline(buffer);
  2898. +           fromtoo = !mmdf_strict || strcmp(buffer, MSG_SEPERATOR) != 0;
  2899. +         }
  2900. +         rewind(mailfile);
  2901. + #endif
  2902. + #endif
  2903.       if (add_new_only) {
  2904.          if (fseek(mailfile, mailfile_size, 0) == -1) {
  2905.            err = errno;
  2906. ***************
  2907. *** 373,378 ****
  2908. --- 431,437 ----
  2909.           rm_temps_exit();
  2910.           }
  2911.         line_bytes = (long) strlen(buffer);
  2912. +           fixline(buffer);
  2913.   
  2914.         /* Fix below to increment line count ONLY if we got a full line.
  2915.          * Input lines longer than the fgets buffer size would
  2916. ***************
  2917. *** 401,407 ****
  2918.             first_line = FALSE;
  2919.   
  2920.   #ifdef MMDF
  2921. !         if (!forwarding_mail && strcmp(buffer, MSG_SEPERATOR) != 0 ) {
  2922.   #else
  2923.           if (! first_word(buffer, "From ") && !forwarding_mail) {
  2924.   #endif /* MMDF */
  2925. --- 460,467 ----
  2926.             first_line = FALSE;
  2927.   
  2928.   #ifdef MMDF
  2929. !         if (!forwarding_mail && strcmp(buffer, MSG_SEPERATOR) != 0
  2930. !             && !first_word(buffer, "From ") ) {
  2931.   #else
  2932.           if (! first_word(buffer, "From ") && !forwarding_mail) {
  2933.   #endif /* MMDF */
  2934. ***************
  2935. *** 417,424 ****
  2936.         }
  2937.   
  2938.   #ifdef MMDF
  2939. !       if (strcmp(buffer, MSG_SEPERATOR) == 0) {
  2940. !             newheader = !newheader;
  2941.   #else
  2942.         if (first_word(buffer,"From ")) {
  2943.   #endif /* MMDF */
  2944. --- 477,486 ----
  2945.         }
  2946.   
  2947.   #ifdef MMDF
  2948. !       if (strcmp(buffer, MSG_SEPERATOR) == 0
  2949. !           || !newheader && fromtoo && first_word(buffer,"From ")
  2950. !                             && real_from(buffer, NULL)) {
  2951. !             newheader = 1; /* !newheader; */
  2952.   #else
  2953.         if (first_word(buffer,"From ")) {
  2954.   #endif /* MMDF */
  2955. ***************
  2956. *** 572,577 ****
  2957. --- 634,640 ----
  2958.           }
  2959.         }
  2960.         else if (in_header) {
  2961. +             newheader = 0;
  2962.   #ifdef MMDF
  2963.           if (first_word(buffer,"From "))
  2964.             real_from(buffer, current_header);
  2965. ***************
  2966. *** 653,658 ****
  2967. --- 716,724 ----
  2968.             c = index(current_header->mailx_status, '\n');
  2969.             if (c != NULL)
  2970.           *c = '\0';
  2971. +           c = index(current_header->mailx_status, '\r');
  2972. +           if (c != NULL)
  2973. +         *c = '\0';
  2974.             remove_possible_trailing_spaces(current_header->mailx_status);
  2975.   
  2976.             /* Okay readjust the status. If there's an 'R', message
  2977. ***************
  2978. *** 688,693 ****
  2979. --- 754,761 ----
  2980.         }
  2981.         if (!in_header && first_word(buffer, START_ENCODE))
  2982.           current_header->encrypted = 1;
  2983. +       if (!in_header && first_word(buffer, "Forwarded "))
  2984. +         in_header = 1;
  2985.         fbytes += (long) line_bytes;
  2986.       }
  2987.   
  2988. ***************
  2989. *** 724,730 ****
  2990.           dprint(0, (debugfile, "newmbox - mbox. != spool mail length"));
  2991.           rm_temps_exit();
  2992.         }
  2993. !       if ((mailfile = fopen(cur_tempfolder,"r")) == NULL) {
  2994.           err = errno;
  2995.           MoveCursor(LINES,0);
  2996.           Raw(OFF);
  2997. --- 792,798 ----
  2998.           dprint(0, (debugfile, "newmbox - mbox. != spool mail length"));
  2999.           rm_temps_exit();
  3000.         }
  3001. !       if ((mailfile = fopen(cur_tempfolder,"rb")) == NULL) {
  3002.           err = errno;
  3003.           MoveCursor(LINES,0);
  3004.           Raw(OFF);
  3005. diff -cbr orig/src/opt_utils.c new/src/opt_utils.c
  3006. *** orig/src/opt_utils.c    Sun Oct 04 14:37:07 1992
  3007. --- new/src/opt_utils.c    Sun Mar 29 00:06:07 1992
  3008. ***************
  3009. *** 96,101 ****
  3010. --- 96,102 ----
  3011.   #endif  /* GETHOSTNAME */
  3012.   
  3013.   
  3014. + #ifndef OS2
  3015.   gethostdomain(hostdom, size)    /* get domain of current host */
  3016.   char *hostdom;
  3017.   int size;
  3018. ***************
  3019. *** 107,113 ****
  3020.       if (size < 2)
  3021.         return -1;
  3022.   
  3023. !     if ((fp = fopen(hostdomfile, "r")) != 0) {
  3024.         fgets(buf, sizeof(buf) - 1, fp);
  3025.         fclose(fp);
  3026.         if ((p = index(buf, '\n')) != NULL)
  3027. --- 108,116 ----
  3028.       if (size < 2)
  3029.         return -1;
  3030.   
  3031. !         sprintf(buf, "%s/%s", elmhome, hostdomfile);
  3032. !     if ((fp = fopen(buf, "r")) != 0) {
  3033.         fgets(buf, sizeof(buf) - 1, fp);
  3034.         fclose(fp);
  3035.         if ((p = index(buf, '\n')) != NULL)
  3036. ***************
  3037. *** 125,130 ****
  3038. --- 128,134 ----
  3039.   
  3040.       return 0;
  3041.   }
  3042. + #endif
  3043.   
  3044.   
  3045.   #ifdef NEED_CUSERID
  3046. diff -cbr orig/src/options.c new/src/options.c
  3047. *** orig/src/options.c    Sun Oct 04 14:37:07 1992
  3048. --- new/src/options.c    Sun Mar 15 14:35:10 1992
  3049. ***************
  3050. *** 218,223 ****
  3051. --- 218,224 ----
  3052.   change_sort(x, y)
  3053.   int x,y;
  3054.   {
  3055. +     char *sort_name();
  3056.       /** change the sorting scheme... **/
  3057.       /** return !0 if new sort order, else 0 **/
  3058.   
  3059. diff -cbr orig/src/pattern.c new/src/pattern.c
  3060. *** orig/src/pattern.c    Sun Oct 04 14:37:07 1992
  3061. --- new/src/pattern.c    Sat Feb 01 16:02:27 1992
  3062. ***************
  3063. *** 31,37 ****
  3064. --- 31,39 ----
  3065.   static char pattern[SLEN] = { "" };
  3066.   static char alt_pattern[SLEN] = { "" };
  3067.   
  3068. + #ifndef OS2
  3069.   extern int errno;
  3070. + #endif
  3071.   
  3072.   char *error_name(), *shift_lower(), *strcpy();
  3073.   
  3074. ***************
  3075. *** 218,224 ****
  3076.   
  3077.       while (message_number < message_count) {
  3078.   
  3079. !       if (fseek(mailfile, headers[message_number]->offset, 0L) == -1) {
  3080.   
  3081.           dprint(1, (debugfile,
  3082.           "Error: seek %ld bytes into file failed. errno %d (%s)\n",
  3083. --- 220,226 ----
  3084.   
  3085.       while (message_number < message_count) {
  3086.   
  3087. !       if (fseek(mailfile, headers[message_number]->offset, 0) == -1) {
  3088.   
  3089.           dprint(1, (debugfile,
  3090.           "Error: seek %ld bytes into file failed. errno %d (%s)\n",
  3091. diff -cbr orig/src/quit.c new/src/quit.c
  3092. *** orig/src/quit.c    Sun Oct 04 14:37:08 1992
  3093. --- new/src/quit.c    Sat Feb 01 16:01:06 1992
  3094. ***************
  3095. *** 27,33 ****
  3096. --- 27,35 ----
  3097.   #include "headers.h"
  3098.   #include <errno.h>
  3099.   
  3100. + #ifndef OS2
  3101.   extern int errno;        /* system error number on failure */
  3102. + #endif
  3103.   
  3104.   long bytes();
  3105.   
  3106. diff -cbr orig/src/read_rc.c new/src/read_rc.c
  3107. *** orig/src/read_rc.c    Sun Oct 04 14:37:08 1992
  3108. --- new/src/read_rc.c    Sun Mar 29 09:56:17 1992
  3109. ***************
  3110. *** 152,158 ****
  3111.   
  3112.       strcpy(raw_editor,((cp = getenv("EDITOR")) == NULL)? default_editor:cp);
  3113.   
  3114. !     strcpy(temp_dir,((cp = getenv("TMPDIR")) == NULL)? default_temp:cp);
  3115.       if (temp_dir[strlen (temp_dir)-1] != '/')
  3116.                   strcat(temp_dir, "/");
  3117.   
  3118. --- 152,162 ----
  3119.   
  3120.       strcpy(raw_editor,((cp = getenv("EDITOR")) == NULL)? default_editor:cp);
  3121.   
  3122. ! #ifdef OS2
  3123. !         strcpy(temp_dir, tempdir);
  3124. ! #else
  3125. !     strcpy(temp_dir,((cp = getenv("TMP")) == NULL)? default_temp:cp);
  3126. ! #endif
  3127.       if (temp_dir[strlen (temp_dir)-1] != '/')
  3128.                   strcat(temp_dir, "/");
  3129.   
  3130. ***************
  3131. *** 169,175 ****
  3132.       strcpy(calendar_file, raw_calendar_file);
  3133.   
  3134.       /* see if the user has a $HOME/.elm directory */
  3135. !     sprintf(filename, "%s/.elm", home);
  3136.       if (access(filename, 00) == -1) {
  3137.         if(batch_only)  {
  3138.           printf("\n\rNotice:\
  3139. --- 173,180 ----
  3140.       strcpy(calendar_file, raw_calendar_file);
  3141.   
  3142.       /* see if the user has a $HOME/.elm directory */
  3143. !     sprintf(filename, "%s/%s", home, dotelm);
  3144.       if (access(filename, 00) == -1) {
  3145.         if(batch_only)  {
  3146.           printf("\n\rNotice:\
  3147. ***************
  3148. *** 200,210 ****
  3149.   
  3150.       /* Look for the elmrc file */
  3151.       sprintf(filename,"%s/%s", home, elmrcfile);
  3152.       if ((file = fopen(filename, "r")) == NULL) {
  3153.         dprint(2,(debugfile,"Warning:User has no \".elm/elmrc\" file\n\n"));
  3154.   
  3155.         /* look for old-style .elmrc file in $HOME */
  3156. !       sprintf(filename, "%s/.elmrc", home);
  3157.         if (access(filename, 00) != -1) {
  3158.           move_old_files_to_new();
  3159.   
  3160. --- 205,216 ----
  3161.   
  3162.       /* Look for the elmrc file */
  3163.       sprintf(filename,"%s/%s", home, elmrcfile);
  3164.       if ((file = fopen(filename, "r")) == NULL) {
  3165.         dprint(2,(debugfile,"Warning:User has no \".elm/elmrc\" file\n\n"));
  3166.   
  3167.         /* look for old-style .elmrc file in $HOME */
  3168. !       sprintf(filename, "%s/%src", home, dotelm);
  3169.         if (access(filename, 00) != -1) {
  3170.           move_old_files_to_new();
  3171.   
  3172. ***************
  3173. *** 513,518 ****
  3174. --- 519,526 ----
  3175.          * can read them before screen is cleared */
  3176.         if(errors)
  3177.           sleep((errors * 2) + 2);
  3178. +           fclose(file);
  3179.       }
  3180.   
  3181.       /* see if the user has a folders directory */
  3182. diff -cbr orig/src/remail.c new/src/remail.c
  3183. *** orig/src/remail.c    Sun Oct 04 14:37:08 1992
  3184. --- new/src/remail.c    Mon Apr 06 19:47:29 1992
  3185. ***************
  3186. *** 38,44 ****
  3187. --- 38,46 ----
  3188.   #include "headers.h"
  3189.   #include <errno.h>
  3190.   
  3191. + #ifndef OS2
  3192.   extern int errno;
  3193. + #endif
  3194.   
  3195.   char *error_name(), *error_description();
  3196.   
  3197. ***************
  3198. *** 52,57 ****
  3199. --- 54,60 ----
  3200.       char *filename, buffer[VERY_LONG_STRING], ch;
  3201.       char mailerflags[NLEN];
  3202.       extern char *tempnam();
  3203. +         int sys_status;
  3204.   
  3205.       entered[0] = '\0';
  3206.   
  3207. ***************
  3208. *** 84,90 ****
  3209.   
  3210.       chown (filename, userid, groupid);
  3211.   
  3212. ! #ifdef MMDF
  3213.       if (strcmp(submitmail, mailer) == 0)
  3214.         do_mmdf_addresses(mailfd, strip_parens(strip_commas(expanded)));
  3215.   #endif /* MMDF */
  3216. --- 87,93 ----
  3217.   
  3218.       chown (filename, userid, groupid);
  3219.   
  3220. ! #ifdef _MMDF
  3221.       if (strcmp(submitmail, mailer) == 0)
  3222.         do_mmdf_addresses(mailfd, strip_parens(strip_commas(expanded)));
  3223.   #endif /* MMDF */
  3224. ***************
  3225. *** 120,140 ****
  3226.   #endif
  3227.         strcpy(mailerflags, (sendmail_verbose ? smflagsv : smflags));
  3228.       else if (strcmp(submitmail, mailer) == 0) {
  3229. !       strcpy(mailerflags, submitflags_s);
  3230.             strcpy(expanded, " ");
  3231.       } else
  3232.         mailerflags[0] = '\0';
  3233.   
  3234. !     sprintf(buffer,"( (%s %s %s ; %s %s) & ) < %s", 
  3235. !           mailer, mailerflags, strip_parens(strip_commas(expanded)), 
  3236. !           remove_cmd, filename, filename);
  3237.   
  3238.       PutLine0(LINES,0,"Resending mail...");
  3239. !     system_call(buffer, SH, FALSE, FALSE);
  3240.               set_error("Mail resent.");
  3241.   
  3242.       return(1);
  3243.   }
  3244.   #ifdef MMDF
  3245.   do_mmdf_addresses(dest_file,buffer)
  3246.   FILE *dest_file;
  3247. --- 123,151 ----
  3248.   #endif
  3249.         strcpy(mailerflags, (sendmail_verbose ? smflagsv : smflags));
  3250.       else if (strcmp(submitmail, mailer) == 0) {
  3251. !       strcpy(mailerflags, submitflags);
  3252.             strcpy(expanded, " ");
  3253.       } else
  3254.         mailerflags[0] = '\0';
  3255.   
  3256. !     sprintf(buffer,"%s -f %s %s %s 2>nul", mailer, filename,
  3257. !               mailerflags, strip_parens(strip_commas(expanded)));
  3258.   
  3259.       PutLine0(LINES,0,"Resending mail...");
  3260. !     if ( sys_status = system_call(buffer, SH, FALSE, FALSE) ) {
  3261. !         /* problem case: */
  3262. !         sprintf(buffer, "mailer returned error status %d", sys_status);
  3263. !         set_error(buffer);
  3264. !     } else {
  3265.               set_error("Mail resent.");
  3266. +         }
  3267. +         unlink(filename);
  3268.   
  3269.       return(1);
  3270.   }
  3271.   #ifdef MMDF
  3272.   do_mmdf_addresses(dest_file,buffer)
  3273.   FILE *dest_file;
  3274. diff -cbr orig/src/reply.c new/src/reply.c
  3275. *** orig/src/reply.c    Sun Oct 04 14:37:09 1992
  3276. --- new/src/reply.c    Sat Feb 01 16:03:07 1992
  3277. ***************
  3278. *** 30,37 ****
  3279. --- 30,39 ----
  3280.   #ifndef BSD
  3281.   #  include <sys/types.h>
  3282.   # ifndef VMS
  3283. + # ifndef OS2
  3284.   #  include <sys/utsname.h>
  3285.   # endif
  3286. + # endif
  3287.   #endif
  3288.   
  3289.   /** Note that this routine generates automatic header information
  3290. ***************
  3291. *** 41,47 ****
  3292. --- 43,51 ----
  3293.   
  3294.   char *strip_parens(), *get_token();
  3295.   
  3296. + #ifndef OS2
  3297.   extern int errno;
  3298. + #endif
  3299.   
  3300.   char *error_name(), *strcat(), *strcpy();
  3301.   
  3302. diff -cbr orig/src/returnadd.c new/src/returnadd.c
  3303. *** orig/src/returnadd.c    Sun Oct 04 14:37:09 1992
  3304. --- new/src/returnadd.c    Sat May 23 18:45:22 1992
  3305. ***************
  3306. *** 48,54 ****
  3307. --- 48,56 ----
  3308.   
  3309.   char *shift_lower();
  3310.   
  3311. + #ifndef OS2
  3312.   extern int errno;
  3313. + #endif
  3314.   
  3315.   char *error_name(), *strcat(), *strcpy();
  3316.   
  3317. ***************
  3318. *** 245,251 ****
  3319.       char buf[SLEN], name1[SLEN], name2[SLEN], lastname[SLEN];
  3320.       char hold_return[SLEN], alt_name2[SLEN], buf2[SLEN];
  3321.       int ok = 1, lines, len_buf, len_buf2;
  3322. !     int using_to = FALSE;
  3323.   
  3324.       /* now initialize all the char buffers [thanks Keith!] */
  3325.   
  3326. --- 247,253 ----
  3327.       char buf[SLEN], name1[SLEN], name2[SLEN], lastname[SLEN];
  3328.       char hold_return[SLEN], alt_name2[SLEN], buf2[SLEN];
  3329.       int ok = 1, lines, len_buf, len_buf2;
  3330. !     int using_to = FALSE, in_header = FALSE;
  3331.   
  3332.       /* now initialize all the char buffers [thanks Keith!] */
  3333.   
  3334. ***************
  3335. *** 275,285 ****
  3336. --- 277,289 ----
  3337.       /** okay!  Now we're there!  **/
  3338.   
  3339.       lines = headers[msgnum]->lines;
  3340. +     in_header = TRUE;
  3341.   
  3342.       buffer[0] = '\0';
  3343.   
  3344.       ok = (int) (fgets(buf2, SLEN, mailfile) != NULL);
  3345.       if (ok) {
  3346. +       fixline(buf2);
  3347.         len_buf2 = strlen(buf2);
  3348.         if(buf2[len_buf2-1] == '\n') lines--; /* got a full line */
  3349.       }
  3350. ***************
  3351. *** 290,295 ****
  3352. --- 294,300 ----
  3353.         len_buf = strlen(buf);
  3354.         ok = (int) (fgets(buf2, SLEN, mailfile) != NULL);
  3355.         if (ok) {
  3356. +         fixline(buf2);
  3357.           len_buf2 = strlen(buf2);
  3358.           if(buf2[len_buf2-1] == '\n') lines--; /* got a full line */
  3359.         }
  3360. ***************
  3361. *** 309,314 ****
  3362. --- 314,331 ----
  3363.   
  3364.   /* At this point, "buf" contains the unfolded header line, while "buf2" contains
  3365.      the next single line of text from the mail file */
  3366. +       if (in_header) {
  3367. +         if (len_buf == 1) /* \n only */
  3368. +           in_header = FALSE;
  3369. +       }
  3370. +       else {
  3371. +         if (first_word(buf, "Forwarded "))
  3372. +           in_header = TRUE;
  3373. +       }
  3374. +       if (!in_header)
  3375. +         continue;
  3376.   
  3377.         if (first_word(buf, "From "))
  3378.           sscanf(buf, "%*s %s", hold_return);
  3379. diff -cbr orig/src/save_opts.c new/src/save_opts.c
  3380. *** orig/src/save_opts.c    Sun Oct 04 14:37:09 1992
  3381. --- new/src/save_opts.c    Wed Apr 01 12:18:01 1992
  3382. ***************
  3383. *** 35,41 ****
  3384. --- 35,43 ----
  3385.   
  3386.   #define absolute(x)        ((x) < 0? -(x) : (x))
  3387.   
  3388. + #ifndef OS2
  3389.   extern  int errno;
  3390. + #endif
  3391.   extern char version_buff[];
  3392.   
  3393.   char *error_name(), *sort_name();
  3394. ***************
  3395. *** 64,70 ****
  3396.       **/
  3397.   
  3398.       FILE *newelmrc;
  3399. !     char  oldfname[SLEN], newfname[SLEN];
  3400.   
  3401.       sprintf(newfname, "%s/%s", home, elmrcfile);
  3402.       sprintf(oldfname, "%s/%s", home, old_elmrcfile);
  3403. --- 66,72 ----
  3404.       **/
  3405.   
  3406.       FILE *newelmrc;
  3407. !     char  oldfname[SLEN], newfname[SLEN], inffname[SLEN];
  3408.   
  3409.       sprintf(newfname, "%s/%s", home, elmrcfile);
  3410.       sprintf(oldfname, "%s/%s", home, old_elmrcfile);
  3411. ***************
  3412. *** 82,91 ****
  3413.       }
  3414.   
  3415.       /** now let's open the datafile if we can... **/
  3416.   
  3417. !     if ((elminfo = fopen(ELMRC_INFO, "r")) == NULL) 
  3418.         error1("Warning: saving without comments! Can't get to %s.",
  3419. !           ELMRC_INFO);
  3420.   
  3421.       /** next, open the new .elm/elmrc file... **/
  3422.   
  3423. --- 84,94 ----
  3424.       }
  3425.   
  3426.       /** now let's open the datafile if we can... **/
  3427. +     sprintf(inffname,"%s/%s", helphome, elmrc_info);
  3428.   
  3429. !     if ((elminfo = fopen(inffname, "r")) == NULL)
  3430.         error1("Warning: saving without comments! Can't get to %s.",
  3431. !           inffname);
  3432.   
  3433.       /** next, open the new .elm/elmrc file... **/
  3434.   
  3435. diff -cbr orig/src/savecopy.c new/src/savecopy.c
  3436. *** orig/src/savecopy.c    Sun Oct 04 14:37:09 1992
  3437. --- new/src/savecopy.c    Sun Oct 04 10:05:08 1992
  3438. ***************
  3439. *** 39,49 ****
  3440.   char *ctime();
  3441.   
  3442.   extern char in_reply_to[SLEN];    /* In-Reply-To: string */
  3443.   extern int errno;
  3444.   
  3445.   char *strcat(), *strcpy();
  3446.   unsigned long sleep();
  3447. ! long  time();
  3448.   
  3449.   save_copy(to, cc, bcc, filename, copy_file, form)
  3450.   char *to, *cc, *bcc, *filename, *copy_file;
  3451. --- 39,51 ----
  3452.   char *ctime();
  3453.   
  3454.   extern char in_reply_to[SLEN];    /* In-Reply-To: string */
  3455. + #ifndef OS2
  3456.   extern int errno;
  3457. + #endif
  3458.   
  3459.   char *strcat(), *strcpy();
  3460.   unsigned long sleep();
  3461. ! time_t time();
  3462.   
  3463.   save_copy(to, cc, bcc, filename, copy_file, form)
  3464.   char *to, *cc, *bcc, *filename, *copy_file;
  3465. diff -cbr orig/src/showmsg.c new/src/showmsg.c
  3466. *** orig/src/showmsg.c    Sun Oct 04 14:37:10 1992
  3467. --- new/src/showmsg.c    Sun Mar 29 22:58:23 1992
  3468. ***************
  3469. *** 38,44 ****
  3470. --- 38,46 ----
  3471.   # undef       tolower
  3472.   #endif
  3473.   
  3474. + #ifndef OS2
  3475.   extern int errno;
  3476. + #endif
  3477.   
  3478.   char *error_name(), *strcat(), *strcpy();
  3479.   void   _exit();
  3480. ***************
  3481. *** 136,141 ****
  3482. --- 138,147 ----
  3483.         /* put terminal out of raw mode so external pager has normal env */
  3484.         Raw(OFF);
  3485.   
  3486. + #ifdef OS2
  3487. +           if ( (pipe_wr_fp = popen(pager, "w")) == NULL )
  3488. +             return -1;
  3489. + #else
  3490.         /* create pipe for external pager and fork */
  3491.   
  3492.         if(pipe(pipe_fd) == -1) {
  3493. ***************
  3494. *** 213,218 ****
  3495. --- 219,225 ----
  3496.           Raw(OFF);
  3497.           return(val);    /* pager may have already touched the screen */
  3498.         }
  3499. + #endif
  3500.   
  3501.         /* and that's it! */
  3502.         lines_displayed = 0;
  3503. ***************
  3504. *** 247,253 ****
  3505.         /* truncate or pad title2 portion on the right
  3506.          * so that line fits exactly */
  3507.         padding =
  3508. !         COLUMNS -
  3509.           (strlen(title1) + (buf_len=strlen(title2)) + strlen(title3));
  3510.   
  3511.         sprintf(titlebuf, "%s%-*.*s%s\n", title1, buf_len+padding,
  3512. --- 254,260 ----
  3513.         /* truncate or pad title2 portion on the right
  3514.          * so that line fits exactly */
  3515.         padding =
  3516. !         COLUMNS - 1 -
  3517.           (strlen(title1) + (buf_len=strlen(title2)) + strlen(title3));
  3518.   
  3519.         sprintf(titlebuf, "%s%-*.*s%s\n", title1, buf_len+padding,
  3520. ***************
  3521. *** 422,436 ****
  3522. --- 429,449 ----
  3523.           if (cursor_control) transmit_functions(ON);
  3524.   
  3525.       if (!builtin) {
  3526. + #ifdef OS2
  3527. +       pclose(pipe_wr_fp);
  3528. + #else
  3529.         fclose(pipe_wr_fp);
  3530.         while ((wait_ret = wait(&wait_stat)) != fork_ret
  3531.             && wait_ret!= -1)
  3532.           ;
  3533. + #endif
  3534.         /* turn raw on **after** child terminates in case child
  3535.          * doesn't put us back to cooked mode after we return ourselves
  3536.          * to raw.
  3537.          */
  3538.         Raw(ON);
  3539. +       EndBold();
  3540. +       ClearScreen();
  3541.       }
  3542.   
  3543.       /* If we are to prompt for a user input command and we don't
  3544. diff -cbr orig/src/signals.c new/src/signals.c
  3545. *** orig/src/signals.c    Sun Oct 04 14:37:10 1992
  3546. --- new/src/signals.c    Tue Aug 04 21:41:13 1992
  3547. ***************
  3548. *** 94,102 ****
  3549.   alarm_signal()
  3550.   {
  3551.       /** silently process alarm signal for timeouts... **/
  3552. ! #ifdef    BSD
  3553.       if (InGetPrompt)
  3554.           longjmp(GetPromptBuf, 1);
  3555.   #else
  3556.       signal(SIGALRM, alarm_signal);
  3557.   #endif
  3558. --- 94,106 ----
  3559.   alarm_signal()
  3560.   {
  3561.       /** silently process alarm signal for timeouts... **/
  3562. ! #if defined(BSD) || defined(OS2)
  3563.       if (InGetPrompt)
  3564.           longjmp(GetPromptBuf, 1);
  3565. + #ifdef OS2
  3566. +     signal(SIGALRM, SIG_ACK);
  3567. +     signal(SIGALRM, alarm_signal);
  3568. + #endif
  3569.   #else
  3570.       signal(SIGALRM, alarm_signal);
  3571.   #endif
  3572. ***************
  3573. *** 109,116 ****
  3574.       dprint(2, (debugfile, "*** received SIGPIPE ***\n\n"));
  3575.   
  3576.       pipe_abort = TRUE;    /* internal signal ... wheeee!  */
  3577.       signal(SIGPIPE, pipe_signal);
  3578.   }
  3579.   
  3580.   #ifdef SIGTSTP
  3581. --- 113,121 ----
  3582.       dprint(2, (debugfile, "*** received SIGPIPE ***\n\n"));
  3583.   
  3584.       pipe_abort = TRUE;    /* internal signal ... wheeee!  */
  3585. ! #ifndef OS2
  3586.       signal(SIGPIPE, pipe_signal);
  3587. + #endif
  3588.   }
  3589.   
  3590.   #ifdef SIGTSTP
  3591. diff -cbr orig/src/strings.c new/src/strings.c
  3592. *** orig/src/strings.c    Sun Oct 04 14:37:10 1992
  3593. --- new/src/strings.c    Sat Mar 21 21:19:18 1992
  3594. ***************
  3595. *** 237,242 ****
  3596. --- 237,243 ----
  3597.         if (strlen(word) + current_length > 80) {
  3598.           if (iindex > 0) {
  3599.             ret_buffer[iindex++] = ',';    /* close 'er up, doctor! */
  3600. +           ret_buffer[iindex++] = '\r';
  3601.             ret_buffer[iindex++] = '\n';
  3602.             ret_buffer[iindex++] = '\t';
  3603.           }
  3604. diff -cbr orig/src/syscall.c new/src/syscall.c
  3605. *** orig/src/syscall.c    Sun Oct 04 14:37:11 1992
  3606. --- new/src/syscall.c    Sun May 03 17:32:00 1992
  3607. ***************
  3608. *** 54,59 ****
  3609. --- 54,63 ----
  3610.   #  include <sys/wait.h>
  3611.   #endif
  3612.   
  3613. + #ifdef OS2
  3614. + #  include <process.h>
  3615. + #endif
  3616.   char *argv_zero();
  3617.   void  _exit();
  3618.   
  3619. ***************
  3620. *** 72,82 ****
  3621. --- 76,91 ----
  3622.       helpful = (user_level == 0);
  3623.   
  3624.       if (helpful)
  3625. + #ifdef OS2
  3626. +       PutLine0(LINES-3,COLUMNS-40,"(Enter empty command for a shell.)");
  3627. + #else
  3628.         PutLine0(LINES-3,COLUMNS-40,"(Use the shell name for a shell.)");
  3629. + #endif
  3630.       PutLine0(LINES-2,0,"Shell command: ");
  3631.       CleartoEOS();
  3632.       command[0] = '\0';
  3633.       (void) optionally_enter(command, LINES-2, 15, FALSE, FALSE);
  3634. + #ifndef OS2
  3635.       if (command[0] == 0) {
  3636.         if (helpful)
  3637.           MoveCursor(LINES-3,COLUMNS-40);
  3638. ***************
  3639. *** 85,90 ****
  3640. --- 94,100 ----
  3641.         CleartoEOS();
  3642.         return 0;
  3643.       }
  3644. + #endif
  3645.   
  3646.       MoveCursor(LINES,0);
  3647.       CleartoEOLN();
  3648. ***************
  3649. *** 100,108 ****
  3650.       umask(077);        /* now put it back to private for mail files */
  3651.   
  3652.       SetXYLocation(0, 40);    /* a location not near the next request, so an absolute is used */
  3653. -     PutLine0(LINES, 0, "\n\nPress any key to return to ELM: ");
  3654.       Raw(ON);
  3655.           (void) getchar();
  3656.       if (old_raw == OFF)
  3657.         Raw(OFF);
  3658.       softkeys_on();
  3659. --- 110,120 ----
  3660.       umask(077);        /* now put it back to private for mail files */
  3661.   
  3662.       SetXYLocation(0, 40);    /* a location not near the next request, so an absolute is used */
  3663.       Raw(ON);
  3664. +     if (command[0]) {
  3665. +         PutLine0(LINES, 0, "\r\n\r\nPress any key to return to ELM: ");
  3666.           (void) getchar();
  3667. +     }
  3668.       if (old_raw == OFF)
  3669.         Raw(OFF);
  3670.       softkeys_on();
  3671. ***************
  3672. *** 109,115 ****
  3673.       if (cursor_control)
  3674.         transmit_functions(ON);
  3675.   
  3676. !     if (ret)
  3677.         error1("Return code was %d.", ret);
  3678.   
  3679.       return 1;
  3680. --- 121,127 ----
  3681.       if (cursor_control)
  3682.         transmit_functions(ON);
  3683.   
  3684. !     if (ret && command[0])
  3685.         error1("Return code was %d.", ret);
  3686.   
  3687.       return 1;
  3688. ***************
  3689. *** 151,161 ****
  3690. --- 163,185 ----
  3691.       register int (*oldstop)(), (*oldstart)();
  3692.   # endif
  3693.   #endif
  3694. + #ifndef OS2
  3695.       extern int errno;
  3696. + #endif
  3697.   
  3698.       sh = (shell_type == USER_SHELL) ? shell : "/bin/sh";
  3699.       dprint(2, (debugfile, "System Call: %s\n\t%s\n", sh, string));
  3700.   
  3701. + #ifdef OS2
  3702. +         tflush();
  3703. +     if ( shell_type != USER_SHELL )
  3704. +           if ( (sh = getenv("COMSPEC")) == NULL )
  3705. +             if ( (sh = getenv("SHELL")) == NULL )
  3706. +               sh = default_shell;
  3707. +         stat = spawnlp(P_WAIT, sh, sh, string[0] ? "/c" : NULL, string, NULL);
  3708. + #else
  3709.       /*
  3710.        * Note the neat trick with close-on-exec pipes.
  3711.        * If the child's exec() succeeds, then the pipe read returns zero.
  3712. ***************
  3713. *** 261,266 ****
  3714. --- 285,292 ----
  3715.       (void) signal(SIGCONT, oldstart);
  3716.   #endif
  3717.   
  3718. + #endif  /* OS2 */
  3719.       return(stat);
  3720.   }
  3721.   
  3722. ***************
  3723. *** 318,324 ****
  3724.   
  3725.       char buffer[SLEN], filename[SLEN], printbuffer[SLEN];
  3726.       char message_list[SLEN];
  3727. !     register int  retcode, to_print;
  3728.   
  3729.       if (strlen(printout) == 0) {
  3730.         error("Don't know how to print - option \"printmail\" undefined!");
  3731. --- 344,350 ----
  3732.   
  3733.       char buffer[SLEN], filename[SLEN], printbuffer[SLEN];
  3734.       char message_list[SLEN];
  3735. !     register int  retcode, to_print, cnt;
  3736.   
  3737.       if (strlen(printout) == 0) {
  3738.         error("Don't know how to print - option \"printmail\" undefined!");
  3739. ***************
  3740. *** 327,333 ****
  3741.   
  3742.       to_print = make_msg_list(message_list);
  3743.   
  3744. !     sprintf(filename,"%s%s%d", temp_dir, temp_print, getpid());
  3745.   
  3746.       if (in_string(printout, "%s"))
  3747.         sprintf(printbuffer, printout, filename);
  3748. --- 353,363 ----
  3749.   
  3750.       to_print = make_msg_list(message_list);
  3751.   
  3752. !     sprintf(filename,"%s%d%s", temp_dir, getpid(), temp_print);
  3753. !     for ( cnt = 0; filename[cnt]; cnt++ )
  3754. !       if ( filename[cnt] == '/' )
  3755. !         filename[cnt] = '\\';
  3756. !     /* some OS/2 print programs :-) are very picky about forward slashes */
  3757.   
  3758.       if (in_string(printout, "%s"))
  3759.         sprintf(printbuffer, printout, filename);
  3760. ***************
  3761. *** 334,340 ****
  3762.       else
  3763.         sprintf(printbuffer, "%s %s", printout, filename);
  3764.   
  3765. !     sprintf(buffer,"(%s -p -f %s%s > %s; %s 2>&1) > /dev/null",
  3766.           readmsg,
  3767.           (folder_type == NON_SPOOL ? cur_folder : cur_tempfolder),
  3768.           message_list,
  3769. --- 364,370 ----
  3770.       else
  3771.         sprintf(printbuffer, "%s %s", printout, filename);
  3772.   
  3773. !     sprintf(buffer,"%s -p -f %s %s >%s & %s 1>nul 2>nul",
  3774.           readmsg,
  3775.           (folder_type == NON_SPOOL ? cur_folder : cur_tempfolder),
  3776.           message_list,
  3777. ***************
  3778. *** 405,411 ****
  3779.       MoveCursor(LINES, 0);
  3780.       if(helpmsg)
  3781.         printf(helpmsg);
  3782. !     sprintf(buffer, "cd %s;ls -C", folders);
  3783.       printf("\n\rContents of your folder directory:\n\r\n\r");
  3784.       system_call(buffer, SH, FALSE, FALSE);
  3785.       while(numlines--)
  3786. --- 435,441 ----
  3787.       MoveCursor(LINES, 0);
  3788.       if(helpmsg)
  3789.         printf(helpmsg);
  3790. !     sprintf(buffer, "dir /w \"%s\"", folders);
  3791.       printf("\n\rContents of your folder directory:\n\r\n\r");
  3792.       system_call(buffer, SH, FALSE, FALSE);
  3793.       while(numlines--)
  3794. diff -cbr orig/src/utils.c new/src/utils.c
  3795. *** orig/src/utils.c    Sun Oct 04 14:37:11 1992
  3796. --- new/src/utils.c    Mon Apr 06 16:33:02 1992
  3797. ***************
  3798. *** 36,42 ****
  3799. --- 36,44 ----
  3800.   
  3801.   #include <signal.h>
  3802.   
  3803. + #ifndef OS2
  3804.   extern int errno;
  3805. + #endif
  3806.   
  3807.   char *error_name();
  3808.   void   exit();
  3809. ***************
  3810. *** 68,74 ****
  3811.   
  3812.       char source[SLEN];
  3813.   #ifdef MKDIR
  3814. !     sprintf(source, "%s/.elm", home);
  3815.       (void) mkdir(source, 0700);
  3816.   #else
  3817.       char com[SLEN];
  3818. --- 70,76 ----
  3819.   
  3820.       char source[SLEN];
  3821.   #ifdef MKDIR
  3822. !     sprintf(source, "%s/%s", home, dotelm);
  3823.       (void) mkdir(source, 0700);
  3824.   #else
  3825.       char com[SLEN];
  3826. ***************
  3827. *** 75,83 ****
  3828.   
  3829.       /** Some systems don't have a mkdir call - how inconvienient! **/
  3830.   
  3831. !     sprintf(com, "mkdir %s/.elm", home);
  3832.       system_call(com, SH, FALSE, FALSE);
  3833. !     sprintf(com, "chmod 700 %s/.elm", home);
  3834.       system_call(com, SH, FALSE, FALSE);
  3835.   #endif /* MKDIR */
  3836.   
  3837. --- 77,85 ----
  3838.   
  3839.       /** Some systems don't have a mkdir call - how inconvienient! **/
  3840.   
  3841. !     sprintf(com, "mkdir %s/%s", home, dotelm);
  3842.       system_call(com, SH, FALSE, FALSE);
  3843. !     sprintf(com, "chmod 700 %s/%s", home, dotelm);
  3844.       system_call(com, SH, FALSE, FALSE);
  3845.   #endif /* MKDIR */
  3846.   
  3847. ***************
  3848. *** 108,114 ****
  3849.         (void) system_call("newalias", SH, FALSE, FALSE);
  3850.       }
  3851.   
  3852. !     sprintf(source, "%s/.elmheaders", home);
  3853.       if (access(source, ACCESS_EXISTS) != -1) {
  3854.         sprintf(dest,   "%s/%s", home, mailheaders);
  3855.         printf("\n\rCopying from: %s\n\rCopying to:   %s\n\r", source, dest);
  3856. --- 110,116 ----
  3857.         (void) system_call("newalias", SH, FALSE, FALSE);
  3858.       }
  3859.   
  3860. !     sprintf(source, "%s/%sheaders", home, dotelm);
  3861.       if (access(source, ACCESS_EXISTS) != -1) {
  3862.         sprintf(dest,   "%s/%s", home, mailheaders);
  3863.         printf("\n\rCopying from: %s\n\rCopying to:   %s\n\r", source, dest);
  3864. ***************
  3865. *** 115,121 ****
  3866.         copy(source, dest);
  3867.       }
  3868.   
  3869. !     sprintf(source, "%s/.elmrc", home);
  3870.       if (access(source, ACCESS_EXISTS) != -1) {
  3871.         sprintf(dest,   "%s/%s", home, elmrcfile);
  3872.         printf("\n\rCopying from: %s\n\rCopying to:   %s\n\r", source, dest);
  3873. --- 117,123 ----
  3874.         copy(source, dest);
  3875.       }
  3876.   
  3877. !     sprintf(source, "%s/%src", home, dotelm);
  3878.       if (access(source, ACCESS_EXISTS) != -1) {
  3879.         sprintf(dest,   "%s/%s", home, elmrcfile);
  3880.         printf("\n\rCopying from: %s\n\rCopying to:   %s\n\r", source, dest);
  3881. ***************
  3882. *** 142,148 ****
  3883.       if(folder_type == SPOOL) dprint(1, (debugfile,
  3884.            "     The mailbox lock file: %s\n", mk_lockname(cur_folder)));
  3885.       dprint(1, (debugfile,
  3886. !          "     The composition file : %s%s%d\n", temp_dir, temp_file, getpid()));
  3887.       dprint(1, (debugfile,
  3888.            "     The readmsg data file: %s/%s\n", home, readmsg_file));
  3889.   
  3890. --- 144,150 ----
  3891.       if(folder_type == SPOOL) dprint(1, (debugfile,
  3892.            "     The mailbox lock file: %s\n", mk_lockname(cur_folder)));
  3893.       dprint(1, (debugfile,
  3894. !          "     The composition file : %s%d%s\n", temp_dir, getpid(), temp_file));
  3895.       dprint(1, (debugfile,
  3896.            "     The readmsg data file: %s/%s\n", home, readmsg_file));
  3897.   
  3898. ***************
  3899. *** 151,161 ****
  3900.       if (hp_terminal)     softkeys_off();
  3901.   
  3902.       if (cursor_control)
  3903. !       MoveCursor(LINES, 0);
  3904.   
  3905.       PutLine0(LINES,0,
  3906.           "\nEmergency exit taken! All temp files intact!\n\n");
  3907.   
  3908.       exit(1);
  3909.   }
  3910.   rm_temps_exit()
  3911. --- 153,164 ----
  3912.       if (hp_terminal)     softkeys_off();
  3913.   
  3914.       if (cursor_control)
  3915. !       MoveCursor(LINES-1, 0);
  3916.   
  3917.       PutLine0(LINES,0,
  3918.           "\nEmergency exit taken! All temp files intact!\n\n");
  3919.   
  3920. +         ExitScreen();
  3921.       exit(1);
  3922.   }
  3923.   rm_temps_exit()
  3924. ***************
  3925. *** 167,175 ****
  3926.         Raw(OFF);
  3927.         if (cursor_control)  transmit_functions(OFF);
  3928.         if (hp_terminal)     softkeys_off();
  3929. !       sprintf(buffer,"%s%d",temp_file, getpid());  /* editor buffer */
  3930.         (void) unlink(buffer);
  3931.         if (folder_type == SPOOL) {
  3932.           (void) unlink(cur_tempfolder);
  3933.         }
  3934.         sprintf(buffer,"%s/%s", home, readmsg_file);  /* readmsg temp */
  3935. --- 170,180 ----
  3936.         Raw(OFF);
  3937.         if (cursor_control)  transmit_functions(OFF);
  3938.         if (hp_terminal)     softkeys_off();
  3939. !       sprintf(buffer,"%d%s", getpid(), temp_file);  /* editor buffer */
  3940.         (void) unlink(buffer);
  3941.         if (folder_type == SPOOL) {
  3942. +         if (mailfile)
  3943. +           fclose(mailfile);
  3944.           (void) unlink(cur_tempfolder);
  3945.         }
  3946.         sprintf(buffer,"%s/%s", home, readmsg_file);  /* readmsg temp */
  3947. ***************
  3948. *** 176,184 ****
  3949.         (void) unlink(buffer);
  3950.         unlock();                               /* remove lock file if any */
  3951.         if(!batch_only) {
  3952. !         MoveCursor(LINES,0);
  3953.           NewLine();
  3954.         }
  3955.         exit(1);
  3956.   }
  3957.   
  3958. --- 181,190 ----
  3959.         (void) unlink(buffer);
  3960.         unlock();                               /* remove lock file if any */
  3961.         if(!batch_only) {
  3962. !         MoveCursor(LINES-1,0);
  3963.           NewLine();
  3964.         }
  3965. +       ExitScreen();
  3966.         exit(1);
  3967.   }
  3968.   
  3969. ***************
  3970. *** 196,205 ****
  3971.       if (cursor_control)  transmit_functions(OFF);
  3972.       if (hp_terminal)     softkeys_off();
  3973.   
  3974. !     sprintf(buffer,"%s%s%d", temp_dir, temp_file, getpid());  /* editor buffer */
  3975.       (void) unlink(buffer);
  3976.   
  3977.       if (folder_type == SPOOL) {
  3978.         (void) unlink(cur_tempfolder);
  3979.       }
  3980.   
  3981. --- 202,213 ----
  3982.       if (cursor_control)  transmit_functions(OFF);
  3983.       if (hp_terminal)     softkeys_off();
  3984.   
  3985. !     sprintf(buffer,"%s%d%s", temp_dir, getpid(), temp_file);  /* editor buffer */
  3986.       (void) unlink(buffer);
  3987.   
  3988.       if (folder_type == SPOOL) {
  3989. +           if (mailfile)
  3990. +             fclose(mailfile);
  3991.         (void) unlink(cur_tempfolder);
  3992.       }
  3993.   
  3994. ***************
  3995. *** 209,218 ****
  3996.       unlock();                /* remove lock file if any */
  3997.   
  3998.       if(!batch_only) {
  3999. !       MoveCursor(LINES,0);
  4000.         NewLine();
  4001.       }
  4002.   
  4003.       exit(0);
  4004.   }
  4005.   
  4006. --- 217,227 ----
  4007.       unlock();                /* remove lock file if any */
  4008.   
  4009.       if(!batch_only) {
  4010. !       MoveCursor(LINES-1,0);
  4011.         NewLine();
  4012.       }
  4013.   
  4014. +     ExitScreen();
  4015.       exit(0);
  4016.   }
  4017.   
  4018. ***************
  4019. *** 230,241 ****
  4020.       if (cursor_control)  transmit_functions(OFF);
  4021.       if (hp_terminal)     softkeys_off();
  4022.   
  4023. !     sprintf(buffer,"%s%s%d", temp_dir, temp_file, getpid());  /* editor buffer */
  4024.       (void) unlink(buffer);
  4025.   
  4026. !     MoveCursor(LINES,0);
  4027.       NewLine();
  4028.   
  4029.       exit(0);
  4030.   }
  4031.   
  4032. --- 239,251 ----
  4033.       if (cursor_control)  transmit_functions(OFF);
  4034.       if (hp_terminal)     softkeys_off();
  4035.   
  4036. !     sprintf(buffer,"%s%d%s", temp_dir, getpid(), temp_file);  /* editor buffer */
  4037.       (void) unlink(buffer);
  4038.   
  4039. !     MoveCursor(LINES-1,0);
  4040.       NewLine();
  4041.   
  4042. +     ExitScreen();
  4043.       exit(0);
  4044.   }
  4045.   
  4046. ***************
  4047. *** 256,268 ****
  4048.       if (cursor_control)  transmit_functions(OFF);
  4049.       if (hp_terminal)     softkeys_off();
  4050.   
  4051. !     sprintf(buffer,"%s%s%d", temp_dir, temp_file, getpid());  /* editor buffer */
  4052.       (void) unlink(buffer);
  4053.   
  4054.       (void) unlink(cur_tempfolder);            /* temp mailbox */
  4055.   
  4056. !     MoveCursor(LINES,0);
  4057.       NewLine();
  4058.       exit(0);
  4059.   }
  4060.   #endif
  4061. --- 266,281 ----
  4062.       if (cursor_control)  transmit_functions(OFF);
  4063.       if (hp_terminal)     softkeys_off();
  4064.   
  4065. !     sprintf(buffer,"%s%d%s", temp_dir, getpid(), temp_file);  /* editor buffer */
  4066.       (void) unlink(buffer);
  4067.   
  4068. +         if (mailfile)
  4069. +           fclose(mailfile);
  4070.       (void) unlink(cur_tempfolder);            /* temp mailbox */
  4071.   
  4072. !     MoveCursor(LINES-1,0);
  4073.       NewLine();
  4074. +     ExitScreen();
  4075.       exit(0);
  4076.   }
  4077.   #endif
  4078. diff -cbr orig/src/validname.c new/src/validname.c
  4079. *** orig/src/validname.c    Sun Oct 04 14:37:12 1992
  4080. --- new/src/validname.c    Sat May 23 19:38:09 1992
  4081. ***************
  4082. *** 20,27 ****
  4083.    *
  4084.    ******************************************************************************/
  4085.   
  4086. - #include "defs.h"
  4087.   #include <stdio.h>
  4088.   
  4089.   #ifndef NOCHECK_VALIDNAME         /* Force a return of valid */
  4090. --- 20,25 ----
  4091. ***************
  4092. *** 32,37 ****
  4093. --- 30,37 ----
  4094.   # endif
  4095.   #endif
  4096.   
  4097. + #include "defs.h"
  4098.   int
  4099.   valid_name(name)
  4100.   char *name;
  4101. ***************
  4102. *** 53,59 ****
  4103.       if(getpwnam(name) != NULL)
  4104.         return(TRUE);
  4105.   
  4106. !     sprintf(filebuf,"%s/%s", mailhome, name);
  4107.       if (access(filebuf, ACCESS_EXISTS) == 0)
  4108.         return(TRUE);
  4109.   
  4110. --- 53,64 ----
  4111.       if(getpwnam(name) != NULL)
  4112.         return(TRUE);
  4113.   
  4114. ! #ifdef OS2
  4115. !     if (maildir)
  4116. !         sprintf(filebuf, "%s%s/newmail%s", mailhome, name, mailext);
  4117. !     else
  4118. ! #endif
  4119. !     sprintf(filebuf,"%s%s%s", mailhome, name, mailext);
  4120.       if (access(filebuf, ACCESS_EXISTS) == 0)
  4121.         return(TRUE);
  4122.   
  4123. diff -cbr orig/utils/answer.c new/utils/answer.c
  4124. *** orig/utils/answer.c    Sun Oct 04 14:37:12 1992
  4125. --- new/utils/answer.c    Sat Mar 28 17:55:24 1992
  4126. ***************
  4127. *** 32,44 ****
  4128.   #include <stdio.h>
  4129.   #include <fcntl.h>
  4130.   #include <ctype.h>
  4131.   
  4132.   #include "defs.h"            /* ELM system definitions      */
  4133.   
  4134.   #define  ELM        "elm"        /* where the elm program lives */
  4135.   
  4136. - #define  answer_temp_file    "/tmp/answer."
  4137.   static char ident[] = { WHAT_STRING };
  4138.   
  4139.   struct alias_rec user_hash_table  [MAX_UALIASES];
  4140. --- 32,43 ----
  4141.   #include <stdio.h>
  4142.   #include <fcntl.h>
  4143.   #include <ctype.h>
  4144. + #include <pwd.h>
  4145.   
  4146.   #include "defs.h"            /* ELM system definitions      */
  4147.   
  4148.   #define  ELM        "elm"        /* where the elm program lives */
  4149.   
  4150.   static char ident[] = { WHAT_STRING };
  4151.   
  4152.   struct alias_rec user_hash_table  [MAX_UALIASES];
  4153. ***************
  4154. *** 55,60 ****
  4155. --- 54,60 ----
  4156.       char  name[SLEN], user_name[SLEN];
  4157.       int   msgnum = 0, eof;
  4158.   
  4159. +         initpaths();
  4160.       read_alias_files();
  4161.   
  4162.       while (1) {
  4163. ***************
  4164. *** 64,70 ****
  4165.   
  4166.   prompt:   printf("\nMessage to: ");
  4167.         if (fgets(user_name, SLEN, stdin) == NULL) {
  4168. !         putchar('\n');
  4169.           exit(0);
  4170.         }
  4171.         if(user_name[0] == '\0')
  4172. --- 64,70 ----
  4173.   
  4174.   prompt:   printf("\nMessage to: ");
  4175.         if (fgets(user_name, SLEN, stdin) == NULL) {
  4176. !         putc('\n', stdout);
  4177.           exit(0);
  4178.         }
  4179.         if(user_name[0] == '\0')
  4180. ***************
  4181. *** 94,100 ****
  4182.           goto prompt;
  4183.         }
  4184.   
  4185. !       sprintf(tempfile, "%s%d", answer_temp_file, msgnum++);
  4186.   
  4187.         if ((fd = fopen(tempfile,"w")) == NULL)
  4188.           exit(printf("** Fatal Error: could not open %s to write\n",
  4189. --- 94,100 ----
  4190.           goto prompt;
  4191.         }
  4192.   
  4193. !       sprintf(tempfile, "%s%d.ans", tempdir, msgnum++);
  4194.   
  4195.         if ((fd = fopen(tempfile,"w")) == NULL)
  4196.           exit(printf("** Fatal Error: could not open %s to write\n",
  4197. ***************
  4198. *** 115,124 ****
  4199.         fclose(fd);
  4200.   
  4201.         sprintf(buffer,
  4202. !          "((%s -s \"While You Were Out\" %s ; %s %s) & ) < %s > /dev/null",
  4203. !          ELM, strip_parens(address), remove_cmd, tempfile, tempfile);
  4204.   
  4205.         system(buffer);
  4206.       }
  4207.   }
  4208.   
  4209. --- 115,125 ----
  4210.         fclose(fd);
  4211.   
  4212.         sprintf(buffer,
  4213. !          "%s -s \"While You Were Out\" %s <%s >nul",
  4214. !          ELM, strip_parens(address), tempfile);
  4215.   
  4216.         system(buffer);
  4217. +           unlink(tempfile);
  4218.       }
  4219.   }
  4220.   
  4221. ***************
  4222. *** 164,171 ****
  4223.   
  4224.       char fname[SLEN];
  4225.       int  hash;
  4226.   
  4227. !     sprintf(fname,  "%s/.elm/aliases.hash", getenv("HOME")); 
  4228.   
  4229.       if ((hash = open(fname, O_RDONLY)) == -1)
  4230.         exit(printf("** Fatal Error: Could not open %s!\n", fname));
  4231. --- 165,183 ----
  4232.   
  4233.       char fname[SLEN];
  4234.       int  hash;
  4235. +         char *getenv();
  4236. +         struct passwd *getpwuid();
  4237. +         struct passwd *pass;
  4238. +         char *homedir, *name;
  4239. +     name = getenv("LOGNAME");
  4240. +     if((pass = getpwnam(name ? name : "unknown")) == NULL) {
  4241. +       printf("You have no password entry!\n");
  4242. +       exit(1);
  4243. +     }
  4244. +     homedir = pass->pw_dir;
  4245.   
  4246. !     sprintf(fname,  "%s/%s", homedir, ALIAS_HASH);
  4247.   
  4248.       if ((hash = open(fname, O_RDONLY)) == -1)
  4249.         exit(printf("** Fatal Error: Could not open %s!\n", fname));
  4250. ***************
  4251. *** 173,179 ****
  4252.       read(hash, user_hash_table, sizeof user_hash_table);
  4253.       close(hash);
  4254.   
  4255. !     sprintf(fname,  "%s/.elm/aliases.data", getenv("HOME")); 
  4256.   
  4257.       if ((user_data = open(fname, O_RDONLY)) == -1)
  4258.         return;
  4259. --- 185,191 ----
  4260.       read(hash, user_hash_table, sizeof user_hash_table);
  4261.       close(hash);
  4262.   
  4263. !     sprintf(fname,  "%s/%s", homedir, ALIAS_DATA);
  4264.   
  4265.       if ((user_data = open(fname, O_RDONLY)) == -1)
  4266.         return;
  4267. ***************
  4268. *** 317,330 ****
  4269.           space = loc + length;
  4270.           while (buffer[space] != ' ' && space > loc + 50) space--;
  4271.           for (i=loc;i <= space;i++)
  4272. !           putchar(buffer[i]);
  4273. !         putchar('\n');
  4274.           loc = space;
  4275.         }
  4276.         else {
  4277.           for (i=loc, len = strlen(buffer);i < len;i++)
  4278. !           putchar(buffer[i]);
  4279. !         putchar('\n');
  4280.           loc = len;
  4281.         }
  4282.         length = 80;
  4283. --- 329,342 ----
  4284.           space = loc + length;
  4285.           while (buffer[space] != ' ' && space > loc + 50) space--;
  4286.           for (i=loc;i <= space;i++)
  4287. !           putc(buffer[i], stdout);
  4288. !         putc('\n', stdout);
  4289.           loc = space;
  4290.         }
  4291.         else {
  4292.           for (i=loc, len = strlen(buffer);i < len;i++)
  4293. !           putc(buffer[i], stdout);
  4294. !         putc('\n', stdout);
  4295.           loc = len;
  4296.         }
  4297.         length = 80;
  4298. diff -cbr orig/utils/arepdaem.c new/utils/arepdaem.c
  4299. *** orig/utils/arepdaem.c    Sun Oct 04 14:37:12 1992
  4300. --- new/utils/arepdaem.c    Sun Oct 04 14:16:10 1992
  4301. ***************
  4302. *** 83,97 ****
  4303.   
  4304.   static char ident[] = { WHAT_STRING };
  4305.   
  4306. ! #define arep_lock_file    "LCK..arep"
  4307.   
  4308. - #define autoreply_file    "/etc/autoreply.data"
  4309. - #define logfile        "/etc/autoreply.log"    /* first choice   */
  4310. - #define logfile2    "/tmp/autoreply.log"    /* second choice  */
  4311.   #define BEGINNING    0        /* see fseek(3S) for info */
  4312. ! #define SLEEP_TIME    3600        /* run once an hour       */
  4313.   #define MAX_PEOPLE    20        /* max number in program  */
  4314.   
  4315.   #define EXISTS        00        /* lock file exists??     */
  4316. --- 83,95 ----
  4317.   
  4318.   static char ident[] = { WHAT_STRING };
  4319.   
  4320. ! char     arep_lock_file[SLEN];  /* autoreply lock file  */
  4321. ! char     autoreply_file[SLEN];  /* autoreply data file  */
  4322. ! char     logfile[SLEN];         /* first choice   */
  4323. ! #define logfile2    ("/" AUTOREP_LOG)    /* second choice  */
  4324.   
  4325.   #define BEGINNING    0        /* see fseek(3S) for info */
  4326. ! #define SLEEP_TIME    1800 /* 3600        /* run once an hour       */
  4327.   #define MAX_PEOPLE    20        /* max number in program  */
  4328.   
  4329.   #define EXISTS        00        /* lock file exists??     */
  4330. ***************
  4331. *** 130,140 ****
  4332. --- 128,146 ----
  4333.       int  person, data_changed;
  4334.       time_t time;
  4335.   
  4336. +         initpaths();
  4337. +         sprintf(autoreply_file, "%s/%s", elmhome, AUTOREP_FILE);
  4338. +         sprintf(logfile,        "%s/%s", elmhome, AUTOREP_LOG);
  4339. +         sprintf(arep_lock_file, "%s/%s", elmhome, AUTOREP_LOCK);
  4340. + #ifndef OS2
  4341.       if (fork()) exit(0);
  4342. + #endif
  4343.   
  4344.       if (! lock())
  4345.         exit(0);    /* already running! */
  4346.   
  4347. +     signal(SIGINT, term_signal);     /* Terminate signal         */
  4348.       signal(SIGTERM, term_signal);     /* Terminate signal         */
  4349.   
  4350.   /*
  4351. ***************
  4352. *** 143,150 ****
  4353. --- 149,158 ----
  4354.    *    The idea is to disassociate from the terminal to
  4355.    *    prevent signals.
  4356.    */
  4357. + #ifndef OS2
  4358.       person = getpid();
  4359.       setpgrp(person, person);
  4360. + #endif
  4361.   
  4362.       while (1) {
  4363.   
  4364. ***************
  4365. *** 210,216 ****
  4366.       if ((file = fopen(autoreply_file,"r")) == NULL) {
  4367.         log("No-one is using autoreply...");
  4368.       } else {
  4369. !       while (fscanf(file, "%s %s %dl", username, replyfile, &size) != EOF) {
  4370.           /* check to see if this person is already in the list */
  4371.           if ((person = in_list(username)) != -1) {
  4372.             reply_table[person].in_list = 1;
  4373. --- 218,224 ----
  4374.       if ((file = fopen(autoreply_file,"r")) == NULL) {
  4375.         log("No-one is using autoreply...");
  4376.       } else {
  4377. !       while (fscanf(file, "%s %s %ld", username, replyfile, &size) != EOF) {
  4378.           /* check to see if this person is already in the list */
  4379.           if ((person = in_list(username)) != -1) {
  4380.             reply_table[person].in_list = 1;
  4381. ***************
  4382. *** 307,313 ****
  4383.   
  4384.       log("New mail for %s", reply_table[person].username);
  4385.   
  4386. !         if ((mailfile = fopen(reply_table[person].mailfile,"r")) == NULL)
  4387.              return(log("can't open mailfile for user %s",
  4388.               reply_table[person].username));
  4389.   
  4390. --- 315,321 ----
  4391.   
  4392.       log("New mail for %s", reply_table[person].username);
  4393.   
  4394. !         if ((mailfile = fopen(reply_table[person].mailfile,"rb")) == NULL)
  4395.              return(log("can't open mailfile for user %s",
  4396.               reply_table[person].username));
  4397.   
  4398. ***************
  4399. *** 347,352 ****
  4400. --- 355,362 ----
  4401.         if (fgets(buffer, SLEN, file) == NULL)
  4402.       return(-1);
  4403.   
  4404. +       fixline(buffer);
  4405.         if (first_word(buffer, "From ")) {
  4406.       in_header++;
  4407.       sscanf(buffer, "%*s %s", hold_return);
  4408. ***************
  4409. *** 473,479 ****
  4410.           is to check to see if new mail has arrived....  **/
  4411.   
  4412.       int ok = 1;
  4413. -     extern int errno;    /* system error number! */
  4414.       struct stat buffer;
  4415.   
  4416.       if (stat(name, &buffer) != 0)
  4417. --- 483,488 ----
  4418. ***************
  4419. *** 495,501 ****
  4420.           This is to check to see if autoreply has changed....  **/
  4421.   
  4422.       int ok = 1;
  4423. -     extern int errno;    /* system error number! */
  4424.       struct stat buffer;
  4425.   
  4426.       if (stat(name, &buffer) != 0)
  4427. --- 504,509 ----
  4428. ***************
  4429. *** 517,525 ****
  4430.   
  4431.       char buffer[VERY_LONG_STRING];
  4432.   
  4433. !     sprintf(buffer, "%s/fastmail -f '%s [autoreply]' -s '%s' %s %s",
  4434. !         BIN, reply_table[person].username,
  4435. !             subject, filename, to);
  4436.   
  4437.       system(buffer);
  4438.   }
  4439. --- 525,532 ----
  4440.   
  4441.       char buffer[VERY_LONG_STRING];
  4442.   
  4443. !     sprintf(buffer, "fastmail -f \"%s [autoreply]\" -s \"%s\" %s %s",
  4444. !         reply_table[person].username, subject, filename, to);
  4445.   
  4446.       system(buffer);
  4447.   }
  4448. ***************
  4449. *** 536,542 ****
  4450.       long      clock;
  4451.   #ifndef    _POSIX_SOURCE
  4452.       struct tm *localtime();
  4453. !     long      time();
  4454.   #endif
  4455.       char      buffer[SLEN];
  4456.   
  4457. --- 543,549 ----
  4458.       long      clock;
  4459.   #ifndef    _POSIX_SOURCE
  4460.       struct tm *localtime();
  4461. !     time_t time();
  4462.   #endif
  4463.       char      buffer[SLEN];
  4464.   
  4465. ***************
  4466. *** 608,616 ****
  4467.       char lock_name[SLEN];        /* name of lock file  */
  4468.       char pid_buffer[SHORT];
  4469.       int pid, create_fd;
  4470. -     extern int errno;    /* system error number! */
  4471.   
  4472. !     sprintf(lock_name, "%s/%s", LOCK_DIR, arep_lock_file);
  4473.   #ifdef PIDCHECK
  4474.         /** first, try to read the lock file, and if possible, check the pid.
  4475.         If we can validate that the pid is no longer active, then remove
  4476. --- 615,622 ----
  4477.       char lock_name[SLEN];        /* name of lock file  */
  4478.       char pid_buffer[SHORT];
  4479.       int pid, create_fd;
  4480.   
  4481. !     strcpy(lock_name, arep_lock_file);
  4482.   #ifdef PIDCHECK
  4483.         /** first, try to read the lock file, and if possible, check the pid.
  4484.         If we can validate that the pid is no longer active, then remove
  4485. ***************
  4486. *** 655,660 ****
  4487. --- 661,667 ----
  4488.   {
  4489.       /** remove lock file if it's there! **/
  4490.   
  4491. +         chmod(arep_lock_file, 0666);
  4492.       (void) unlink(arep_lock_file);
  4493.   }
  4494.   
  4495. diff -cbr orig/utils/autoreply.c new/utils/autoreply.c
  4496. *** orig/utils/autoreply.c    Sun Oct 04 14:37:13 1992
  4497. --- new/utils/autoreply.c    Sun Mar 29 10:06:00 1992
  4498. ***************
  4499. *** 46,55 ****
  4500.   
  4501.   static char ident[] = { WHAT_STRING };
  4502.   
  4503. ! #define  tempdir    "/tmp/arep"        /* file prefix          */
  4504. ! #define  autoreply_file    "/etc/autoreply.data"   /* autoreply data file  */
  4505.   
  4506. - extern   int errno;                /* system error code    */
  4507.   char     username[NLEN];    /* login name of user   */
  4508.   
  4509.   main(argc, argv)
  4510. --- 46,53 ----
  4511.   
  4512.   static char ident[] = { WHAT_STRING };
  4513.   
  4514. ! char     autoreply_file[SLEN];    /* autoreply data file  */
  4515.   
  4516.   char     username[NLEN];    /* login name of user   */
  4517.   
  4518.   main(argc, argv)
  4519. ***************
  4520. *** 63,70 ****
  4521.       struct passwd *getpwuid();
  4522.   #endif
  4523.   
  4524.       if (argc > 2) {
  4525. !       printf("Usage: %s <filename>\tto start autoreply,\n", argv[0]);
  4526.         printf("       %s off\t\tto turn off autoreply\n", argv[0]);
  4527.         printf("   or  %s    \t\tto check current status\n", argv[0]);
  4528.         exit(1);
  4529. --- 61,71 ----
  4530.       struct passwd *getpwuid();
  4531.   #endif
  4532.   
  4533. +         initpaths();
  4534. +         sprintf(autoreply_file, "%s/%s", elmhome, AUTOREP_FILE);
  4535.       if (argc > 2) {
  4536. !       printf("\nUsage: %s <filename>\tto start autoreply,\n", argv[0]);
  4537.         printf("       %s off\t\tto turn off autoreply\n", argv[0]);
  4538.         printf("   or  %s    \t\tto check current status\n", argv[0]);
  4539.         exit(1);
  4540. ***************
  4541. *** 86,99 ****
  4542.         remove_user((argc == 1));
  4543.       else {
  4544.         strcpy(filename, argv[1]);
  4545.         if (access(filename,READ_ACCESS) != 0) {
  4546.           printf("Error: Can't read file '%s'\n", filename);
  4547.           exit(1);
  4548.         }
  4549.   
  4550. -       if (filename[0] != '/') /* prefix home directory */
  4551. -         sprintf(filename,"%s/%s", getenv("HOME"), argv[1]);
  4552.         add_user(filename);
  4553.       }
  4554.   
  4555. --- 87,101 ----
  4556.         remove_user((argc == 1));
  4557.       else {
  4558.         strcpy(filename, argv[1]);
  4559. +       if (filename[0] != '/') /* prefix home directory */
  4560. +         sprintf(filename,"%s/%s", pass->pw_dir, argv[1]);
  4561.         if (access(filename,READ_ACCESS) != 0) {
  4562.           printf("Error: Can't read file '%s'\n", filename);
  4563.           exit(1);
  4564.         }
  4565.   
  4566.         add_user(filename);
  4567.       }
  4568.   
  4569. ***************
  4570. *** 113,119 ****
  4571.       long  filesize, bytes();
  4572.   
  4573.       if (! stat_only) {
  4574. !       sprintf(tempfile, "%s.%06d", tempdir, getpid());
  4575.   
  4576.         if ((temp = fopen(tempfile, "w")) == NULL) {
  4577.           printf("Error: couldn't open tempfile '%s'.  Not removed\n",
  4578. --- 115,121 ----
  4579.       long  filesize, bytes();
  4580.   
  4581.       if (! stat_only) {
  4582. !       sprintf(tempfile, "%s%d.ar", tempdir, getpid());
  4583.   
  4584.         if ((temp = fopen(tempfile, "w")) == NULL) {
  4585.           printf("Error: couldn't open tempfile '%s'.  Not removed\n",
  4586. ***************
  4587. *** 124,133 ****
  4588.   
  4589.       if ((repfile = fopen(autoreply_file, "r")) == NULL) {
  4590.         if (stat_only) {
  4591. !         printf("You're not currently autoreplying to mail.\n");
  4592.           exit(0);
  4593.         }
  4594. !       printf("No-one is autoreplying to their mail!\n");
  4595.         exit(0);
  4596.       }
  4597.   
  4598. --- 126,135 ----
  4599.   
  4600.       if ((repfile = fopen(autoreply_file, "r")) == NULL) {
  4601.         if (stat_only) {
  4602. !         printf("\nYou're not currently autoreplying to mail.\n");
  4603.           exit(0);
  4604.         }
  4605. !       printf("\nNo-one is autoreplying to their mail!\n");
  4606.         exit(0);
  4607.       }
  4608.   
  4609. ***************
  4610. *** 143,159 ****
  4611.         }
  4612.         else {
  4613.           if (stat_only) {
  4614. !           printf("You're currently autoreplying to mail with the file %s\n",              filename); 
  4615.             exit(0);
  4616.           }
  4617.           found++;
  4618.         }
  4619.   
  4620.         fclose(temp);
  4621.       fclose(repfile);
  4622.   
  4623.       if (! found) {
  4624. !       printf("You're not currently autoreplying to mail%s\n",
  4625.             stat_only? "." : "!");
  4626.         if (! stat_only)
  4627.           unlink(tempfile);
  4628. --- 145,163 ----
  4629.         }
  4630.         else {
  4631.           if (stat_only) {
  4632. !           printf("\nYou're currently autoreplying to mail with the file %s\n",              filename);
  4633.             exit(0);
  4634.           }
  4635.           found++;
  4636.         }
  4637.   
  4638. +     if (! stat_only)
  4639.         fclose(temp);
  4640.       fclose(repfile);
  4641.   
  4642.       if (! found) {
  4643. !       printf("\nYou're not currently autoreplying to mail%s\n",
  4644.             stat_only? "." : "!");
  4645.         if (! stat_only)
  4646.           unlink(tempfile);
  4647. ***************
  4648. *** 191,200 ****
  4649.       unlink(tempfile);
  4650.   
  4651.       if (found > 1)
  4652. !       printf("Warning: your username appeared %d times!!   Removed all\n", 
  4653.             found);
  4654.       else
  4655. !       printf("You've been removed from the autoreply table.\n");
  4656.   }
  4657.   
  4658.   add_user(filename)
  4659. --- 195,204 ----
  4660.       unlink(tempfile);
  4661.   
  4662.       if (found > 1)
  4663. !       printf("\nWarning: your username appeared %d times!!   Removed all\n",
  4664.             found);
  4665.       else
  4666. !       printf("\nYou've been removed from the autoreply table.\n");
  4667.   }
  4668.   
  4669.   add_user(filename)
  4670. ***************
  4671. *** 217,223 ****
  4672.   
  4673.       fclose(repfile);
  4674.   
  4675. !     printf("You've been added to the autoreply system.\n");
  4676.   }
  4677.   
  4678.   
  4679. --- 221,227 ----
  4680.   
  4681.       fclose(repfile);
  4682.   
  4683. !     printf("\nYou've been added to the autoreply system.\n");
  4684.   }
  4685.   
  4686.   
  4687. ***************
  4688. *** 229,235 ****
  4689.           is to check to see if new mail has arrived....  **/
  4690.   
  4691.       int ok = 1;
  4692. -     extern int errno;    /* system error number! */
  4693.       struct stat buffer;
  4694.   
  4695.       if (stat(name, &buffer) != 0)
  4696. --- 233,238 ----
  4697. diff -cbr orig/utils/expand.c new/utils/expand.c
  4698. *** orig/utils/expand.c    Sun Oct 04 14:37:13 1992
  4699. --- new/utils/expand.c    Sun May 03 16:19:14 1992
  4700. ***************
  4701. *** 28,36 ****
  4702. --- 28,39 ----
  4703.   **/
  4704.   
  4705.   #include <stdio.h>
  4706. + #include <pwd.h>
  4707.   #include "defs.h"
  4708.   
  4709.   char *expand_define();
  4710. + static struct passwd *pass;
  4711. + static char *home;
  4712.   
  4713.   int
  4714.   expand(filename)
  4715. ***************
  4716. *** 46,61 ****
  4717.       **/
  4718.   
  4719.       FILE *rcfile;
  4720. !     char  buffer[SLEN], *expanded_dir, *home, *getenv(), *bufptr;
  4721.       int   foundit = 0;
  4722.   
  4723.       bufptr = (char *) buffer;        /* same address */
  4724.   
  4725. !     if ((home = getenv("HOME")) == NULL) {
  4726. !       printf(
  4727. !          "Can't expand environment variable $HOME to find .elmrc file!\n");
  4728. !       return(NO);
  4729.       }
  4730.   
  4731.       sprintf(buffer, "%s/%s", home, elmrcfile);
  4732.   
  4733. --- 49,64 ----
  4734.       **/
  4735.   
  4736.       FILE *rcfile;
  4737. !     char  buffer[SLEN], *expanded_dir, *bufptr;
  4738.       int   foundit = 0;
  4739.   
  4740.       bufptr = (char *) buffer;        /* same address */
  4741.   
  4742. !     if((pass = getpwuid(getuid())) == NULL) {
  4743. !         printf("You have no password entry!\n");
  4744. !         exit(1);
  4745.       }
  4746. +     home = pass->pw_dir;
  4747.   
  4748.       sprintf(buffer, "%s/%s", home, elmrcfile);
  4749.   
  4750. ***************
  4751. *** 122,128 ****
  4752.              *value;              /* char pointer for munging */
  4753.   
  4754.       if (*maildir == '~')
  4755. !       sprintf(buffer, "%s%s", getenv("HOME"), ++maildir);
  4756.       else if (*maildir == '$') {     /* shell variable */
  4757.   
  4758.         /** break it into a single word - the variable name **/
  4759. --- 125,131 ----
  4760.              *value;              /* char pointer for munging */
  4761.   
  4762.       if (*maildir == '~')
  4763. !       sprintf(buffer, "%s%s", home, ++maildir);
  4764.       else if (*maildir == '$') {     /* shell variable */
  4765.   
  4766.         /** break it into a single word - the variable name **/
  4767. diff -cbr orig/utils/fastmail.c new/utils/fastmail.c
  4768. *** orig/utils/fastmail.c    Sun Oct 04 14:37:13 1992
  4769. --- new/utils/fastmail.c    Sun Oct 04 14:02:20 1992
  4770. ***************
  4771. *** 75,84 ****
  4772.   
  4773.   static char ident[] = { WHAT_STRING };
  4774.   
  4775. - #define  binrmail    "/bin/rmail"
  4776. - #define  temphome    "/tmp/fastmail."
  4777.   char *arpa_dayname[] = { "Sun", "Mon", "Tue", "Wed", "Thu",
  4778.             "Fri", "Sat", "" };
  4779.   
  4780. --- 75,80 ----
  4781. ***************
  4782. *** 90,97 ****
  4783. --- 86,95 ----
  4784.   #if defined(BSD) && !defined(_POSIX_SOURCE)
  4785.     char *timezone();
  4786.   #else
  4787. + #ifndef OS2
  4788.     extern char *tzname[];
  4789.   #endif
  4790. + #endif
  4791.   
  4792.   main(argc, argv)
  4793.   int argc;
  4794. ***************
  4795. *** 100,113 ****
  4796.   
  4797.       extern char *optarg;
  4798.       extern int optind;
  4799. !     FILE *tempfile;
  4800.       char hostname[NLEN], username[NLEN], from_string[SLEN], subject[SLEN];
  4801.       char filename[SLEN], tempfilename[SLEN], command_buffer[256];
  4802.       char replyto[SLEN], cc_list[SLEN], bcc_list[SLEN], to_list[SLEN];
  4803. !     char from_addr[SLEN];
  4804.       char *tmplogname;
  4805.       int  c, sendmail_available, debug = 0;
  4806.   
  4807.       from_string[0] = '\0';
  4808.       subject[0] = '\0';
  4809.       replyto[0] = '\0';
  4810. --- 98,113 ----
  4811.   
  4812.       extern char *optarg;
  4813.       extern int optind;
  4814. !     FILE *tempfile, *mailpipe;
  4815.       char hostname[NLEN], username[NLEN], from_string[SLEN], subject[SLEN];
  4816.       char filename[SLEN], tempfilename[SLEN], command_buffer[256];
  4817.       char replyto[SLEN], cc_list[SLEN], bcc_list[SLEN], to_list[SLEN];
  4818. !     char from_addr[SLEN], buffer[SLEN];
  4819.       char *tmplogname;
  4820.       int  c, sendmail_available, debug = 0;
  4821.   
  4822. +         initpaths();
  4823.       from_string[0] = '\0';
  4824.       subject[0] = '\0';
  4825.       replyto[0] = '\0';
  4826. ***************
  4827. *** 126,174 ****
  4828.           case 'r' : strcpy(replyto, optarg);        break;
  4829.           case 's' : strcpy(subject, optarg);        break;
  4830.           case '?' :
  4831. !           fprintf(stderr,"Usage: fastmail {args} filename address(es)\n");
  4832. !           fprintf(stderr, "   where {args} can be;\n");
  4833. !           fprintf(stderr,"\t-b bcc-list\n\t-c cc-list\n\t-d\n");
  4834. !           fprintf(stderr,"\t-f from-name\n\t-F from-addr\n");
  4835. !           fprintf(stderr, "\t-r reply-to\n\t-s subject\n\n");
  4836. !           exit(1);
  4837.          }
  4838.       }
  4839.   
  4840. !     if (optind >= argc) {
  4841. !       fprintf(stderr,"Usage: fastmail {args} filename address(es)\n");
  4842. !       fprintf(stderr, "   where {args} can be;\n");
  4843. !       fprintf(stderr,"\t-b bcc-list\n\t-c cc-list\n\t-d\n\t-f from-name\n");
  4844. !       fprintf(stderr,"\t-F from-addr\n");
  4845. !       fprintf(stderr, "\t-r reply-to\n\t-s subject\n\n");
  4846. !       exit(1);
  4847. !     }
  4848.   
  4849.       strcpy(filename, argv[optind++]);
  4850.   
  4851. !     if (optind >= argc) {
  4852. !       fprintf(stderr,"Usage: fastmail {args} filename address(es)\n");
  4853. !       fprintf(stderr, "   where {args} can be;\n");
  4854. !       fprintf(stderr,"\t-b bcc-list\n\t-c cc-list\n\t-d\n\t-f from-name\n");
  4855. !       fprintf(stderr,"\t-F from-addr\n");
  4856. !       fprintf(stderr,"\t-r reply-to\n\t-s subject\n\n");
  4857. !       exit(1);
  4858. !     }
  4859.   
  4860.   #ifdef HOSTCOMPILED
  4861.       strncpy(hostname, HOSTNAME, sizeof(hostname));
  4862.   #else
  4863.       gethostname(hostname, sizeof(hostname));
  4864.   #endif
  4865.   
  4866. !     tmplogname = getlogin();
  4867.       if (tmplogname != NULL)
  4868.         strcpy(username, tmplogname);
  4869.       else
  4870.         username[0] = '\0';
  4871.   
  4872.       if (strlen(username) == 0)
  4873.         cuserid(username);
  4874.   
  4875.       if (access(filename, READ_ACCESS) == -1) {
  4876.         fprintf(stderr, "Error: can't find file %s!\n", filename);
  4877. --- 126,161 ----
  4878.           case 'r' : strcpy(replyto, optarg);        break;
  4879.           case 's' : strcpy(subject, optarg);        break;
  4880.           case '?' :
  4881. !           usage();
  4882.          }
  4883.       }
  4884.   
  4885. !     if (optind >= argc)
  4886. !       usage();
  4887.   
  4888.       strcpy(filename, argv[optind++]);
  4889.   
  4890. !     if (optind >= argc)
  4891. !           usage();
  4892.   
  4893.   #ifdef HOSTCOMPILED
  4894.       strncpy(hostname, HOSTNAME, sizeof(hostname));
  4895.   #else
  4896.       gethostname(hostname, sizeof(hostname));
  4897. +     gethostdomain(buffer, sizeof(buffer));
  4898. +         strcat(hostname, buffer);
  4899.   #endif
  4900.   
  4901. !     tmplogname = getenv("LOGNAME");
  4902.       if (tmplogname != NULL)
  4903.         strcpy(username, tmplogname);
  4904.       else
  4905.         username[0] = '\0';
  4906.   
  4907. + #ifndef OS2
  4908.       if (strlen(username) == 0)
  4909.         cuserid(username);
  4910. + #endif
  4911.   
  4912.       if (access(filename, READ_ACCESS) == -1) {
  4913.         fprintf(stderr, "Error: can't find file %s!\n", filename);
  4914. ***************
  4915. *** 175,181 ****
  4916.         exit(1);
  4917.       }
  4918.   
  4919. !     sprintf(tempfilename, "%s%d", temphome, getpid());
  4920.   
  4921.       if ((tempfile = fopen(tempfilename, "w")) == NULL) {
  4922.         fprintf(stderr, "Couldn't open temp file %s\n", tempfilename);
  4923. --- 162,168 ----
  4924.         exit(1);
  4925.       }
  4926.   
  4927. !     sprintf(tempfilename, "%s%d.fm", tempdir, getpid());
  4928.   
  4929.       if ((tempfile = fopen(tempfilename, "w")) == NULL) {
  4930.         fprintf(stderr, "Couldn't open temp file %s\n", tempfilename);
  4931. ***************
  4932. *** 203,215 ****
  4933.         if (strlen(from_addr) > 0)
  4934.             fprintf(tempfile, "From: %s (%s)\n", from_addr, from_string);
  4935.         else
  4936. !           fprintf(tempfile, "From: %s!%s (%s)\n", hostname, username, 
  4937.                 from_string);
  4938.       else
  4939.         if (strlen(from_addr) > 0)
  4940.           fprintf(tempfile, "From: %s\n", from_addr);
  4941.         else
  4942. !         fprintf(tempfile, "From: %s!%s\n", hostname, username);
  4943.   
  4944.       fprintf(tempfile, "Date: %s\n", get_arpa_date());
  4945.   
  4946. --- 190,202 ----
  4947.         if (strlen(from_addr) > 0)
  4948.             fprintf(tempfile, "From: %s (%s)\n", from_addr, from_string);
  4949.         else
  4950. !           fprintf(tempfile, "From: %s@%s (%s)\n", username, hostname,
  4951.                 from_string);
  4952.       else
  4953.         if (strlen(from_addr) > 0)
  4954.           fprintf(tempfile, "From: %s\n", from_addr);
  4955.         else
  4956. !         fprintf(tempfile, "From: %s@%s\n", username, hostname);
  4957.   
  4958.       fprintf(tempfile, "Date: %s\n", get_arpa_date());
  4959.   
  4960. ***************
  4961. *** 243,257 ****
  4962. --- 230,261 ----
  4963.               (strlen(bcc_list) > 0 ? " ":""), bcc_list,
  4964.               sendmail_available? "sendmail" : "rmail");
  4965.   
  4966. + #ifdef OS2
  4967. +     sprintf(command_buffer, "%s -t", mailer);
  4968. + #else
  4969.       sprintf(command_buffer, "cat %s %s | %s %s %s %s",
  4970.           tempfilename, filename,
  4971.               sendmail_available? sendmail : mailer,
  4972.           to_list, cc_list, bcc_list);
  4973. + #endif
  4974.   
  4975.       if (debug)
  4976.         printf("%s\n", command_buffer);
  4977.   
  4978. + #ifdef OS2
  4979. +         mailpipe = popen(command_buffer, "w");
  4980. +     tempfile = fopen(tempfilename, "r");
  4981. +         while ( fgets(buffer, sizeof(buffer), tempfile) != NULL )
  4982. +           fputs(buffer, mailpipe);
  4983. +         fclose(tempfile);
  4984. +     tempfile = fopen(filename, "r");
  4985. +         while ( fgets(buffer, sizeof(buffer), tempfile) != NULL )
  4986. +           fputs(buffer, mailpipe);
  4987. +         fclose(tempfile);
  4988. +         pclose(mailpipe);
  4989. + #else
  4990.       c = system(command_buffer);
  4991. + #endif
  4992.   
  4993.       unlink(tempfilename);
  4994.   
  4995. ***************
  4996. *** 259,264 ****
  4997. --- 263,283 ----
  4998.   }
  4999.   
  5000.   
  5001. + usage()
  5002. + {
  5003. +   printf("\nUsage: fastmail {args} filename address(es)\n");
  5004. +   printf( "\nwhere {args} can be:\n\n");
  5005. +   printf("\t-b bcc-list       addresses to send blind-carbon copies to\n");
  5006. +   printf("\t-c cc-list        addresses to send carbon copies to\n");
  5007. +   printf("\t-d                debug\n");
  5008. +   printf("\t-f from-name      sender's full name\n");
  5009. +   printf("\t-F from-addr      sender's mail address\n");
  5010. +   printf("\t-r reply-to       reply-to mail address\n");
  5011. +   printf("\t-s subject        subject of the message\n");
  5012. +   exit(1);
  5013. + }
  5014.   char *get_arpa_date()
  5015.   {
  5016.       /** returns an ARPA standard date.  The format for the date
  5017. ***************
  5018. *** 285,291 ****
  5019.       struct  timezone time_zone;
  5020.   #  endif
  5021.   #else
  5022. !     long time();
  5023.   #endif
  5024.   
  5025.   #ifdef BSD
  5026. --- 304,310 ----
  5027.       struct  timezone time_zone;
  5028.   #  endif
  5029.   #else
  5030. !     time_t time();
  5031.   #endif
  5032.   
  5033.   #ifdef BSD
  5034. diff -cbr orig/utils/from.c new/utils/from.c
  5035. *** orig/utils/from.c    Sun Oct 04 14:37:14 1992
  5036. --- new/utils/from.c    Sun Mar 22 11:38:16 1992
  5037. ***************
  5038. *** 56,61 ****
  5039. --- 56,63 ----
  5040.   #endif
  5041.       extern int optind;
  5042.   
  5043. +         initpaths();
  5044.       while ((c = getopt(argc, argv, "nv")) != EOF)
  5045.         switch (c) {
  5046.           case (int)'n': number++;        break;
  5047. ***************
  5048. *** 65,70 ****
  5049. --- 67,78 ----
  5050.                          exit(1);
  5051.         }
  5052.   
  5053. +     if((pass = getpwuid(getuid())) == NULL) {
  5054. +       printf("You have no password entry!");
  5055. +       exit(1);
  5056. +     }
  5057. +     strcpy(username,pass->pw_name);
  5058.       infile[0] = '\0';
  5059.       if (optind == argc) {
  5060.       /*
  5061. ***************
  5062. *** 71,95 ****
  5063.        *    determine mail file from environment variable if found,
  5064.        *    else use password entry
  5065.        */
  5066. -       if ((cp = getenv("MAIL")) == NULL) {
  5067. -         if((pass = getpwuid(getuid())) == NULL) {
  5068. -           printf("You have no password entry!");
  5069. -           exit(1);
  5070. -         }
  5071. -         sprintf(infile,"%s%s",mailhome, pass->pw_name);
  5072. -       }
  5073. -       else
  5074. -         strcpy(infile, cp);
  5075.         optind -= 1;    /* ensure one pass through loop */
  5076. !     }
  5077. ! #ifdef MMDF
  5078. !     if((pass = getpwuid(getuid())) == NULL) {
  5079. !       printf("You have no password entry!");
  5080. !       exit(1);
  5081.       }
  5082. -     strcpy(username,pass->pw_name);
  5083. - #endif /* MMDF */
  5084.   
  5085.       multiple_files = (argc - optind > 1);
  5086.   
  5087. --- 79,90 ----
  5088.        *    determine mail file from environment variable if found,
  5089.        *    else use password entry
  5090.        */
  5091.         optind -= 1;    /* ensure one pass through loop */
  5092. !       if ((cp = getenv("MAIL")) == NULL)
  5093. !         strcpy(infile, argv[optind] = username);
  5094. !       else
  5095. !         strcpy(infile, argv[optind] = cp);
  5096.       }
  5097.   
  5098.       multiple_files = (argc - optind > 1);
  5099.   
  5100. ***************
  5101. *** 111,119 ****
  5102.         }
  5103.   
  5104.         if ((mailfile = fopen(infile,"r")) == NULL) {
  5105. -         if (optind+1 == argc)
  5106. -           printf("No mail.\n");
  5107. -         else {
  5108.             if (infile[0] == '/')
  5109.               printf("Couldn't open folder \"%s\".\n", infile);
  5110.             else {
  5111. --- 106,111 ----
  5112. ***************
  5113. *** 122,138 ****
  5114.                 printf("Couldn't open folders \"%s\" or \"%s\".\n",
  5115.                argv[optind], infile);
  5116.               else {
  5117. !           if (read_headers()==0)
  5118. !                 printf("No messages in that folder!\n");
  5119.                 fclose(mailfile);
  5120.           }
  5121.             }
  5122. -         }
  5123.         } else {
  5124. !         if (read_headers(optind+1 == argc)==0)
  5125. !           if (optind+1 == argc)
  5126. !             printf("No mail\n");
  5127. !           else
  5128.             printf("No messages in that folder!\n");
  5129.           fclose(mailfile);
  5130.         }
  5131. --- 114,126 ----
  5132.                 printf("Couldn't open folders \"%s\" or \"%s\".\n",
  5133.                argv[optind], infile);
  5134.               else {
  5135. !           if (read_headers(1)==0)
  5136. !                 printf("No mail.\n");
  5137.                 fclose(mailfile);
  5138.           }
  5139.             }
  5140.         } else {
  5141. !         if (read_headers(0)==0)
  5142.             printf("No messages in that folder!\n");
  5143.           fclose(mailfile);
  5144.         }
  5145. ***************
  5146. *** 164,176 ****
  5147.         }
  5148.   
  5149.   #ifdef MMDF
  5150. !           if (strcmp(buffer, MSG_SEPERATOR) == 0) {
  5151. !         newheader = !newheader;
  5152. !         if (newheader) {
  5153.           subject[0] = '\0';
  5154.           in_header = 1;
  5155.         }
  5156. -       }
  5157.   #else
  5158.         if (first_word(buffer,"From ")
  5159.          && real_from(buffer, from_whom)) {
  5160. --- 152,163 ----
  5161.         }
  5162.   
  5163.   #ifdef MMDF
  5164. !           if (strcmp(buffer, MSG_SEPERATOR) == 0 || !newheader &&
  5165. !             first_word(buffer,"From ") && real_from(buffer, from_whom)) {
  5166. !         newheader = 1;
  5167.           subject[0] = '\0';
  5168.           in_header = 1;
  5169.         }
  5170.   #else
  5171.         if (first_word(buffer,"From ")
  5172.          && real_from(buffer, from_whom)) {
  5173. ***************
  5174. *** 180,185 ****
  5175. --- 167,173 ----
  5176.   #endif /* MMDF */
  5177.         else if (in_header) {
  5178.   #ifdef MMDF
  5179. +             newheader = 0;
  5180.           if (first_word(buffer,"From "))
  5181.             real_from(buffer, from_whom);
  5182.   #endif /* MMDF */
  5183. diff -cbr orig/utils/listalias.c new/utils/listalias.c
  5184. *** orig/utils/listalias.c    Sun Oct 04 14:37:14 1992
  5185. --- new/utils/listalias.c    Sun Oct 04 14:21:19 1992
  5186. ***************
  5187. *** 27,35 ****
  5188.   
  5189.   #include <stdio.h>
  5190.   #include <fcntl.h>
  5191.   
  5192.   #include "defs.h"
  5193. - #include "sysdefs.h"
  5194.   
  5195.   #ifdef BSD
  5196.     FILE *popen();
  5197. --- 27,35 ----
  5198.   
  5199.   #include <stdio.h>
  5200.   #include <fcntl.h>
  5201. + #include <pwd.h>
  5202.   
  5203.   #include "defs.h"
  5204.   
  5205.   #ifdef BSD
  5206.     FILE *popen();
  5207. ***************
  5208. *** 36,41 ****
  5209. --- 36,44 ----
  5210.   #endif
  5211.   
  5212.   char *getenv();
  5213. + struct passwd *getpwuid();
  5214. + struct passwd *pass;
  5215. + char home[SLEN];        /* the users home directory  */
  5216.   
  5217.   main(argc, argv)
  5218.   int argc;
  5219. ***************
  5220. *** 45,61 ****
  5221.       struct alias_rec hash_record;
  5222.       int hashfile, count = 0;
  5223.       char buffer[SLEN], fd_hash[SLEN],
  5224. !          fd_data[SLEN], *home;
  5225.   
  5226.       if (argc > 2) {
  5227.         printf("Usage: listalias <optional-regular-expression>\n");
  5228.         exit(1);
  5229.       }
  5230.   
  5231. !     home = getenv("HOME");
  5232.   
  5233.       sprintf(fd_hash, "%s/%s", home, ALIAS_HASH);
  5234.       sprintf(fd_data, "%s/%s", home, ALIAS_DATA);
  5235.   
  5236.       if (argc > 1)
  5237.         sprintf(buffer, "egrep \"%s\" | sort", argv[1]);
  5238. --- 48,71 ----
  5239.       struct alias_rec hash_record;
  5240.       int hashfile, count = 0;
  5241.       char buffer[SLEN], fd_hash[SLEN],
  5242. !          fd_data[SLEN];
  5243.   
  5244. +         initpaths();
  5245.       if (argc > 2) {
  5246.         printf("Usage: listalias <optional-regular-expression>\n");
  5247.         exit(1);
  5248.       }
  5249.   
  5250. !     if((pass = getpwuid(getuid())) == NULL) {
  5251. !       printf("You have no password entry!\n");
  5252. !       exit(1);
  5253. !     }
  5254. !     strcpy(home, pass->pw_dir);
  5255.   
  5256.       sprintf(fd_hash, "%s/%s", home, ALIAS_HASH);
  5257.       sprintf(fd_data, "%s/%s", home, ALIAS_DATA);
  5258. +         putc('\n', stdout);
  5259.   
  5260.       if (argc > 1)
  5261.         sprintf(buffer, "egrep \"%s\" | sort", argv[1]);
  5262. ***************
  5263. *** 81,87 ****
  5264.   
  5265.           while (read(hashfile, &hash_record, sizeof (hash_record)) != 0) {
  5266.             if (strlen(hash_record.name) > 0) {
  5267. !             fseek(datafile, ntohl(hash_record.byte), 0L);
  5268.               fgets(buffer, SLEN, datafile);
  5269.               fprintf(fd_pipe, "%-15s  %s", hash_record.name, buffer);
  5270.             }
  5271. --- 91,97 ----
  5272.   
  5273.           while (read(hashfile, &hash_record, sizeof (hash_record)) != 0) {
  5274.             if (strlen(hash_record.name) > 0) {
  5275. !             fseek(datafile, ntohl(hash_record.byte), 0);
  5276.               fgets(buffer, SLEN, datafile);
  5277.               fprintf(fd_pipe, "%-15s  %s", hash_record.name, buffer);
  5278.             }
  5279. diff -cbr orig/utils/Makefile new/utils/Makefile
  5280. diff -cbr orig/utils/newalias.c new/utils/newalias.c
  5281. *** orig/utils/newalias.c    Sun Oct 04 14:37:14 1992
  5282. --- new/utils/newalias.c    Sun Mar 29 00:07:17 1992
  5283. ***************
  5284. *** 57,64 ****
  5285.   
  5286.   #include <stdio.h>
  5287.   #include "defs.h"
  5288. - #include "sysdefs.h"        /* ELM system definitions */
  5289.   #include <ctype.h>
  5290.   
  5291.   #ifdef BSD
  5292.   #  include <sys/file.h>
  5293. --- 57,64 ----
  5294.   
  5295.   #include <stdio.h>
  5296.   #include "defs.h"
  5297.   #include <ctype.h>
  5298. + #include <pwd.h>
  5299.   
  5300.   #ifdef BSD
  5301.   #  include <sys/file.h>
  5302. ***************
  5303. *** 85,90 ****
  5304. --- 85,93 ----
  5305.   int  is_system=0;        /* system file updating?     */
  5306.   int  count=0;            /* how many aliases so far?  */
  5307.   long offset = 0L;        /* data file line offset!    */
  5308. + struct passwd *getpwuid();
  5309. + struct passwd *pass;
  5310.   char home[SLEN];        /* the users home directory  */
  5311.   
  5312.   main(argc, argv)
  5313. ***************
  5314. *** 96,126 ****
  5315.       char buffer[LONG_STRING];
  5316.       int  a, hash, count = 0, owner;
  5317.   
  5318.       for (a = 1; a < argc; ++a) {
  5319.         if (strcmp(argv[a], "-g") == 0)
  5320.           is_system = 1;
  5321.         else {
  5322. !         printf("Usage: %s [-g]\n", argv[0]);
  5323.           exit(1);
  5324.         }
  5325.       }
  5326.   
  5327.       if (is_system) {   /* update system aliases */
  5328. !       printf("Updating the system alias file...\n");
  5329.   
  5330. -       strcpy(inputname, system_text_file);
  5331. -       strcpy(hashname,  system_hash_file);
  5332. -       strcpy(dataname,  system_data_file);
  5333.         init_table(shash_table, MAX_SALIASES);
  5334.       }
  5335.       else
  5336. !       printf("Updating your personal alias file...\n");
  5337.   
  5338.       if (! is_system) {
  5339. !       if (strcpy(home, getenv("HOME")) == NULL) {
  5340. !         printf("I'm confused - no HOME variable in environment!\n");
  5341.           exit(1);
  5342.         }
  5343.   
  5344.         sprintf(inputname, "%s/%s", home, ALIAS_TEXT);
  5345.         sprintf(hashname, "%s/%s", home, ALIAS_HASH);
  5346. --- 99,133 ----
  5347.       char buffer[LONG_STRING];
  5348.       int  a, hash, count = 0, owner;
  5349.   
  5350. +         initpaths();
  5351.       for (a = 1; a < argc; ++a) {
  5352.         if (strcmp(argv[a], "-g") == 0)
  5353.           is_system = 1;
  5354.         else {
  5355. !         printf("\nUsage: %s [-g]\n", argv[0]);
  5356.           exit(1);
  5357.         }
  5358.       }
  5359.   
  5360.       if (is_system) {   /* update system aliases */
  5361. !       printf("\nUpdating the system alias file...\n");
  5362. !       sprintf(inputname, "%s/%s", elmhome, system_text_file);
  5363. !       sprintf(hashname, "%s/%s", elmhome, system_hash_file);
  5364. !       sprintf(dataname, "%s/%s", elmhome, system_data_file);
  5365.   
  5366.         init_table(shash_table, MAX_SALIASES);
  5367.       }
  5368.       else
  5369. !       printf("\nUpdating your personal alias file...\n");
  5370.   
  5371.       if (! is_system) {
  5372. !       if((pass = getpwuid(getuid())) == NULL) {
  5373. !         printf("You have no password entry!\n");
  5374.           exit(1);
  5375.         }
  5376. +       strcpy(home, pass->pw_dir);
  5377.   
  5378.         sprintf(inputname, "%s/%s", home, ALIAS_TEXT);
  5379.         sprintf(hashname, "%s/%s", home, ALIAS_HASH);
  5380. ***************
  5381. *** 144,155 ****
  5382.         }
  5383.       }
  5384.   
  5385. !     if ((hash = open(hashname, O_WRONLY | O_TRUNC | O_CREAT, 0644)) == -1) {
  5386.         printf("Couldn't open %s for output!\n", hashname);
  5387.         exit(1);
  5388.       }
  5389.   
  5390. !     if ((data = fopen(dataname,"w")) == NULL) {
  5391.         printf("Couldn't open %s for output!\n", dataname);
  5392.         exit(1);
  5393.       }
  5394. --- 151,162 ----
  5395.         }
  5396.       }
  5397.   
  5398. !     if ((hash = open(hashname, O_WRONLY  | O_BINARY | O_TRUNC | O_CREAT, 0644)) == -1) {
  5399.         printf("Couldn't open %s for output!\n", hashname);
  5400.         exit(1);
  5401.       }
  5402.   
  5403. !     if ((data = fopen(dataname,"wb")) == NULL) {
  5404.         printf("Couldn't open %s for output!\n", dataname);
  5405.         exit(1);
  5406.       }
  5407. diff -cbr orig/utils/newmail.c new/utils/newmail.c
  5408. *** orig/utils/newmail.c    Sun Oct 04 14:37:15 1992
  5409. --- new/utils/newmail.c    Sun Mar 22 11:38:29 1992
  5410. ***************
  5411. *** 83,88 ****
  5412. --- 83,89 ----
  5413.   #include <errno.h>
  5414.   #include <sys/types.h>
  5415.   #include <sys/stat.h>
  5416. + #include <pwd.h>
  5417.   
  5418.   #include "defs.h"
  5419.   
  5420. ***************
  5421. *** 138,143 ****
  5422. --- 139,146 ----
  5423.       long lastsize,
  5424.            newsize;            /* file size for comparison..      */
  5425.   
  5426. +         initpaths();
  5427.   #ifdef HOSTCOMPILED
  5428.       strncpy(hostname, HOSTNAME, sizeof(hostname));
  5429.   #else
  5430. ***************
  5431. *** 166,172 ****
  5432.       if (ptr == argv[0] && i == 0 && argv[0][0] == 'w')
  5433.         in_window = 1;
  5434.   
  5435. !     while ((c = getopt(argc, argv, "di:w")) != EOF) {
  5436.         switch (c) {
  5437.           case 'd' : debug++;                    break;
  5438.           case 'i' : interval_time = atoi(optarg);        break;
  5439. --- 169,175 ----
  5440.       if (ptr == argv[0] && i == 0 && argv[0][0] == 'w')
  5441.         in_window = 1;
  5442.   
  5443. !     while ((c = getopt(argc, argv, "di:wh?")) != EOF) {
  5444.         switch (c) {
  5445.           case 'd' : debug++;                    break;
  5446.           case 'i' : interval_time = atoi(optarg);        break;
  5447. ***************
  5448. *** 199,205 ****
  5449. --- 202,210 ----
  5450.         (void) signal(SIGQUIT, SIG_IGN);
  5451.       }
  5452.   #endif
  5453. + #ifdef SIGHUP
  5454.       (void) signal(SIGHUP, SIG_DFL);
  5455. + #endif
  5456.   
  5457.       if (in_window && ! debug)
  5458.         printf("Incoming mail:\n");
  5459. ***************
  5460. *** 206,211 ****
  5461. --- 211,217 ----
  5462.   
  5463.       while (1) {
  5464.   
  5465. + #ifndef OS2
  5466.   #ifdef PIDCHECK
  5467.       if ( kill(parent_pid,0))
  5468.           exit(0);
  5469. ***************
  5470. *** 215,220 ****
  5471. --- 221,227 ----
  5472.           exit();
  5473.   #endif /* AUTO_BACKGROUND */
  5474.   #endif /* PIDCHECK */
  5475. + #endif
  5476.   
  5477.         if (! isatty(1))    /* we're not sending output to a tty any more */
  5478.            exit();
  5479. ***************
  5480. *** 303,309 ****
  5481.       while (fgets(buffer, SLEN, folders[current_folder].fd) != NULL) {
  5482.   #ifdef MMDF
  5483.             if (strcmp(buffer, MSG_SEPERATOR) == 0) {
  5484. !             newheader = !newheader;
  5485.               if (newheader) {
  5486.   #else
  5487.         if (first_word(buffer,"From ")) {
  5488. --- 310,316 ----
  5489.       while (fgets(buffer, SLEN, folders[current_folder].fd) != NULL) {
  5490.   #ifdef MMDF
  5491.             if (strcmp(buffer, MSG_SEPERATOR) == 0) {
  5492. !             newheader = 1;
  5493.               if (newheader) {
  5494.   #else
  5495.         if (first_word(buffer,"From ")) {
  5496. ***************
  5497. *** 314,320 ****
  5498.             in_header = 1;
  5499.             subject[0] ='\0';
  5500.             if (in_window)
  5501. !             putchar((char) 007);        /* BEEP!*/
  5502.             else
  5503.               printf("\n\r");    /* blank lines surrounding message */
  5504.   
  5505. --- 321,327 ----
  5506.             in_header = 1;
  5507.             subject[0] ='\0';
  5508.             if (in_window)
  5509. !             putc((char) 007, stdout);        /* BEEP!*/
  5510.             else
  5511.               printf("\n\r");    /* blank lines surrounding message */
  5512.   
  5513. ***************
  5514. *** 703,709 ****
  5515.           is to check to see if new mail has arrived....  **/
  5516.   
  5517.       int ok = 1;
  5518. -     extern int errno;    /* system error number! */
  5519.       struct stat buffer;
  5520.   
  5521.       if (stat(name, &buffer) != 0)
  5522. --- 710,715 ----
  5523. ***************
  5524. *** 722,736 ****
  5525.       /** Getting the username on some systems is a real pain, so...
  5526.          This routine is guaranteed to return a usable username **/
  5527.   
  5528. !     char *return_value, *getlogin(), *cuserid();
  5529. !     if ((return_value = getlogin()) == NULL)
  5530. !       if ((return_value = cuserid(NULL)) == NULL) {
  5531. !         printf("Newmail: I can't get username!\n");
  5532. !         exit(1);
  5533. !       }
  5534.   
  5535. !     return( (char *) return_value);
  5536.   }
  5537.   
  5538.   usage(name)
  5539. --- 728,738 ----
  5540.       /** Getting the username on some systems is a real pain, so...
  5541.          This routine is guaranteed to return a usable username **/
  5542.   
  5543. !   struct passwd *password_entry;
  5544. !   struct passwd *getpwuid();
  5545.   
  5546. !   if (( password_entry = getpwuid(getuid())) != NULL)
  5547. !     return(password_entry->pw_name);
  5548.   }
  5549.   
  5550.   usage(name)
  5551. diff -cbr orig/utils/readmsg.c new/utils/readmsg.c
  5552. *** orig/utils/readmsg.c    Sun Oct 04 14:37:15 1992
  5553. --- new/utils/readmsg.c    Sat Mar 28 23:30:29 1992
  5554. ***************
  5555. *** 44,49 ****
  5556. --- 44,50 ----
  5557.   
  5558.   #include <stdio.h>
  5559.   #include <ctype.h>
  5560. + #include <pwd.h>
  5561.   
  5562.   #include "defs.h"
  5563.   
  5564. ***************
  5565. *** 69,74 ****
  5566. --- 70,78 ----
  5567.   int numcmp();                /* strcmp, but for numbers          */
  5568.   char *words();                /* function defined below...        */
  5569.   
  5570. + struct passwd *getpwuid();
  5571. + struct passwd *pass;
  5572. + char home[SLEN];        /* the users home directory  */
  5573.   
  5574.   extern char *optarg;        /* for parsing the ...             */
  5575.   extern int   optind;            /*  .. starting arguments           */
  5576. ***************
  5577. *** 84,90 ****
  5578.            infile[SLEN],            /* input filename        */
  5579.            buffer[SLEN],             /* file reading buffer      */
  5580.            string[SLEN],            /* string match buffer      */
  5581. !          *cp;
  5582.   
  5583.       int current_in_queue = 0,         /* these are used for...     */
  5584.           current = 0,            /* ...going through msgs     */
  5585. --- 88,95 ----
  5586.            infile[SLEN],            /* input filename        */
  5587.            buffer[SLEN],             /* file reading buffer      */
  5588.            string[SLEN],            /* string match buffer      */
  5589. !          *cp,
  5590. !              *prog = argv[0];
  5591.   
  5592.       int current_in_queue = 0,         /* these are used for...     */
  5593.           current = 0,            /* ...going through msgs     */
  5594. ***************
  5595. *** 102,107 ****
  5596. --- 107,114 ----
  5597.           string[0] = '\0';            /* init match string to empty */
  5598.           infile[0] = '\0';            /* init mail file to empty    */
  5599.   
  5600. +         initpaths();
  5601.       /**** start of the actual program ****/
  5602.   
  5603.       while ((num = getopt(argc, argv, "nhf:p")) != EOF) {
  5604. ***************
  5605. *** 115,123 ****
  5606.                         argv[0], infile);
  5607.                  break;
  5608.           case 'p' : page_breaks++;            break;
  5609. !         case '?' : printf(
  5610. !             "Usage: %s [-n|-h] [-f filename] [-p] <message list>\n",
  5611. !              argv[0]);
  5612.                    exit(1);
  5613.         }
  5614.       }
  5615. --- 122,128 ----
  5616.                         argv[0], infile);
  5617.                  break;
  5618.           case 'p' : page_breaks++;            break;
  5619. !         case '?' : usage(prog);
  5620.                    exit(1);
  5621.         }
  5622.       }
  5623. ***************
  5624. *** 135,148 ****
  5625.       /** now let's figure out the parameters to the program... **/
  5626.   
  5627.       if (argc == 1) {    /* no arguments... called from 'Elm'? */
  5628. !       sprintf(filename, "%s/%s", getenv("HOME"), readmsg_file);
  5629.         if ((file = fopen(filename, "r")) != NULL) {
  5630.           fscanf(file, "%d", &(read_message[messages++]));
  5631.           fclose(file);
  5632.         }
  5633.         else {    /* no arguments AND no .readmsg file!! */
  5634. !         fprintf(stderr,
  5635. !             "Usage: readmsg [-n|-h] [-f filename] [-p] <message list>\n");
  5636.           exit(1);
  5637.         }
  5638.       }
  5639. --- 140,157 ----
  5640.       /** now let's figure out the parameters to the program... **/
  5641.   
  5642.       if (argc == 1) {    /* no arguments... called from 'Elm'? */
  5643. !       if((pass = getpwuid(getuid())) == NULL) {
  5644. !         printf("You have no password entry!\n");
  5645. !         exit(1);
  5646. !       }
  5647. !       strcpy(home, pass->pw_dir);
  5648. !       sprintf(filename, "%s/%s", home, readmsg_file);
  5649.         if ((file = fopen(filename, "r")) != NULL) {
  5650.           fscanf(file, "%d", &(read_message[messages++]));
  5651.           fclose(file);
  5652.         }
  5653.         else {    /* no arguments AND no .readmsg file!! */
  5654. !             usage(prog);
  5655.           exit(1);
  5656.         }
  5657.       }
  5658. ***************
  5659. *** 233,241 ****
  5660.   
  5661.       while (fgets(buffer, SLEN, file) != NULL) {
  5662.   #ifdef MMDF
  5663. !       if (strcmp(buffer, MSG_SEPERATOR) == 0)
  5664. !         newheader = !newheader;
  5665. !       if (newheader && buffer[0] == '\001') {
  5666.   #else
  5667.         if (real_from(buffer)) {
  5668.   #endif /* MMDF */
  5669. --- 242,253 ----
  5670.   
  5671.       while (fgets(buffer, SLEN, file) != NULL) {
  5672.   #ifdef MMDF
  5673. !       if (strcmp(buffer, MSG_SEPERATOR) == 0 ||
  5674. !               !newheader && real_from(buffer))
  5675. !             newheader = 1; /* !newheader; */
  5676. !           else
  5677. !             newheader = 0;
  5678. !       if (newheader) {
  5679.   #else
  5680.         if (real_from(buffer)) {
  5681.   #endif /* MMDF */
  5682. ***************
  5683. *** 248,253 ****
  5684. --- 260,266 ----
  5685.           current++;
  5686.           not_in_header = 0;    /* we're in the header! */
  5687.         }
  5688.         if (current == read_message[current_in_queue] || list_all_messages)
  5689.   #ifdef MMDF
  5690.           if ((include_headers==ALL || not_in_header)
  5691. ***************
  5692. *** 268,273 ****
  5693. --- 281,296 ----
  5694.       exit(0);
  5695.   }
  5696.   
  5697. + usage(prog)
  5698. + char *prog;
  5699. + {
  5700. +   printf("\nUsage: %s [-n|-h] [-f filename] [-p] <message list>\n", prog);
  5701. +   printf("\n  -n   don't print any headers"
  5702. +          "\n  -h   print all headers"
  5703. +          "\n  -p   printf form feeds between messages\n"
  5704. +          "\n  -f filename    use this instead of default mailbox\n");
  5705. + }
  5706.   int
  5707.   count_messages(file)
  5708.   FILE *file;
  5709. ***************
  5710. *** 282,293 ****
  5711.   
  5712.       while (fgets(buffer, SLEN, file) != NULL)
  5713.   #ifdef MMDF
  5714. !       if ((strcmp(buffer, MSG_SEPERATOR) == 0)
  5715. !         && (++newheader % 2))
  5716.   #else
  5717. !       if (real_from(buffer))
  5718.   #endif /* MMDF */
  5719.           count++;
  5720.   
  5721.       rewind( file );
  5722.       return( count );
  5723. --- 305,322 ----
  5724.   
  5725.       while (fgets(buffer, SLEN, file) != NULL)
  5726.   #ifdef MMDF
  5727. !       if (strcmp(buffer, MSG_SEPERATOR) == 0
  5728. !               || !newheader && real_from(buffer)) {
  5729. !         newheader = 1;
  5730.   #else
  5731. !       if (real_from(buffer)) |
  5732.   #endif /* MMDF */
  5733.           count++;
  5734. +           }
  5735. + #ifdef MMDF
  5736. +           else
  5737. +         newheader = 0;
  5738. + #endif /* MMDF */
  5739.   
  5740.       rewind( file );
  5741.       return( count );
  5742. ***************
  5743. *** 309,320 ****
  5744.   
  5745.       while (fgets(buffer, SLEN, mailfile) != NULL) {
  5746.   #ifdef MMDF
  5747. !       if ((strcmp(buffer, MSG_SEPERATOR) == 0)
  5748. !         && (++newheader % 2))
  5749.   #else
  5750. !       if (real_from(buffer))
  5751.   #endif /* MMDF */
  5752.           message_count++;
  5753.   
  5754.         if (in_string(buffer, string)) {
  5755.           read_message[messages++] = message_count;
  5756. --- 338,355 ----
  5757.   
  5758.       while (fgets(buffer, SLEN, mailfile) != NULL) {
  5759.   #ifdef MMDF
  5760. !       if (strcmp(buffer, MSG_SEPERATOR) == 0
  5761. !               || !newheader && real_from(buffer)) {
  5762. !         newheader = 1;
  5763.   #else
  5764. !       if (real_from(buffer)) {
  5765.   #endif /* MMDF */
  5766.           message_count++;
  5767. +           }
  5768. + #ifdef MMDF
  5769. +           else
  5770. +         newheader = 0;
  5771. + #endif /* MMDF */
  5772.   
  5773.         if (in_string(buffer, string)) {
  5774.           read_message[messages++] = message_count;
  5775. ***************
  5776. *** 375,381 ****
  5777.   
  5778.       if (messages_listed++)
  5779.         if (page_break)
  5780. !         putchar(FORMFEED);    
  5781.         else
  5782.           printf(
  5783.   "\n--------------------------------------------------------------------\n\n\n");
  5784. --- 410,416 ----
  5785.   
  5786.       if (messages_listed++)
  5787.         if (page_break)
  5788. !         putc(FORMFEED, stdout);
  5789.         else
  5790.           printf(
  5791.   "\n--------------------------------------------------------------------\n\n\n");
  5792. ***************
  5793. *** 386,392 ****
  5794.       if (strlen(date)    > 0) { printf("%s", date);    displayed_line++;}
  5795.   
  5796.       if (displayed_line)
  5797. !        putchar('\n');
  5798.   }
  5799.   
  5800.   char *words(word, num_words, buffer)
  5801. --- 421,427 ----
  5802.       if (strlen(date)    > 0) { printf("%s", date);    displayed_line++;}
  5803.   
  5804.       if (displayed_line)
  5805. !        putc('\n', stdout);
  5806.   }
  5807.   
  5808.   char *words(word, num_words, buffer)
  5809.