home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-10-04 | 158.2 KB | 5,903 lines |
- Only in new: README.OS2
- Only in new: FILES.BIN
- Only in new: FILES.SRC
- Only in new: patches.os2
- Only in new: config.h
- Only in new: crypt
- Only in new: os2
- diff -cbr orig/filter/actions.c new/filter/actions.c
- *** orig/filter/actions.c Sun Oct 04 14:36:27 1992
- --- new/filter/actions.c Sun Mar 29 10:09:13 1992
- ***************
- *** 68,74 ****
- username, address);
-
- if (! show_only) {
- ! sprintf(tempfile, "%s.%d", filter_temp, getpid());
-
- if ((tempfd = fopen(tempfile, "r")) == NULL) {
- if (outfd != NULL)
- --- 68,74 ----
- username, address);
-
- if (! show_only) {
- ! sprintf(tempfile, "%s%d.fil", tempdir, getpid());
-
- if ((tempfd = fopen(tempfile, "r")) == NULL) {
- if (outfd != NULL)
- ***************
- *** 84,91 ****
- if (contains(from, username)) {
- if (outfd != NULL)
- fprintf(outfd,
- ! "filter (%s): Filter loop detected! Message left in file %s.%d\n",
- ! username, filter_temp, getpid());
- if (outfd != NULL) fclose(outfd);
- exit(0);
- }
- --- 84,91 ----
- if (contains(from, username)) {
- if (outfd != NULL)
- fprintf(outfd,
- ! "filter (%s): Filter loop detected! Message left in file %s\n",
- ! username, tempfile);
- if (outfd != NULL) fclose(outfd);
- exit(0);
- }
- ***************
- *** 94,112 ****
- if (strcmp(sendmail, mailer) == 0)
- sprintf(buffer, "%s %s %s", sendmail, smflags, address);
- else
- ! sprintf(buffer, "%s %s", mailer, address);
-
- if ((pipefd = popen(buffer, "w")) == NULL) {
- if (outfd != NULL)
- fprintf(outfd, "filter (%s): popen %s failed!\n", username, buffer);
- ! sprintf(buffer, "((%s %s %s ; %s %s) & ) < %s &",
- ! sendmail , smflags, address, remove_cmd, tempfile, tempfile);
- system(buffer);
- return;
- }
-
- fprintf(pipefd, "Subject: \"%s\"\n", subject);
- ! fprintf(pipefd, "From: The Filter of %s@%s <%s>\n",
- username, hostname, username);
- fprintf(pipefd, "To: %s\n", address);
- fprintf(pipefd, "X-Filtered-By: filter, version %s\n\n", VERSION);
- --- 94,112 ----
- if (strcmp(sendmail, mailer) == 0)
- sprintf(buffer, "%s %s %s", sendmail, smflags, address);
- else
- ! sprintf(buffer, "%s -t", mailer);
-
- if ((pipefd = popen(buffer, "w")) == NULL) {
- if (outfd != NULL)
- fprintf(outfd, "filter (%s): popen %s failed!\n", username, buffer);
- ! sprintf(buffer, "%s -t <%s", mailer, tempfile);
- system(buffer);
- + unlink(tempfile);
- return;
- }
-
- fprintf(pipefd, "Subject: \"%s\"\n", subject);
- ! fprintf(pipefd, "From: %s@%s (The Filter of %s)\n",
- username, hostname, username);
- fprintf(pipefd, "To: %s\n", address);
- fprintf(pipefd, "X-Filtered-By: filter, version %s\n\n", VERSION);
- ***************
- *** 120,126 ****
- fprintf(pipefd," %s", buffer);
-
- fprintf(pipefd, "\n-- End of filtered message --\n");
- ! fclose(pipefd);
- fclose(tempfd);
-
- return; /* YEAH! Wot a slick program, eh? */
- --- 120,126 ----
- fprintf(pipefd," %s", buffer);
-
- fprintf(pipefd, "\n-- End of filtered message --\n");
- ! pclose(pipefd);
- fclose(tempfd);
-
- return; /* YEAH! Wot a slick program, eh? */
- ***************
- *** 146,151 ****
- --- 146,155 ----
- else if ((mailfd = emergency_local_delivery()) == NULL)
- exit(1);
-
- + #ifdef MMDF
- + fputs(MSG_SEPERATOR, mailfd);
- + #endif
- +
- while (fgets(buffer, sizeof(buffer), tempfd) != NULL) {
- line_count++;
- if (the_same(buffer, "From ") && line_count > 1)
- ***************
- *** 154,160 ****
- fputs(buffer, mailfd);
- }
-
- ! fputs("\n", mailfd);
-
- fclose(mailfd);
- unlock(); /* blamo or not? Let it decide! */
- --- 158,164 ----
- fputs(buffer, mailfd);
- }
-
- ! fputs("\n\n", mailfd);
-
- fclose(mailfd);
- unlock(); /* blamo or not? Let it decide! */
- ***************
- *** 177,183 ****
- username, foldername);
-
- if (!show_only) {
- ! sprintf(filename, "%s.%d", filter_temp, getpid());
-
- if ((fdunit = open(foldername, O_APPEND | O_WRONLY | O_CREAT, 0600)) < 0) {
- if (outfd != NULL)
- --- 181,187 ----
- username, foldername);
-
- if (!show_only) {
- ! sprintf(filename, "%s%d.fil", tempdir, getpid());
-
- if ((fdunit = open(foldername, O_APPEND | O_WRONLY | O_CREAT, 0600)) < 0) {
- if (outfd != NULL)
- ***************
- *** 196,201 ****
- --- 200,209 ----
- return(1);
- }
-
- + #ifdef MMDF
- + fputs(MSG_SEPERATOR, fd);
- + #endif
- +
- while (fgets(buffer, sizeof(buffer), tempfd) != NULL)
- fputs(buffer, fd);
-
- ***************
- *** 226,232 ****
- fprintf(outfd, "filter (%s): Executing %s\n", username, command);
-
- if (! show_only) {
- ! sprintf(buffer, "%s %s.%d | %s", cat, filter_temp, getpid(), command);
- system(buffer);
- }
- }
- --- 234,240 ----
- fprintf(outfd, "filter (%s): Executing %s\n", username, command);
-
- if (! show_only) {
- ! sprintf(buffer, "%s <%s%d", command, tempdir, getpid());
- system(buffer);
- }
- }
- diff -cbr orig/filter/filter.c new/filter/filter.c
- *** orig/filter/filter.c Sun Oct 04 14:36:27 1992
- --- new/filter/filter.c Sun Mar 29 00:03:23 1992
- ***************
- *** 59,64 ****
- --- 59,66 ----
- #define MAIN_ROUTINE /* for the filter.h file, of course! */
- #include "filter.h"
-
- + #undef fflush
- +
- main(argc, argv)
- int argc;
- char *argv[];
- ***************
- *** 76,81 ****
- --- 78,85 ----
- summary = FALSE, /* a summary is requested? */
- c; /* var for getopt routine */
-
- + initpaths();
- +
- /* first off, let's get the info from /etc/passwd */
-
- if ((passwd_entry = getpwuid(getuid())) == NULL)
- ***************
- *** 89,94 ****
- --- 93,100 ----
- strncpy(hostname, HOSTNAME, sizeof(hostname));
- #else
- gethostname(hostname, sizeof(hostname));
- + gethostdomain(buffer, sizeof(buffer));
- + strcat(hostname, buffer);
- #endif
-
- /* now parse the starting arguments... */
- ***************
- *** 105,118 ****
-
- case 'n' : show_only = TRUE; break;
- case 'v' : verbose = TRUE; break;
- ! case '?' : fprintf(stderr,
- ! "Usage: | filter [-nrv]\n or: filter [-c] -[s|S]\n");
- ! exit(1);
- }
- }
-
- ! if (c < 0) {
- ! }
-
- /* let's open our outfd logfile as needed... */
-
- --- 111,122 ----
-
- case 'n' : show_only = TRUE; break;
- case 'v' : verbose = TRUE; break;
- ! case '?' : usage(argv[0]);
- }
- }
-
- ! if (isatty(0) && !summary && !long_summary && !printing_rules)
- ! usage(argv[0]);
-
- /* let's open our outfd logfile as needed... */
-
- ***************
- *** 146,152 ****
-
- /* next, create the tempfile and save the incoming message */
-
- ! sprintf(filename, "%s.%d", filter_temp, getpid());
-
- if ((fd = fopen(filename,"w")) == NULL)
- leave("Cannot open temporary file!");
- --- 150,156 ----
-
- /* next, create the tempfile and save the incoming message */
-
- ! sprintf(filename, "%s%d.fil", tempdir, getpid());
-
- if ((fd = fopen(filename,"w")) == NULL)
- leave("Cannot open temporary file!");
- ***************
- *** 229,234 ****
- --- 233,254 ----
- (void) unlink(filename); /* remove the temp file, please! */
- if (outfd != NULL) fclose(outfd);
- exit(0);
- + }
- +
- +
- + usage(name)
- + char *name;
- + {
- + printf("\nUsage: filter [-nrv] [-o output]"
- + "\n or: filter [-s|-S] [-c] [-o output]\n"
- + "\nWhere: -n not really, only output what would happen"
- + "\n -v be verbose for each message filtered"
- + "\n -r list rules currently beeing used"
- + "\n -s list summary of message filtered log"
- + "\n -S list more verbose summary that -s"
- + "\n -c clear log files after summarizing with -s or -S"
- + "\n -o output redirect log message to 'output'\n");
- + exit(1);
- }
-
- save_from(buffer)
- diff -cbr orig/filter/lock.c new/filter/lock.c
- *** orig/filter/lock.c Sun Oct 04 14:36:27 1992
- --- new/filter/lock.c Sun Mar 22 15:09:08 1992
- ***************
- *** 59,66 ****
- static char flock_name[SLEN];
- #endif
-
- - extern int errno;
- -
- char *
- mk_lockname(home, user)
- char *home, *user;
- --- 59,64 ----
- ***************
- *** 74,80 ****
- sprintf(lockfile, "/tmp/%.10s.mlk", user);
- #else
- /* lock is [file_to_lock].lock */
- ! sprintf(lockfile, "%s%s.lock", home, user);
- #endif
- return(lockfile);
- }
- --- 72,78 ----
- sprintf(lockfile, "/tmp/%.10s.mlk", user);
- #else
- /* lock is [file_to_lock].lock */
- ! sprintf(lockfile, "%s%s.lck", home, user);
- #endif
- return(lockfile);
- }
- ***************
- *** 112,118 ****
- }
- #endif
-
- ! while ((ret = open(lockfile, O_WRONLY | O_CREAT | O_EXCL, 0444)) < 0
- && attempts++ < 10) {
- sleep(3); /* wait three seconds each pass, okay?? */
- }
- --- 110,116 ----
- }
- #endif
-
- ! while ((ret = open(lockfile, O_WRONLY | O_CREAT | O_EXCL, 0666)) < 0
- && attempts++ < 10) {
- sleep(3); /* wait three seconds each pass, okay?? */
- }
- ***************
- *** 128,134 ****
- #endif /* } !LOCK_FLOCK_ONLY */
- #ifdef LOCK_BY_FLOCK /* { LOCK_BY_FLOCK */
- (void)sprintf(flock_name,"%s%s",mailhome,username);
- ! flock_fd = open(flock_name, O_RDONLY | O_CREAT, 0600);
- if ( flock_fd >= 0 )
- for (attempts = 0; attempts < 10; attempts++) {
- if ( (ret = flock(flock_fd,LOCK_NB|LOCK_EX)) != -1 )
- --- 126,132 ----
- #endif /* } !LOCK_FLOCK_ONLY */
- #ifdef LOCK_BY_FLOCK /* { LOCK_BY_FLOCK */
- (void)sprintf(flock_name,"%s%s",mailhome,username);
- ! flock_fd = open(flock_name, O_RDONLY | O_CREAT, 0666);
- if ( flock_fd >= 0 )
- for (attempts = 0; attempts < 10; attempts++) {
- if ( (ret = flock(flock_fd,LOCK_NB|LOCK_EX)) != -1 )
- diff -cbr orig/filter/Makefile new/filter/Makefile
- *** orig/filter/Makefile Sat Feb 01 15:15:14 1992
- --- new/filter/Makefile Sun Oct 04 14:04:24 1992
- ***************
- *** 1,143 ****
- #
- ! # @(#): Makefile.SH,v 4.1 90/04/28 22:41:51 syd Exp $
- ! # Makefile for the Elm system filter program
- #
- ! # Copyright (c) 1986, 1987 Dave Taylor
- ! # Copyright (c) 1988, 1989, 1990 USENET Community Trust
- ! #
- ! # Bug reports, patches, comments, suggestions should be sent to:
- ! #
- ! # Syd Weinstein - elm@DSI.COM
- ! # dsinc!elm
- ! #
- ! # $Log: Makefile.SH,v $
- ! # Revision 4.1 90/04/28 22:41:51 syd
- ! # checkin of Elm 2.3 as of Release PL0
- ! #
- ! #
- # Variables
- ! # Variables established by Configure
- ! CC = cc
- ! CCFLAGS =
- ! CHGRP = chgrp
- ! CHMOD = chmod
- ! CP = cp
- ! DEST = /bin
- ! ECHO = echo
- ! LFLAGS =
- ! LIB = /usr/local/lib
- ! LIB2 =
- ! LIBS = -lcurses
- ! LINT = /usr/bin/lint
- ! MAILGRP = bin
- ! MAILERMODE = 755
- ! MAKE = make
- ! MV = mv
- ! OPTIMIZE = -O
- RM = rm -f
- TOUCH = touch
-
- ! # Variables you may want to manually edit
- ! # If you want debug logging then you'll
- ! # want to uncomment the following.
- ! #DEBUG = -DDEBUG
-
- ! # Other variables
- ! BIN = ../bin
- ! INCLDIR = ../hdrs
- ! CFLAGS = $(CCFLAGS) $(OPTIMIZE) -I$(INCLDIR) $(DEBUG) $(DACSNET)
- ! LINTFLAGS = -I$(INCLDIR)
- ! SHELL = /bin/sh
- !
- ! # Definitions of variables
- ! FILTER_SRC = actions.c \
- ! buffer.c \
- ! filter.c \
- ! lock.c \
- ! parse.c \
- ! rules.c \
- ! summarize.c \
- ! utils.c \
- ! ../src/opt_utils.c
- !
- ! FILTER_OBJ = actions.obj \
- ! buffer.obj \
- ! filter.obj \
- ! lock.obj \
- ! parse.obj \
- ! rules.obj \
- ! summarize.obj \
- ! utils.obj \
- ! ../src/opt_utils.obj
-
- # Standard targets
- - all: $(BIN)/filter
-
- ! install: $(DEST)/filter
-
- ! uninstall:
- ! $(RM) $(DEST)/filter
-
- ! # This is the only target that gets installed even if not out-of-date
- ! # with respect the files from which it is installed.
- ! rmt-install: rmt-defined
- ! -$(MV) $(DEST)/filter $(DEST)/filter.old
- ! -$(RM) $(DEST)/filter.old
- ! $(CP) $(REMOTE)$(DEST)/filter $(DEST)/filter
- ! $(CHGRP) $(MAILGRP) $(DEST)/filter
- ! $(CHMOD) $(MAILERMODE) $(DEST)/filter
- !
- ! rmt-defined:
- ! @(if [ "$(REMOTE)" = "" ];\
- ! then\
- ! $(ECHO) "You need to define 'REMOTE' as the remote file system";\
- ! $(ECHO) "for this particular command. The easiest way to do this";\
- ! $(ECHO) "to type:";\
- ! $(ECHO) " make REMOTE=<remote file system> rmt-install";\
- ! exit 1;\
- ! fi);
-
- ! lint:
- ! $(LINT) $(LINTFLAGS) $(FILTER_SRC) > LINT.OUT
-
- ! clean:
- ! $(RM) $(FILTER_OBJ) $(BIN)/filter
-
- ! # Dependencies and rules
- # Dependencies of header files upon other header files they include
- .PRECIOUS: $(INCLDIR)/defs.h $(INCLDIR)/elm.h $(INCLDIR)/headers.h
-
- ! $(INCLDIR)/defs.h: $(INCLDIR)/../config.h $(INCLDIR)/sysdefs.h
- ! $(CHMOD) u+w $@
- $(TOUCH) $@
-
- $(INCLDIR)/elm.h: $(INCLDIR)/curses.h $(INCLDIR)/defs.h
- - $(CHMOD) u+w $@
- $(TOUCH) $@
-
- $(INCLDIR)/headers.h: $(INCLDIR)/curses.h $(INCLDIR)/defs.h
- - $(CHMOD) u+w $@
- $(TOUCH) $@
-
- # Dependencies and rules for C object files
- - actions.obj: $(INCLDIR)/defs.h $(INCLDIR)/filter.h
- - filter.obj: $(INCLDIR)/defs.h $(INCLDIR)/filter.h
- - lock.obj: $(INCLDIR)/defs.h $(INCLDIR)/filter.h
- - parse.obj: $(INCLDIR)/defs.h $(INCLDIR)/filter.h
- - rules.obj: $(INCLDIR)/defs.h $(INCLDIR)/filter.h
- - summarize.obj: $(INCLDIR)/defs.h $(INCLDIR)/filter.h
- - utils.obj: $(INCLDIR)/defs.h $(INCLDIR)/filter.h
- - ../src/opt_utils.obj:
- - rem cd ../src; $(MAKE) -$(MAKEFLAGS) $(@F)
- -
- - # Dependencies and rules for compiling programs
- - $(BIN)/filter: $(FILTER_OBJ)
- - $(CC) $(LFLAGS) -o $@ $(FILTER_OBJ) $(LIB2)
-
- ! # Dependencies and rules for installing programs from bin directory
- ! $(DEST)/filter: $(BIN)/filter
- ! -$(MV) $(DEST)/filter $(DEST)/filter.old
- ! -$(RM) $(DEST)/filter.old
- ! $(CP) $? $@
- ! $(CHGRP) $(MAILGRP) $@
- ! $(CHMOD) $(MAILERMODE) $@
- --- 1,77 ----
- #
- ! # Makefile for the Elm system filter program for OS/2
- #
- !
- ! default:
- ! @echo "Make target msc, gcc or ibm."
- !
- ! msc:
- ! $(MAKE) all CC="cl -nologo -AL -Gs -Ocegt" O=".obj" \
- ! CFLAGS="-W1 -Zep1 -Gt16 -D__STDC__ -G2 -J" \
- ! LFLAGS="-Lp -F 8000" LIBS="..\os2\elm.def -link /noe /packc /packd"
- !
- ! gcc:
- ! $(MAKE) all CC="gcc -O -Zomf -Zmt" O=".obj" \
- ! CFLAGS="" LFLAGS="" LIBS="../os2/elm.def -los2"
- !
- # Variables
- !
- ! INCLDIR = ../hdrs
- ! OS2DIR = ../os2
- ! DEFINES = -DOS2 -I$(INCLDIR) -I$(OS2DIR)
- RM = rm -f
- TOUCH = touch
-
- ! # Lists
-
- ! OS2_OBJ = getopt$O os2util$O
- ! FILTER_OBJ = actions$O buffer$O filter$O lock$O parse$O \
- ! rules$O summarize$O utils$O opt_utils$O $(OS2_OBJ)
-
- # Standard targets
-
- ! all: filter.exe
-
- ! clean:
- ! $(RM) $(FILTER_OBJ)
-
- ! # Dependencies and rules for compiling programs
-
- ! filter.exe: $(FILTER_OBJ) $(DEF)
- diff -cbr orig/filter/rules.c new/filter/rules.c
- *** orig/filter/rules.c Sat Apr 28 19:42:00 1990
- --- new/filter/rules.c Sun Oct 04 13:37:28 1992
- ***************
- *** 120,126 ****
-
- #ifndef _POSIX_SOURCE
- struct tm *localtime();
- ! long time();
- #endif
- struct tm *timerec;
- long thetime;
- --- 120,126 ----
-
- #ifndef _POSIX_SOURCE
- struct tm *localtime();
- ! time_t time();
- #endif
- struct tm *timerec;
- long thetime;
- diff -cbr orig/filter/utils.c new/filter/utils.c
- *** orig/filter/utils.c Sun Oct 04 14:36:27 1992
- --- new/filter/utils.c Sun Mar 22 14:27:13 1992
- ***************
- *** 40,45 ****
- --- 40,47 ----
- #include "defs.h"
- #include "filter.h"
-
- + #undef fflush
- +
- leave(reason)
- char *reason;
- {
- diff -cbr orig/hdrs/defs.h new/hdrs/defs.h
- *** orig/hdrs/defs.h Sun Oct 04 14:36:28 1992
- --- new/hdrs/defs.h Sun Oct 04 09:56:18 1992
- ***************
- *** 36,41 ****
- --- 36,45 ----
- #include "../config.h"
- #include "sysdefs.h" /* system/configurable defines */
-
- + #ifdef OS2
- + #include "../os2/os2elm.h"
- + #endif
- +
-
- # define VERSION "2.3" /* Version number... */
- # define VERS_DATE "May 1, 1990" /* for elm -v option */
- ***************
- *** 113,125 ****
- #define DONT_SAVE "[no save]"
- #define DONT_SAVE2 "[nosave]"
-
- - #define alias_file ".aliases"
- - #define group_file ".groups"
- - #define system_file ".systems"
- -
- - #define default_folders "Mail"
- - #define default_recvdmail "=received"
- - #define default_sentmail "=sent"
-
- /** some defines for the 'userlevel' variable... **/
-
- --- 117,122 ----
- ***************
- *** 169,176 ****
- #define DECEMBER 11
-
- #define equal(s,w) (strcmp(s,w) == 0)
- ! #define min(a,b) a < b? a : b
- ! #define ctrl(c) c - 'A' + 1 /* control character mapping */
- #define plural(n) n == 1 ? "" : "s"
- #define lastch(s) s[strlen(s)-1]
-
- --- 166,173 ----
- #define DECEMBER 11
-
- #define equal(s,w) (strcmp(s,w) == 0)
- ! #define min(a,b) (a < b? a : b)
- ! #define ctrl(c) (c == '?' ? 127 : c - 'A' + 1) /* control character mapping */
- #define plural(n) n == 1 ? "" : "s"
- #define lastch(s) s[strlen(s)-1]
-
- ***************
- *** 258,263 ****
- --- 255,261 ----
-
- #define PMALLOC_THRESHOLD 256 /* if greater, then just use malloc */
- #define PMALLOC_BUFFER_SIZE 2048 /* internal [memory] buffer size... */
- +
-
- /** the following macro is as suggested by Larry McVoy. Thanks! **/
-
- diff -cbr orig/hdrs/elm.h new/hdrs/elm.h
- *** orig/hdrs/elm.h Sun Oct 04 14:36:28 1992
- --- new/hdrs/elm.h Sun Oct 04 09:57:15 1992
- ***************
- *** 34,40 ****
- #include "../hdrs/curses.h"
- #include "../hdrs/defs.h"
-
- ! #ifdef BSD
- #include <setjmp.h>
- #endif
-
- --- 34,40 ----
- #include "../hdrs/curses.h"
- #include "../hdrs/defs.h"
-
- ! #if defined(BSD) || defined(OS2)
- #include <setjmp.h>
- #endif
-
- ***************
- *** 57,62 ****
- --- 57,64 ----
- int headers_per_page; /* number of headers/page */
- int original_umask = 0; /* original umask, for restore before subshell */
- int sendmail_verbose = 0; /* Extended mail debugging */
- + int no_save = 0; /* Do not save outgoing mail */
- + int mmdf_strict = 0; /* Strict MMDF mailbox scanning */
- char cur_folder[SLEN]; /* name of current folder */
- char cur_tempfolder[SLEN]; /* name of temp folder open for a mailbox */
- char defaultfile[SLEN]; /* name of default folder */
- ***************
- *** 177,183 ****
- int userid; /* uid for current user */
- int groupid; /* groupid for current user */
-
- ! #ifdef BSD
- jmp_buf GetPromptBuf; /* setjmp buffer */
- int InGetPrompt; /* set if in GetPrompt() in read() */
- #endif
- --- 179,185 ----
- int userid; /* uid for current user */
- int groupid; /* groupid for current user */
-
- ! #if defined(BSD) || defined(OS2)
- jmp_buf GetPromptBuf; /* setjmp buffer */
- int InGetPrompt; /* set if in GetPrompt() in read() */
- #endif
- diff -cbr orig/hdrs/filter.h new/hdrs/filter.h
- *** orig/hdrs/filter.h Sun Oct 04 14:36:28 1992
- --- new/hdrs/filter.h Sun Mar 22 13:46:06 1992
- ***************
- *** 42,54 ****
-
- /** some of the files we'll be using, where they are, and so on... **/
-
- ! #define filter_temp "/tmp/filter"
- ! #define filterfile ".elm/filter-rules"
- ! #define filterlog ".elm/filterlog"
- ! #define filtersum ".elm/filtersum"
-
- ! #define EMERGENCY_MAILBOX "EMERGENCY_MBOX"
- ! #define EMERG_MBOX "MBOX.EMERGENCY"
-
- /** and now the hardwired constraint of the program.. **/
-
- --- 42,54 ----
-
- /** some of the files we'll be using, where they are, and so on... **/
-
- ! #define filter_temp "filter"
- ! #define filterfile "elm/filter.rul"
- ! #define filterlog "elm/filter.log"
- ! #define filtersum "elm/filter.sum"
-
- ! #define EMERGENCY_MAILBOX "emergenc.mbx"
- ! #define EMERG_MBOX "emerg.mbx"
-
- /** and now the hardwired constraint of the program.. **/
-
- ***************
- *** 87,93 ****
-
- /** A funky way to open a file using open() to avoid file locking hassles **/
-
- ! #define FOLDERMODE O_WRONLY | O_APPEND | O_CREAT | O_SYNCIO
-
- /** cheap but easy way to have two files share the same #include file **/
-
- --- 87,93 ----
-
- /** A funky way to open a file using open() to avoid file locking hassles **/
-
- ! #define FOLDERMODE O_WRONLY | O_APPEND | O_CREAT
-
- /** cheap but easy way to have two files share the same #include file **/
-
- diff -cbr orig/hdrs/headers.h new/hdrs/headers.h
- *** orig/hdrs/headers.h Sun Oct 04 14:36:28 1992
- --- new/hdrs/headers.h Sun Oct 04 09:56:18 1992
- ***************
- *** 33,38 ****
- --- 33,43 ----
- #include "curses.h"
- #include "defs.h"
-
- + #ifdef OS2
- + #include "../os2/os2elm.h"
- + #include <setjmp.h>
- + #endif
- +
- #ifdef BSD
- #include <setjmp.h>
- #endif
- ***************
- *** 51,56 ****
- --- 56,63 ----
- extern int headers_per_page; /* number of headers/page */
- extern int original_umask; /* original umask, for restore before subshell */
- extern int sendmail_verbose; /* Allow extended debugging on sendmail */
- + extern int no_save; /* Do not save outgoing mail */
- + extern int mmdf_strict; /* Strict MMDF mailbox scanning */
- extern char cur_folder[SLEN]; /* name of current folder */
- extern char cur_tempfolder[SLEN]; /* name of temp folder open for a mailbox */
- extern char defaultfile[SLEN]; /* name of default folder */
- ***************
- *** 172,178 ****
- extern int userid; /* uid for current user */
- extern int groupid; /* groupid for current user */
-
- ! #ifdef BSD
- extern jmp_buf GetPromptBuf; /* setjmp buffer */
- extern int InGetPrompt; /* set if in GetPrompt() in read() */
- #endif
- --- 179,185 ----
- extern int userid; /* uid for current user */
- extern int groupid; /* groupid for current user */
-
- ! #if defined(BSD) || defined(OS2)
- extern jmp_buf GetPromptBuf; /* setjmp buffer */
- extern int InGetPrompt; /* set if in GetPrompt() in read() */
- #endif
- diff -cbr orig/src/addr_util.c new/src/addr_util.c
- *** orig/src/addr_util.c Sun Oct 04 14:36:29 1992
- --- new/src/addr_util.c Wed Apr 01 12:13:25 1992
- ***************
- *** 109,114 ****
- --- 109,115 ----
- (char *) 0, 0
- };
-
- + #ifndef OS2
- char *
- gcos_name(gcos_field, logname)
- char *logname, *gcos_field;
- ***************
- *** 169,174 ****
- --- 170,176 ----
- #endif
- #endif
- }
- + #endif
-
- char *
- get_full_name(logname)
- ***************
- *** 493,499 ****
-
- struct header_rec temp_rec, *rec_ptr;
- char junk[STRING], timebuff[STRING], holding_from[SLEN], hold_tz[12];
- ! char mybuf[BUFSIZ], *p, *q;
- int eight_fields = 0;
- int mday, month, year, minutes, seconds, tz, i;
- long gmttime;
- --- 495,501 ----
-
- struct header_rec temp_rec, *rec_ptr;
- char junk[STRING], timebuff[STRING], holding_from[SLEN], hold_tz[12];
- ! char mybuf[BUFSIZ], timebuf2[STRING], *p, *q;
- int eight_fields = 0;
- int mday, month, year, minutes, seconds, tz, i;
- long gmttime;
- ***************
- *** 509,517 ****
-
- /* From <user> <day> <month> <day> <hr:min:sec> <year> */
-
- ! sscanf(buffer, "%*s %*s %*s %*s %*s %s %*s %s", timebuff, junk);
-
- ! if (strlen(timebuff) < 3) {
- dprint(3,(debugfile,
- "Real_from returns FAIL [no time field] on\n-> %s\n",
- buffer));
- --- 511,519 ----
-
- /* From <user> <day> <month> <day> <hr:min:sec> <year> */
-
- ! sscanf(buffer, "%*s %*s %*s %*s %*s %s %s %s", timebuff, timebuf2, junk);
-
- ! if (strlen(timebuff) < 3 && strlen(timebuf2) < 3) {
- dprint(3,(debugfile,
- "Real_from returns FAIL [no time field] on\n-> %s\n",
- buffer));
- ***************
- *** 518,524 ****
- return(FALSE);
- }
-
- ! if (timebuff[1] != ':' && timebuff[2] != ':') {
- dprint(3,(debugfile,
- "Real_from returns FAIL [bad time field] on\n-> %s\n",
- buffer));
- --- 520,527 ----
- return(FALSE);
- }
-
- ! if (timebuff[1] != ':' && timebuff[2] != ':' &&
- ! timebuf2[1] != ':' && timebuf2[2] != ':') { /* UUPC ! */
- dprint(3,(debugfile,
- "Real_from returns FAIL [bad time field] on\n-> %s\n",
- buffer));
- ***************
- *** 526,534 ****
- }
- if (junk[0] != '\0') { /* try for 8 field entry */
- junk[0] = '\0';
- ! sscanf(buffer, "%*s %*s %*s %*s %*s %s %*s %*s %s", timebuff, junk);
- ! if (junk[0] != '\0') {
- ! dprint(3, (debugfile,
- "Real_from returns FAIL [too many fields] on\n-> %s\n",
- buffer));
- return(FALSE);
- --- 529,537 ----
- }
- if (junk[0] != '\0') { /* try for 8 field entry */
- junk[0] = '\0';
- ! sscanf(buffer, "%*s %*s %*s %*s %*s %*s %*s %*s %s", junk);
- ! if (junk[0] != '\0' && strcmp(junk, "remote")) {
- ! dprint(3, (debugfile, /* ^ UUPC ! */
- "Real_from returns FAIL [too many fields] on\n-> %s\n",
- buffer));
- return(FALSE);
- ***************
- *** 547,552 ****
- --- 550,571 ----
- junk, holding_from, rec_ptr->dayname, rec_ptr->month,
- rec_ptr->day, rec_ptr->time, rec_ptr->year);
-
- + /* non-standard UUPC From line? */
- +
- + /* This is from UUPC rmail: */
- + /* From fkk Sat, 14 Mar 1992 14:53:27 MET remote from stasys */
- +
- + /* while this were normal: */
- + /* From fkk Sat Mar 14 14:53:27 1992 [MET] */
- +
- + if ( rec_ptr->dayname[strlen(rec_ptr->dayname) - 1] == ',' )
- + {
- + sscanf(buffer, "%s %s %s %s %s %s %s %s",
- + junk, holding_from, rec_ptr->dayname, rec_ptr->day,
- + rec_ptr->month, rec_ptr->year, rec_ptr->time, hold_tz);
- + rec_ptr->dayname[strlen(rec_ptr->dayname) - 1] = 0;
- + }
- +
- strncpy(rec_ptr->from, holding_from, STRING-1);
- rec_ptr->from[STRING-1] = '\0';
- resolve_received(rec_ptr);
- ***************
- *** 815,821 ****
- /* Return smallest i such that table[i] is a prefix of str. Return -1 if not
- * found.
- */
- ! static int prefix(table, str)
- char **table;
- char *str;
- {
- --- 834,840 ----
- /* Return smallest i such that table[i] is a prefix of str. Return -1 if not
- * found.
- */
- ! int prefix(table, str)
- char **table;
- char *str;
- {
- ***************
- *** 925,931 ****
- * Unlike the preceding routines, the result is not an updated pointer, but
- * simply 1 for success and 0 for failure.
- */
- ! static int
- get_unix_date(p,y,d,m,s,t)
- char *p;
- int *y, *d, *m, *s, *t;
- --- 944,950 ----
- * Unlike the preceding routines, the result is not an updated pointer, but
- * simply 1 for success and 0 for failure.
- */
- ! int
- get_unix_date(p,y,d,m,s,t)
- char *p;
- int *y, *d, *m, *s, *t;
- diff -cbr orig/src/alias.c new/src/alias.c
- *** orig/src/alias.c Sun Oct 04 14:36:29 1992
- --- new/src/alias.c Sun Oct 04 14:35:02 1992
- ***************
- *** 44,50 ****
- --- 44,52 ----
- char *get_alias_address();
- char *error_name(), *error_description(), *strip_parens(), *index();
-
- + #ifndef OS2
- extern int errno;
- + #endif
-
- #ifndef DONT_TOUCH_ADDRESSES
- char *expand_system();
- ***************
- *** 80,90 ****
-
- struct stat hst;
- static time_t system_ctime, system_mtime;
-
- /* If hash file hasn't changed, don't bother re-reading. */
-
- if (system_data != -1
- ! && stat(system_hash_file, &hst) == 0
- && hst.st_ctime == system_ctime
- && hst.st_mtime == system_mtime)
- return;
- --- 82,95 ----
-
- struct stat hst;
- static time_t system_ctime, system_mtime;
- + char syshash[SLEN], sysdata[SLEN];
-
- /* If hash file hasn't changed, don't bother re-reading. */
- + sprintf(syshash, "%s/%s", elmhome, system_hash_file);
- + sprintf(sysdata, "%s/%s", elmhome, system_data_file);
-
- if (system_data != -1
- ! && stat(syshash, &hst) == 0
- && hst.st_ctime == system_ctime
- && hst.st_mtime == system_mtime)
- return;
- ***************
- *** 98,113 ****
-
- /* Read system hash table. If we can't, just return. */
-
- ! if (read_hash_file(system_hash_file, (char *) system_hash_table,
- sizeof system_hash_table) < 0)
- return;
-
- /* Open system data table. */
-
- ! if ((system_data = open(system_data_file, O_RDONLY)) == -1) {
- dprint(1, (debugfile,
- "Warning: Can't open system alias data file %s\n",
- ! system_data_file));
- return;
- }
-
- --- 103,118 ----
-
- /* Read system hash table. If we can't, just return. */
-
- ! if (read_hash_file(syshash, (char *) system_hash_table,
- sizeof system_hash_table) < 0)
- return;
-
- /* Open system data table. */
-
- ! if ((system_data = open(sysdata, O_RDONLY)) == -1) {
- dprint(1, (debugfile,
- "Warning: Can't open system alias data file %s\n",
- ! sysdata));
- return;
- }
-
- ***************
- *** 396,402 ****
- FILE *file;
- char fname[SLEN];
-
- ! sprintf(fname,"%s/%s", home, ALIAS_TEXT);
-
- save_file_stats(fname);
- if ((file = fopen(fname, "a")) == NULL) {
- --- 401,407 ----
- FILE *file;
- char fname[SLEN];
-
- ! sprintf(fname, "%s/%s", home, ALIAS_TEXT);
-
- save_file_stats(fname);
- if ((file = fopen(fname, "a")) == NULL) {
- ***************
- *** 441,448 ****
- strcpy(name_with_equals, name);
- strcat(name_with_equals, " =");
-
- ! sprintf(fname,"%s/%s", home, ALIAS_TEXT);
- ! sprintf(tmpfname,"%s/%s.t", home, ALIAS_TEXT);
-
- save_file_stats(fname);
-
- --- 446,453 ----
- strcpy(name_with_equals, name);
- strcat(name_with_equals, " =");
-
- ! sprintf(fname, "%s/%s", home, ALIAS_TEXT);
- ! sprintf(tmpfname, "%s/%s", home, ALIAS_TEMP);
-
- save_file_stats(fname);
-
- ***************
- *** 485,490 ****
- --- 490,496 ----
- }
- fclose(file);
- fclose(tmp_file);
- + unlink(fname);
- if (rename(tmpfname, fname) != 0)
- {
- error1("Couldn't rename tempfile %s after deleting alias!", tmpfname);
- ***************
- *** 498,504 ****
-
- show_alias_menu()
- {
- ! MoveCursor(LINES-7,0); CleartoEOS();
-
- PutLine0(LINES-7,COLUMNS-45, "Alias commands");
- Centerline(LINES-6,
- --- 504,510 ----
-
- show_alias_menu()
- {
- ! MoveCursor(LINES-8,0); CleartoEOS();
-
- PutLine0(LINES-7,COLUMNS-45, "Alias commands");
- Centerline(LINES-6,
- ***************
- *** 645,658 ****
- /** run the 'newalias' program and update the
- aliases before going back to the main program!
- **/
- !
-
- error("Updating aliases...");
- ! sleep(2);
-
- ! if (system_call(newalias, SH, FALSE, FALSE) == 0) {
- error("Re-reading the database in...");
- ! sleep(2);
- read_alias_files();
- set_error("Aliases updated successfully.");
- }
- --- 651,665 ----
- /** run the 'newalias' program and update the
- aliases before going back to the main program!
- **/
- ! char cmd[SLEN];
-
- error("Updating aliases...");
- ! /* sleep(2); */
- ! sprintf(cmd, "%s", newalias);
-
- ! if (system_call(cmd, SH, FALSE, FALSE) == 0) {
- error("Re-reading the database in...");
- ! /* sleep(2); */
- read_alias_files();
- set_error("Aliases updated successfully.");
- }
- ***************
- *** 722,728 ****
- {
- char fname[SLEN];
-
- ! sprintf(fname,"%s/%s", home, ALIAS_TEXT);
- display_file(fname);
- ClearScreen();
- return;
- --- 729,735 ----
- {
- char fname[SLEN];
-
- ! sprintf(fname, "%s/%s", home, ALIAS_TEXT);
- display_file(fname);
- ClearScreen();
- return;
- diff -cbr orig/src/aliasdb.c new/src/aliasdb.c
- *** orig/src/aliasdb.c Sun Oct 04 14:37:00 1992
- --- new/src/aliasdb.c Mon Mar 16 09:47:22 1992
- ***************
- *** 35,41 ****
- --- 35,43 ----
- #include <sys/stat.h>
- #include <errno.h>
-
- + #ifndef OS2
- extern int errno;
- + #endif
-
- #ifdef USE_DBM
- # include <dbm.h>
- ***************
- *** 324,338 ****
-
- struct stat buffer;
- char *path_filename;
- -
- - #ifdef USE_DBM
- char buf[BUFSIZ];
-
- ! sprintf(buf,"%s.pag", pathfile);
- ! path_filename = buf;
- #else
- ! path_filename = pathfile;
- #endif
-
- if (stat(path_filename, &buffer) == -1) {
- dprint(2, (debugfile,
- --- 326,339 ----
-
- struct stat buffer;
- char *path_filename;
- char buf[BUFSIZ];
-
- ! #ifdef USE_DBM
- ! sprintf(buf,"%s/%s.pag", elmhome, pathfile);
- #else
- ! sprintf(buf,"%s/%s", elmhome, pathfile);
- #endif
- + path_filename = buf;
-
- if (stat(path_filename, &buffer) == -1) {
- dprint(2, (debugfile,
- diff -cbr orig/src/args.c new/src/args.c
- *** orig/src/args.c Sun Oct 04 14:37:00 1992
- --- new/src/args.c Sun Aug 16 22:56:14 1992
- ***************
- *** 51,57 ****
- to_whom[0] = '\0';
- batch_subject[0] = '\0';
-
- ! while ((c = getopt(argc, argv, "?acd:f:hkKms:Vvwz")) != EOF) {
- switch (c) {
- case 'a' : arrow_cursor++; break;
- case 'c' : check_only++; break;
- --- 51,57 ----
- to_whom[0] = '\0';
- batch_subject[0] = '\0';
-
- ! while ((c = getopt(argc, argv, "?acd:f:hkKmns:uVvwz")) != EOF) {
- switch (c) {
- case 'a' : arrow_cursor++; break;
- case 'c' : check_only++; break;
- ***************
- *** 62,68 ****
- --- 62,70 ----
- case 'k' : hp_terminal++; break;
- case 'K' : hp_terminal++; hp_softkeys++; break;
- case 'm' : mini_menu = 0; break;
- + case 'n' : no_save++; break;
- case 's' : strcpy(batch_subject, optarg); break;
- + case 'u' : mmdf_strict++; break; /* i.e. UUPC */
- case 'V' : sendmail_verbose++; break;
- case 'v' : args_version();
- case 'w' : warnings = 0; break;
- ***************
- *** 122,128 ****
- --- 124,132 ----
- printf("\t -k \t\tKeypad - enable HP 2622 terminal keyboard\n");
- printf("\t -K \t\tKeypad&softkeys - enable use of softkeys + \"-k\"\n");
- printf("\t -m \t\tMenu - Turn off menu, using more of the screen\n");
- + printf("\t -n \t\tNosave - Do not save outgoing mail - for batchmailing\n");
- printf("\t -sx\t\tSubject 'x' - for batchmailing\n");
- + printf("\t -u \t\tMore restrictive mailbox scanning - for UUPC mailboxes\n");
- printf("\t -V \t\tEnable sendmail voyeur mode.\n");
- printf("\t -v \t\tPrint out ELM version information.\n");
- printf("\t -w \t\tSupress warning messages...\n");
- diff -cbr orig/src/builtin.c new/src/builtin.c
- *** orig/src/builtin.c Sun Oct 04 14:37:00 1992
- --- new/src/builtin.c Sun Mar 29 00:05:01 1992
- ***************
- *** 98,105 ****
- iptr++;
- break;
- } else if (*iptr == '\n' || *iptr == '\r') { /*newline or return */
- - *optr++ = '\n';
- *optr++ = '\r';
- iptr++;
- break; /* end of line */
- } else if(*iptr == '\f') { /* formfeed */
- --- 98,105 ----
- iptr++;
- break;
- } else if (*iptr == '\n' || *iptr == '\r') { /*newline or return */
- *optr++ = '\r';
- + *optr++ = '\n';
- iptr++;
- break; /* end of line */
- } else if(*iptr == '\f') { /* formfeed */
- ***************
- *** 113,120 ****
- break;
- } else if(*iptr == '\t') { /* tab stop */
- if((nt=next_tab(chars_output+1)) > width) {
- ! *optr++ = '\n'; /* won't fit on this line - autowrap */
- ! *optr++ = '\r'; /* tab by tabbing so-to-speak to 1st */
- iptr++; /* column of next line */
- break;
- } else { /* will fit - output proper num of spaces */
- --- 113,122 ----
- break;
- } else if(*iptr == '\t') { /* tab stop */
- if((nt=next_tab(chars_output+1)) > width) {
- ! #ifndef OS2
- ! *optr++ = '\r'; /* won't fit on this line - autowrap */
- ! *optr++ = '\n'; /* tab by tabbing so-to-speak to 1st */
- ! #endif
- iptr++; /* column of next line */
- break;
- } else { /* will fit - output proper num of spaces */
- ***************
- *** 161,166 ****
- --- 163,170 ----
- char *pending, footer[SLEN], display_buffer[SLEN], ch;
- int formfeed, lines_more;
-
- + fixline(input_line);
- +
- #ifdef MMDF
- if (strcmp(input_line, MSG_SEPERATOR) == 0)
- strcpy(input_line," ");
- ***************
- *** 291,297 ****
-
- /* truncate or pad title2 portion on the right
- * so that line fits exactly to the rightmost column */
- ! padding = COLUMNS - (t1_len + t2_len + strlen(title3));
-
- sprintf(titlebuf, "%s%-*.*s%s\n\r\n\r", title1, t2_len+padding,
- t2_len+padding, title2, title3);
- --- 295,301 ----
-
- /* truncate or pad title2 portion on the right
- * so that line fits exactly to the rightmost column */
- ! padding = COLUMNS - 1 - (t1_len + t2_len + strlen(title3));
-
- sprintf(titlebuf, "%s%-*.*s%s\n\r\n\r", title1, t2_len+padding,
- t2_len+padding, title2, title3);
- diff -cbr orig/src/calendar.c new/src/calendar.c
- *** orig/src/calendar.c Sun Oct 04 14:37:00 1992
- --- new/src/calendar.c Sun Mar 29 00:05:05 1992
- ***************
- *** 43,49 ****
- --- 43,51 ----
-
- #include <errno.h>
-
- + #ifndef OS2
- extern int errno;
- + #endif
-
- char *error_name(), *error_description(), *strcpy();
-
- diff -cbr orig/src/conn_to.c new/src/conn_to.c
- *** orig/src/conn_to.c Sun Oct 04 14:37:01 1992
- --- new/src/conn_to.c Sun Mar 15 14:17:02 1992
- ***************
- *** 56,62 ****
- return;
- }
-
- ! sprintf(filename, "%s%s%d", temp_dir, temp_uuname, getpid());
- sprintf(buffer,"%s > %s", uuname, filename);
-
- if (system_call(buffer, SH, FALSE, FALSE) != 0) {
- --- 56,62 ----
- return;
- }
-
- ! sprintf(filename, "%s%d%s", temp_dir, getpid(), temp_uuname);
- sprintf(buffer,"%s > %s", uuname, filename);
-
- if (system_call(buffer, SH, FALSE, FALSE) != 0) {
- diff -cbr orig/src/curses.c new/src/curses.c
- *** orig/src/curses.c Sun Oct 04 14:37:01 1992
- --- new/src/curses.c Mon Apr 06 15:53:24 1992
- ***************
- *** 119,127 ****
- *_setbold, *_clearbold, *_setunderline, *_clearunderline,
- *_sethalfbright, *_clearhalfbright, *_setinverse, *_clearinverse,
- *_cleartoeoln, *_cleartoeos, *_transmit_on, *_transmit_off,
- ! *_set_memlock, *_clear_memlock;
-
- ! static int _lines, _columns, _automargin, _eatnewlineglitch;
- int tabspacing;
-
- static char _terminal[1024]; /* Storage for terminal entry */
- --- 119,127 ----
- *_setbold, *_clearbold, *_setunderline, *_clearunderline,
- *_sethalfbright, *_clearhalfbright, *_setinverse, *_clearinverse,
- *_cleartoeoln, *_cleartoeos, *_transmit_on, *_transmit_off,
- ! *_set_memlock, *_clear_memlock, *_initscreen, *_exitscreen;
-
- ! static int _lines, _columns, _automargin, _eatnewlineglitch, initialized;
- int tabspacing;
-
- static char _terminal[1024]; /* Storage for terminal entry */
- ***************
- *** 145,154 ****
- char termname[40];
- char *strcpy(), *getenv();
-
- ! if (getenv("TERM") == NULL) return(-1);
- !
- ! if (strcpy(termname, getenv("TERM")) == NULL)
- ! return(-1);
-
- if ((err = tgetent(_terminal, termname)) != 1)
- return(err-2);
- --- 145,154 ----
- char termname[40];
- char *strcpy(), *getenv();
-
- ! if (getenv("TERM") == NULL)
- ! strcpy(termname, "ansi");
- ! else
- ! strcpy(termname, getenv("TERM"));
-
- if ((err = tgetent(_terminal, termname)) != 1)
- return(err-2);
- ***************
- *** 157,162 ****
- --- 157,164 ----
- _col = 0; /* assume zero, zero... */
-
- /* load in all those pesky values */
- + _initscreen = tgetstr("ti", &ptr);
- + _exitscreen = tgetstr("te", &ptr);
- _clearscreen = tgetstr("cl", &ptr);
- _moveto = tgetstr("cm", &ptr);
- _up = tgetstr("up", &ptr);
- ***************
- *** 188,196 ****
- --- 190,211 ----
- _left = "\b";
- }
-
- + tputs(_initscreen, 1, outchar);
- + fflush(stdout);
- + initialized = 1;
- +
- return(0);
- }
-
- + ExitScreen()
- + {
- + if ( initialized )
- + {
- + tputs(_exitscreen, 1, outchar);
- + fflush(stdout);
- + }
- + }
- +
- char *return_value_of(termcap_label)
- char *termcap_label;
- {
- ***************
- *** 268,273 ****
- --- 283,291 ----
- {
- /** returns the number of lines and columns on the display. **/
-
- + #ifdef OS2
- + _ScreenSize(&_lines, &_columns);
- + #endif
- #ifdef TIOCGWINSZ
- struct winsize w;
-
- ***************
- *** 838,844 ****
- --- 856,873 ----
- /** clear to end of screen **/
-
- if (!_cleartoeos)
- + #ifdef OS2
- + {
- + int i;
- + printf("\033[s\033[K");
- + for ( i = _line + 1; i < _lines; i++ )
- + printf("\033[%d;1H\033[K", i + 1);
- + printf("\033[u");
- + fflush(stdout);
- + }
- + #else
- return(-1);
- + #endif
-
- tputs(_cleartoeos, 1, outchar);
- fflush(stdout); /* clear the output buffer */
- ***************
- *** 861,866 ****
- --- 890,898 ----
- if (state == OFF && _inraw) {
- (void) ttsetattr(TTYIN,&_original_tty);
- _inraw = 0;
- + #ifdef OS2
- + setmode(1, O_TEXT);
- + #endif
- }
- else if (state == ON && ! _inraw) {
-
- ***************
- *** 879,886 ****
- --- 911,934 ----
- #endif
- (void) ttsetattr(TTYIN, &_raw_tty);
- _inraw = 1;
- + #ifdef OS2
- + setmode(1, O_BINARY);
- + #endif
- + }
- + }
- +
- + #ifdef OS2
- + char cbuffer[1024];
- + int cbufsize;
- +
- + tflush()
- + {
- + if ( cbufsize ) {
- + write(1, cbuffer, cbufsize);
- + cbufsize = 0;
- }
- }
- + #endif
-
- int
- ReadCh()
- ***************
- *** 889,896 ****
- --- 937,949 ----
-
- register int result;
- char ch;
- + #ifdef OS2
- + tflush();
- + return readkey();
- + #else
- result = read(0, &ch, 1);
- return((result <= 0 ) ? EOF : ch);
- + #endif
- }
-
- outchar(c)
- ***************
- *** 899,904 ****
- --- 952,964 ----
- /** output the given character. From tputs... **/
- /** Note: this CANNOT be a macro! **/
-
- + #ifdef OS2
- + cbuffer[cbufsize++] = c;
- +
- + if ( cbufsize == sizeof(cbuffer) )
- + tflush();
- + #else
- putc(c, stdout);
- + #endif
- }
-
- diff -cbr orig/src/date.c new/src/date.c
- *** orig/src/date.c Sun Oct 04 14:37:01 1992
- --- new/src/date.c Sun Oct 04 09:53:21 1992
- ***************
- *** 41,47 ****
-
- #ifndef _POSIX_SOURCE
- extern struct tm *localtime();
- ! extern long time();
- #endif
-
- #ifdef BSD
- --- 41,47 ----
-
- #ifndef _POSIX_SOURCE
- extern struct tm *localtime();
- ! extern time_t time();
- #endif
-
- #ifdef BSD
- ***************
- *** 69,75 ****
- --- 69,77 ----
- #ifdef BSD
- char *timezone();
- #else
- + #ifndef OS2
- extern char *tzname[];
- + #endif
- #endif
-
- char *get_arpa_date()
- diff -cbr orig/src/domains.c new/src/domains.c
- *** orig/src/domains.c Sun Oct 04 14:37:01 1992
- --- new/src/domains.c Mon Mar 16 09:48:22 1992
- ***************
- *** 67,75 ****
-
- open_domain_file()
- {
- ! if ((domainfd = fopen(domains, "r")) == NULL) {
- dprint(2, (debugfile,"Warning: can't open file %s as domains file\n",
- ! domains));
- }
- else {
- dprint(3, (debugfile,
- --- 67,79 ----
-
- open_domain_file()
- {
- ! char domainsfile[SLEN];
- !
- ! sprintf(domainsfile, "%s/%s", elmhome, domains);
- !
- ! if ((domainfd = fopen(domainsfile, "r")) == NULL) {
- dprint(2, (debugfile,"Warning: can't open file %s as domains file\n",
- ! domainsfile));
- }
- else {
- dprint(3, (debugfile,
- diff -cbr orig/src/edit.c new/src/edit.c
- *** orig/src/edit.c Sun Oct 04 14:37:02 1992
- --- new/src/edit.c Tue May 26 22:31:03 1992
- ***************
- *** 38,44 ****
- --- 38,46 ----
- #include "headers.h"
- #include <errno.h>
-
- + #ifndef OS2
- extern int errno;
- + #endif
-
- char *error_name(), *error_description(), *strcpy();
- long bytes();
- ***************
- *** 83,88 ****
- --- 85,93 ----
-
- Raw(OFF);
-
- + fclose(mailfile);
- + mailfile = NULL;
- +
- if (system_call(buffer, SH, TRUE, FALSE) != 0) {
- error1("Problems invoking editor %s!", alternative_editor);
- Raw(ON);
- ***************
- *** 91,96 ****
- --- 96,102 ----
- }
-
- Raw(ON);
- + ClearScreen();
- SetXYLocation(0, 40); /* a location not near the next request, so an absolute is used */
-
- if (folder_type == SPOOL) { /* uh oh... now the toughie... */
- ***************
- *** 192,198 ****
- } else
- error("Resynchronizing with new version of folder...");
-
- ! sleep(2);
- ClearScreen();
- newmbox(cur_folder, FALSE);
- showscreen();
- --- 198,204 ----
- } else
- error("Resynchronizing with new version of folder...");
-
- ! /* sleep(2); */
- ClearScreen();
- newmbox(cur_folder, FALSE);
- showscreen();
- diff -cbr orig/src/editmsg.c new/src/editmsg.c
- *** orig/src/editmsg.c Sun Oct 04 14:37:02 1992
- --- new/src/editmsg.c Tue Mar 17 00:40:01 1992
- ***************
- *** 55,61 ****
- --- 55,63 ----
- #undef tolower
- #endif
-
- + #ifndef OS2
- extern int errno;
- + #endif
-
- char *error_name(), *error_description(), *strcpy(), *format_long();
- unsigned long sleep();
- ***************
- *** 109,114 ****
- --- 111,117 ----
- if (old_raw == ON)
- Raw(ON);
-
- + ClearScreen();
- SetXYLocation(0, 40); /* a location not near the next request, so an absolute is used */
- MoveCursor(LINES, 0); /* dont know where we are, force last row, col 0 */
-
- ***************
- *** 286,292 ****
- Write_to_screen(
- "(You need to use a specific command here. Continue.)\n\r");
- else {
- ! sprintf(buf, " > %s%s.%d 2>&1", temp_dir, temp_edit, getpid());
- strcat(buffer, buf);
- if (( old_raw = RawState()) == ON)
- Raw(OFF);
- --- 289,295 ----
- Write_to_screen(
- "(You need to use a specific command here. Continue.)\n\r");
- else {
- ! sprintf(buf, " > %s%d.%s", temp_dir, getpid(), temp_edit);
- strcat(buffer, buf);
- if (( old_raw = RawState()) == ON)
- Raw(OFF);
- ***************
- *** 293,299 ****
- (void) system_call((char *) buffer+2, SH, TRUE, TRUE);
- if (old_raw == ON)
- Raw(ON);
- ! sprintf(buffer, "~r %s%s.%d", temp_dir, temp_edit, getpid());
- read_in_file(edit_fd, (char *) buffer + 3, 0);
- (void) unlink((char *) buffer+3);
- SetXYLocation(0, 40); /* a location not near the next request, so an absolute is used */
- --- 296,302 ----
- (void) system_call((char *) buffer+2, SH, TRUE, TRUE);
- if (old_raw == ON)
- Raw(ON);
- ! sprintf(buffer, "~r %s%d.%s", temp_dir, getpid(), temp_edit);
- read_in_file(edit_fd, (char *) buffer + 3, 0);
- (void) unlink((char *) buffer+3);
- SetXYLocation(0, 40); /* a location not near the next request, so an absolute is used */
- ***************
- *** 359,365 ****
-
- char buf[SLEN];
-
- ! Write_to_screen("\n\r(Available options at this point are:\n\r\n\r", 0);
- sprintf(buf, "\t%c?\tPrint this help menu.\n\r", escape_char);
- Write_to_screen(buf, 0);
- if (escape_char == TILDE_ESCAPE) /* doesn't make sense otherwise... */
- --- 362,368 ----
-
- char buf[SLEN];
-
- ! Write_to_screen("\n\rAvailable options at this point are:\n\r\n\r", 0);
- sprintf(buf, "\t%c?\tPrint this help menu.\n\r", escape_char);
- Write_to_screen(buf, 0);
- if (escape_char == TILDE_ESCAPE) /* doesn't make sense otherwise... */
- ***************
- *** 423,429 ****
- sprintf(buf,
- "\t. \tby itself on a line (or a control-D) ends the message.\n\r");
- Write_to_screen(buf, 0);
- ! Write_to_screen("Continue.)\n\r", 0);
- }
-
- read_in_file(fd, filename, show_user_filename)
- --- 426,432 ----
- sprintf(buf,
- "\t. \tby itself on a line (or a control-D) ends the message.\n\r");
- Write_to_screen(buf, 0);
- ! Write_to_screen("(Continue.)\n\r", 0);
- }
-
- read_in_file(fd, filename, show_user_filename)
- diff -cbr orig/src/elm.c new/src/elm.c
- *** orig/src/elm.c Sun Oct 04 14:37:02 1992
- --- new/src/elm.c Mon Apr 06 20:34:15 1992
- ***************
- *** 53,59 ****
- --- 53,63 ----
- last_in_folder; /** for when we receive new mail too... **/
- long num; /** another variable for fun.. **/
- extern char version_buff[];
- + #ifndef OS2
- extern int errno;
- + #endif
- +
- + initpaths();
-
- req_mfile = parse_arguments(argc, argv, to_whom);
-
- ***************
- *** 720,731 ****
- ClearScreen();
- Raw(OFF);
-
- ! PutLine2(0,0,"Current message number = %d\t\t%d message(s) total\n",
- current, message_count);
- ! PutLine2(2,0,"Header_page = %d \t\t%d possible page(s)\n",
- header_page, (int) (message_count / headers_per_page) + 1);
-
- ! PutLine1(4,0,"\nCurrent mailfile is %s.\n\n", cur_folder);
-
- i = header_page*headers_per_page; /* starting header */
-
- --- 724,735 ----
- ClearScreen();
- Raw(OFF);
-
- ! PutLine2(0,0,"Current message number = %d\t\t%d message(s) total\r\n",
- current, message_count);
- ! PutLine2(2,0,"Header_page = %d \t\t%d possible page(s)\r\n",
- header_page, (int) (message_count / headers_per_page) + 1);
-
- ! PutLine1(4,0,"\r\nCurrent mailfile is %s.\n\r\n\r", cur_folder);
-
- i = header_page*headers_per_page; /* starting header */
-
- ***************
- *** 737,743 ****
-
- while (i <= j) {
- sprintf(buffer,
- ! "%3d %-16.16s %-40.40s %4d %d\n\r",
- i+1,
- headers[i]->from,
- headers[i]->subject,
- --- 741,747 ----
-
- while (i <= j) {
- sprintf(buffer,
- ! "%3d %-16.16s %-40.40s %4d %ld\n\r",
- i+1,
- headers[i]->from,
- headers[i]->subject,
- ***************
- *** 837,841 ****
- dprint(3, (debugfile, "Check-only: checking \n-> \"%s\"\n",
- format_long(to_whom, 3)));
- (void) build_address(strip_commas(to_whom), buffer);
- ! printf("Expands to: %s", format_long(buffer, strlen("Expands to: ")));
- }
- --- 841,845 ----
- dprint(3, (debugfile, "Check-only: checking \n-> \"%s\"\n",
- format_long(to_whom, 3)));
- (void) build_address(strip_commas(to_whom), buffer);
- ! printf("\r\nExpands to: %s\r\n", format_long(buffer, strlen("Expands to: ")));
- }
- diff -cbr orig/src/expires.c new/src/expires.c
- *** orig/src/expires.c Sat Apr 28 19:43:01 1990
- --- new/src/expires.c Sun Oct 04 09:58:01 1992
- ***************
- *** 52,58 ****
- int month = 0, day = 0, year = 0, hour = 0, minute = 0;
- #ifndef _POSIX_SOURCE
- struct tm *localtime();
- ! long time();
- #endif
-
- /** first step is to break down the date given into MM DD YY HH MM
- --- 52,58 ----
- int month = 0, day = 0, year = 0, hour = 0, minute = 0;
- #ifndef _POSIX_SOURCE
- struct tm *localtime();
- ! time_t time();
- #endif
-
- /** first step is to break down the date given into MM DD YY HH MM
- diff -cbr orig/src/file.c new/src/file.c
- *** orig/src/file.c Sun Oct 04 14:37:03 1992
- --- new/src/file.c Sat Feb 01 15:37:24 1992
- ***************
- *** 42,48 ****
- --- 42,50 ----
- #undef tolower
- #endif
-
- + #ifndef OS2
- extern int errno;
- + #endif
-
- char *error_name(), *error_description(), *strcpy(), *getenv(), *nameof();
- unsigned long sleep();
- diff -cbr orig/src/file_util.c new/src/file_util.c
- *** orig/src/file_util.c Sun Oct 04 14:37:03 1992
- --- new/src/file_util.c Fri Mar 20 23:41:26 1992
- ***************
- *** 35,47 ****
- #endif
-
- #include <signal.h>
- - #include <errno.h>
-
- #ifdef BSD
- # include <sys/wait.h>
- #endif
-
- extern int errno; /* system error number */
-
- char *error_name(), *error_description(), *strcpy(), *getlogin();
- long fsize();
- --- 35,48 ----
- #endif
-
- #include <signal.h>
-
- #ifdef BSD
- # include <sys/wait.h>
- #endif
-
- + #ifndef OS2
- extern int errno; /* system error number */
- + #endif
-
- char *error_name(), *error_description(), *strcpy(), *getlogin();
- long fsize();
- ***************
- *** 57,63 ****
- **/
-
- int ok = 1;
- - extern int errno; /* system error number! */
- struct stat buffer;
-
- if (stat(name, &buffer) != 0)
- --- 58,63 ----
- ***************
- *** 86,91 ****
- --- 86,95 ----
-
- int the_stat = 0, pid, w;
- struct stat stat_buf;
- +
- + #ifdef OS2
- + the_stat = (access(file, mode) == 0) ? 0 : (errno == 0) ? 1 : errno;
- + #else
- void _exit(), exit();
- #if defined(BSD) && !defined(WEXITSTATUS)
- union wait status;
- ***************
- *** 134,139 ****
- --- 138,145 ----
-
- signal(SIGINT, istat);
- signal(SIGQUIT, qstat);
- + #endif
- +
- if (the_stat == 0) {
- if (stat(file, &stat_buf) == 0) {
- w = stat_buf.st_mode & S_IFMT;
- ***************
- *** 159,164 ****
- --- 165,183 ----
-
- FILE *fd;
- int the_stat = 0, pid, w, preexisted = 0;
- + #ifdef OS2
- + errno = 0;
- + if (access(file, ACCESS_EXISTS) == 0)
- + preexisted = 1;
- + if ((fd = fopen(file, mode)) == NULL)
- + the_stat = errno;
- + else {
- + fclose(fd); /* don't just leave it open! */
- + if(!preexisted) /* don't leave it if this test created it! */
- + unlink(file);
- + the_stat = 0;
- + }
- + #else
- void _exit(), exit();
- #if defined(BSD) && !defined(WEXITSTATUS)
- union wait status;
- ***************
- *** 210,215 ****
- --- 229,235 ----
-
- signal(SIGINT, istat);
- signal(SIGQUIT, qstat);
- + #endif
-
- return(the_stat);
- }
- ***************
- *** 339,347 ****
- /* now display the appropriate message if there isn't mail in it */
- switch(retcode) {
-
- ! case -1: printf("You have no permission to read %s!\n\r", mfile);
- break;
- ! case 1: printf("You have no mail.\n\r");
- break;
- case 2: no_ret(firstline) /* remove newline before using */
- printf("Your mail is being forwarded to %s.\n\r",
- --- 359,367 ----
- /* now display the appropriate message if there isn't mail in it */
- switch(retcode) {
-
- ! case -1: printf("\r\nYou have no permission to read %s!\r\n", mfile);
- break;
- ! case 1: printf("\r\nYou have no mail.\r\n");
- break;
- case 2: no_ret(firstline) /* remove newline before using */
- printf("Your mail is being forwarded to %s.\n\r",
- diff -cbr orig/src/fileio.c new/src/fileio.c
- *** orig/src/fileio.c Sun Oct 04 14:37:03 1992
- --- new/src/fileio.c Sun Mar 15 16:37:22 1992
- ***************
- *** 38,44 ****
- --- 38,46 ----
- #undef tolower
- #endif
-
- + #ifndef OS2
- extern int errno;
- + #endif
-
- char *error_name(), *index();
-
- ***************
- *** 103,108 ****
- --- 105,111 ----
- if (fgets(buffer, SLEN, mailfile) == NULL)
- break;
-
- + fixline(buffer);
- front_line = next_front;
-
- if(buffer[strlen(buffer)-1] == '\n') {
- diff -cbr orig/src/forms.c new/src/forms.c
- *** orig/src/forms.c Sun Oct 04 14:37:04 1992
- --- new/src/forms.c Sun Mar 15 14:19:07 1992
- ***************
- *** 49,55 ****
- --- 49,57 ----
- #include "headers.h"
- #include <errno.h>
-
- + #ifndef OS2
- extern int errno;
- + #endif
-
- char *error_name(), *strcat(), *strcpy();
-
- ***************
- *** 103,109 ****
- return(-1);
- }
-
- ! sprintf(newfname, "%s%s%d", temp_dir, temp_form_file, getpid());
-
- if ((newform = fopen(newfname, "w")) == NULL) {
- error("Couldn't open newform file for form output!");
- --- 105,111 ----
- return(-1);
- }
-
- ! sprintf(newfname, "%s%d%s", temp_dir, getpid(), temp_form_file);
-
- if ((newform = fopen(newfname, "w")) == NULL) {
- error("Couldn't open newform file for form output!");
- ***************
- *** 136,149 ****
- error2("Error %s unlinking file %s.", error_name(errno), filename);
- return(-1);
- }
- ! if (link(newfname, filename)) {
- ! error3("Error %s linking %s to %s.", error_name(errno),
- newfname, filename);
- return(-1);
- }
- }
- !
- ! if (unlink(newfname)) {
- error2("Error %s unlinking file %s.", error_name(errno), newfname);
- return(-1);
- }
- --- 138,150 ----
- error2("Error %s unlinking file %s.", error_name(errno), filename);
- return(-1);
- }
- ! if (rename(newfname, filename)) {
- ! error3("Error %s renaming %s to %s.", error_name(errno),
- newfname, filename);
- return(-1);
- }
- }
- ! else if (unlink(newfname)) {
- error2("Error %s unlinking file %s.", error_name(errno), newfname);
- return(-1);
- }
- diff -cbr orig/src/in_utils.c new/src/in_utils.c
- *** orig/src/in_utils.c Sun Oct 04 14:37:04 1992
- --- new/src/in_utils.c Tue Aug 04 21:45:12 1992
- ***************
- *** 32,40 ****
- # undef tolower
- #endif
-
- extern int errno; /* system error number */
- -
- unsigned alarm();
-
- #define isstopchar(c) (c == ' ' || c == '\t' || c == '/')
- #define isslash(c) (c == '/')
- --- 32,41 ----
- # undef tolower
- #endif
-
- + #ifndef OS2
- extern int errno; /* system error number */
- unsigned alarm();
- + #endif
-
- #define isstopchar(c) (c == ' ' || c == '\t' || c == '/')
- #define isslash(c) (c == '/')
- ***************
- *** 479,485 ****
-
- if (timeout > 0) {
- alarm((unsigned) timeout);
- ! #ifdef BSD
- if (setjmp(GetPromptBuf)) {
- InGetPrompt = 0;
- ch = NO_OP_COMMAND;
- --- 480,486 ----
-
- if (timeout > 0) {
- alarm((unsigned) timeout);
- ! #if defined(BSD) || defined(OS2)
- if (setjmp(GetPromptBuf)) {
- InGetPrompt = 0;
- ch = NO_OP_COMMAND;
- diff -cbr orig/src/init.c new/src/init.c
- *** orig/src/init.c Sun Oct 04 14:37:04 1992
- --- new/src/init.c Sat May 23 19:38:10 1992
- ***************
- *** 80,86 ****
- --- 80,88 ----
- #undef tolower
- #endif
-
- + #ifndef OS2
- extern int errno; /* system error number on failure */
- + #endif
- extern char version_buff[];
-
- char *error_name(), *error_description();
- ***************
- *** 188,215 ****
- if ((i = InitScreen()) < 0) {
- if (i == -1) {
- printf(
- ! "Sorry, but you must specify what type of terminal you're on if you want to\n");
- printf(
- ! "run the \"elm\" program. (You need your environment variable \"TERM\" set.)\n"
- );
- dprint(1,(debugfile,"No $TERM variable in environment!\n"));
- }
- else if (i == -2) {
- printf(
- ! "You need a cursor-addressable terminal to run \"elm\" and I can't find any\n");
- printf(
- ! "kind of termcap entry for \"%s\" - check your \"TERM\" setting...\n",
- getenv("TERM"));
- dprint(1,
- (debugfile,"$TERM variable is an unknown terminal type!\n"));
- } else {
- ! printf("Failed trying to initialize your terminal entry: unknown return code %d\n", i);
- ! dprint(1, (debugfile, "Initscreen returned unknown code: %d\n",
- i));
- }
- Raw(OFF);
- exit(1); /* all the errors share this exit statement */
- }
- }
-
- if (debug < 5) { /* otherwise let the system trap 'em! */
- --- 190,222 ----
- if ((i = InitScreen()) < 0) {
- if (i == -1) {
- printf(
- ! "Sorry, but you must specify what type of terminal you're on if you want to\r\n");
- printf(
- ! "run the \"elm\" program. (You need your environment variable \"TERM\" set.)\r\n"
- );
- dprint(1,(debugfile,"No $TERM variable in environment!\n"));
- }
- else if (i == -2) {
- printf(
- ! "You need a cursor-addressable terminal to run \"elm\" and I can't find any\r\n");
- printf(
- ! "kind of termcap entry for \"%s\" - check your \"TERM\" setting...\r\n",
- getenv("TERM"));
- + printf(
- + "Or check your TERMCAP setting or termcap database file.\r\n");
- dprint(1,
- (debugfile,"$TERM variable is an unknown terminal type!\n"));
- } else {
- ! printf("Failed trying to initialize your terminal entry: unknown return code %d\r\n", i);
- ! dprint(1, (debugfile, "Initscreen returned unknown code: %d\r\n",
- i));
- }
- Raw(OFF);
- exit(1); /* all the errors share this exit statement */
- }
- + EndBold();
- + EndHalfbright();
- + EndInverse();
- }
-
- if (debug < 5) { /* otherwise let the system trap 'em! */
- ***************
- *** 217,225 ****
- signal(SIGTERM, term_signal); /* Terminate signal */
- signal(SIGILL, ill_signal); /* Illegal instruction */
- signal(SIGFPE, fpe_signal); /* Floating point exception */
- signal(SIGBUS, bus_signal); /* Bus error */
- - signal(SIGSEGV, segv_signal); /* Segmentation Violation */
- signal(SIGHUP, hup_signal); /* HangUp (line dropped) */
- }
- else {
- dprint(3,(debugfile,
- --- 224,234 ----
- signal(SIGTERM, term_signal); /* Terminate signal */
- signal(SIGILL, ill_signal); /* Illegal instruction */
- signal(SIGFPE, fpe_signal); /* Floating point exception */
- + #ifndef OS2
- signal(SIGBUS, bus_signal); /* Bus error */
- signal(SIGHUP, hup_signal); /* HangUp (line dropped) */
- + #endif
- + signal(SIGSEGV, segv_signal); /* Segmentation Violation */
- }
- else {
- dprint(3,(debugfile,
- ***************
- *** 233,239 ****
- --- 242,250 ----
- #else
- signal(SIGALRM, alarm_signal); /* Process Timer Alarm */
- #endif
- + #ifndef OS2
- signal(SIGPIPE, pipe_signal); /* Illegal Pipe Operation */
- + #endif
- #ifdef SIGTSTP
- signal(SIGTSTP, sig_user_stop); /* Suspend signal from tty */
- signal(SIGCONT, sig_return_from_user_stop); /* Continue Process */
- ***************
- *** 301,307 ****
- * use then mailhome if it is not found
- */
- if ((cp = getenv("MAIL")) == NULL)
- ! sprintf(defaultfile, "%s%s", mailhome, username);
- else
- strcpy(defaultfile, cp);
-
- --- 312,323 ----
- * use then mailhome if it is not found
- */
- if ((cp = getenv("MAIL")) == NULL)
- ! #ifdef OS2
- ! if (maildir)
- ! sprintf(defaultfile, "%s%s/newmail%s", mailhome, username, mailext);
- ! else
- ! #endif
- ! sprintf(defaultfile, "%s%s%s", mailhome, username, mailext);
- else
- strcpy(defaultfile, cp);
-
- ***************
- *** 352,361 ****
- --- 368,379 ----
-
- /** fix the shell if needed **/
-
- + #ifndef OS2
- if (shell[0] != '/') {
- sprintf(buffer, "/bin/%s", shell);
- strcpy(shell, buffer);
- }
- + #endif
-
- if (! mail_only && ! check_only) {
-
- diff -cbr orig/src/leavembox.c new/src/leavembox.c
- *** orig/src/leavembox.c Sun Oct 04 14:37:05 1992
- --- new/src/leavembox.c Sun Oct 04 10:19:26 1992
- ***************
- *** 51,56 ****
- --- 51,57 ----
- **/
-
- #include "headers.h"
- + #include <string.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #ifdef LOCK_BY_FLOCK
- ***************
- *** 84,90 ****
- --- 85,93 ----
- # endif /* NOUTIMBUF */
- #endif /* BSD */
-
- + #ifndef OS2
- extern int errno;
- + #endif
-
- char *error_name(), *error_description(), *strcpy(), *rindex();
- unsigned short getegid();
- ***************
- *** 437,443 ****
- * temp file, then remove original and copy whole temp file over.
- */
- if (to_keep > 0) {
- ! sprintf(temp_keep_file, "%s%s%d", temp_dir, temp_file, getpid());
- if ((errno = can_open(temp_keep_file, "w"))) {
- error1(
- "Permission to create temp file %s for writing denied! Leaving folder intact.",
- --- 440,446 ----
- * temp file, then remove original and copy whole temp file over.
- */
- if (to_keep > 0) {
- ! sprintf(temp_keep_file, "%s%d%s", temp_dir, getpid(), temp_file);
- if ((errno = can_open(temp_keep_file, "w"))) {
- error1(
- "Permission to create temp file %s for writing denied! Leaving folder intact.",
- ***************
- *** 486,491 ****
- --- 489,495 ----
- * folder and we aren't keeping empty non-spool folders,
- * simply remove the old original folder and that's it!
- */
- + fclose(mailfile);
- (void)unlink(cur_folder);
- #ifdef SIGTSTP
- signal(SIGTSTP, oldstop);
- ***************
- *** 534,539 ****
- --- 538,544 ----
- need_to_copy = TRUE;
-
- if(!need_to_copy) {
- + fclose(mailfile);
- unlink(cur_folder);
- if (link(temp_keep_file, cur_folder) != 0) {
- if(errno == EXDEV || errno == EEXIST) {
- ***************
- *** 651,656 ****
- --- 656,662 ----
- get_folder_type()), and put it in the static area lock_name.
- Return lock_name for informational purposes.
- **/
- + char *ptr;
-
- #ifdef XENIX
- /* lock is /tmp/[basename of file_to_lock].mlk */
- ***************
- *** 657,663 ****
- sprintf(lock_name, "/tmp/%.10s.mlk", rindex(file_to_lock, '/')+1);
- #else
- /* lock is [file_to_lock].lock */
- ! sprintf(lock_name, "%s.lock", file_to_lock);
- #endif
- return(lock_name);
- }
- --- 663,675 ----
- sprintf(lock_name, "/tmp/%.10s.mlk", rindex(file_to_lock, '/')+1);
- #else
- /* lock is [file_to_lock].lock */
- ! strcpy(lock_name, file_to_lock);
- ! #ifdef OS2
- ! if ( (ptr = strrchr(lock_name, '.')) != NULL
- ! && strcmp(ptr, mailext) == 0 )
- ! *ptr = 0;
- ! #endif
- ! strcat(lock_name, ".lck");
- #endif
- return(lock_name);
- }
- ***************
- *** 730,736 ****
- do {
-
- errno = 0;
- ! if((create_fd=open(lock_name,O_WRONLY | O_CREAT | O_EXCL,0444)) != -1)
- break;
- else {
- if(errno != EEXIST) {
- --- 742,748 ----
- do {
-
- errno = 0;
- ! if((create_fd=open(lock_name,O_WRONLY | O_CREAT | O_EXCL,0666)) != -1)
- break;
- else {
- if(errno != EEXIST) {
- ***************
- *** 767,773 ****
- } while (create_iteration++ < MAX_ATTEMPTS);
- clear_error();
-
- ! if(errno != 0) {
-
- /* we weren't able to create the lock file */
-
- --- 779,785 ----
- } while (create_iteration++ < MAX_ATTEMPTS);
- clear_error();
-
- ! if(errno != 0 && errno != ENOENT) {
-
- /* we weren't able to create the lock file */
-
- ***************
- *** 796,802 ****
- }
-
- /* we've removed the bad lock, let's try to assert lock once more */
- ! if((create_fd=open(lock_name,O_WRONLY | O_CREAT | O_EXCL,0444)) == -1){
-
- /* still can't lock it - just give up */
- dprint(1, (debugfile,
- --- 808,814 ----
- }
-
- /* we've removed the bad lock, let's try to assert lock once more */
- ! if((create_fd=open(lock_name,O_WRONLY | O_CREAT | O_EXCL,0666)) == -1){
-
- /* still can't lock it - just give up */
- dprint(1, (debugfile,
- diff -cbr orig/src/mailmsg2.c new/src/mailmsg2.c
- *** orig/src/mailmsg2.c Sun Oct 04 14:37:06 1992
- --- new/src/mailmsg2.c Sun Oct 04 11:42:08 1992
- ***************
- *** 68,74 ****
- --- 68,76 ----
- #undef toupper
- #endif
-
- + #ifndef OS2
- extern int errno;
- + #endif
- extern char version_buff[];
-
- char *error_name(), *error_description(), *strip_parens();
- ***************
- *** 111,117 ****
- **/
-
- FILE *reply, *real_reply; /* second is post-input buffer */
- ! char *whole_msg_file, *tempnam();
- char filename[SLEN], fname[SLEN], copy_file[SLEN],
- very_long_buffer[VERY_LONG_STRING], mailerflags[NLEN];
- int ch, sys_status;
- --- 113,119 ----
- **/
-
- FILE *reply, *real_reply; /* second is post-input buffer */
- ! char *whole_msg_file = NULL, *tempnam();
- char filename[SLEN], fname[SLEN], copy_file[SLEN],
- very_long_buffer[VERY_LONG_STRING], mailerflags[NLEN];
- int ch, sys_status;
- ***************
- *** 129,135 ****
-
- /** first generate the temporary filename **/
-
- ! sprintf(filename,"%s%s%d", temp_dir, temp_file, getpid());
-
- /** if possible, let's try to recall the last message? **/
-
- --- 131,137 ----
-
- /** first generate the temporary filename **/
-
- ! sprintf(filename,"%s%d%s", temp_dir, getpid(), temp_file);
-
- /** if possible, let's try to recall the last message? **/
-
- ***************
- *** 162,168 ****
- }
-
- if (copy_msg == FORM) {
- ! sprintf(fname, "%s%s%d", temp_dir, temp_form_file, getpid());
- fclose(reply); /* we can't retransmit a form! */
- if (access(fname,ACCESS_EXISTS) != 0) {
- if(batch_only)
- --- 164,170 ----
- }
-
- if (copy_msg == FORM) {
- ! sprintf(fname, "%s%d%s", temp_dir, getpid(), temp_form_file);
- fclose(reply); /* we can't retransmit a form! */
- if (access(fname,ACCESS_EXISTS) != 0) {
- if(batch_only)
- ***************
- *** 176,188 ****
- rename(fname, filename);
- }
- else if (copy_msg && ! retransmit) { /* if retransmit we have it! */
- ! if (attribution[0]) {
- fprintf(reply, attribution, headers[current-1]->from);
- fputc('\n', reply);
- }
- - else if (forwarding) {
- - fputs("Forwarded message:\n", reply);
- - }
- if (edit_message) {
- copy_message(prefixchars, reply, noheader,FALSE,FALSE,TRUE,FALSE);
- already_has_text = TRUE; /* we just added it, right? */
- --- 178,190 ----
- rename(fname, filename);
- }
- else if (copy_msg && ! retransmit) { /* if retransmit we have it! */
- ! if (forwarding) {
- ! fputs("Forwarded message:\n", reply);
- ! }
- ! else if (attribution[0]) {
- fprintf(reply, attribution, headers[current-1]->from);
- fputc('\n', reply);
- }
- if (edit_message) {
- copy_message(prefixchars, reply, noheader,FALSE,FALSE,TRUE,FALSE);
- already_has_text = TRUE; /* we just added it, right? */
- ***************
- *** 197,203 ****
- if (already_has_text ||
- (strcmp(editor,"builtin") != 0 && strcmp(editor,"none") != 0)) {
- signature_done = TRUE;
- ! if (!retransmit && copy_msg != FORM)
- already_has_text |= append_sig(reply);
- }
-
- --- 199,206 ----
- if (already_has_text ||
- (strcmp(editor,"builtin") != 0 && strcmp(editor,"none") != 0)) {
- signature_done = TRUE;
- ! if (!(forwarding && !edit_message) &&
- ! !retransmit && copy_msg != FORM)
- already_has_text |= append_sig(reply);
- }
-
- ***************
- *** 298,310 ****
-
- /** grab a copy if the user so desires... **/
-
- ! if (*copy_file) /* i.e. if copy_file contains a name */
- save_copy(expanded_to, expanded_cc, expanded_bcc,
- filename, copy_file, form);
-
- /** write all header information into whole_msg_file **/
-
- ! if((whole_msg_file=tempnam(temp_dir, "snd.")) == NULL) {
- dprint(1, (debugfile, "couldn't make temp file nam! (mail)\n"));
- if(batch_only)
- printf("Sorry - couldn't make temp file name!\n");
- --- 301,313 ----
-
- /** grab a copy if the user so desires... **/
-
- ! if (*copy_file && !no_save) /* i.e. if copy_file contains a name */
- save_copy(expanded_to, expanded_cc, expanded_bcc,
- filename, copy_file, form);
-
- /** write all header information into whole_msg_file **/
-
- ! if((whole_msg_file=tempnam(temp_dir, "snd")) == NULL) {
- dprint(1, (debugfile, "couldn't make temp file nam! (mail)\n"));
- if(batch_only)
- printf("Sorry - couldn't make temp file name!\n");
- ***************
- *** 338,345 ****
- quote_args(very_long_buffer, strip_parens(strip_commas(expanded_to)));
- strcpy(expanded_to, very_long_buffer);
-
- ! sprintf(very_long_buffer, "( (%s -s \"%s\" %s ; %s %s) & ) < %s",
- ! mailx, subject, expanded_to, remove_cmd, filename, filename);
-
- if(batch_only)
- printf("Message sent using dumb mailer %s.\n", mailx);
- --- 341,348 ----
- quote_args(very_long_buffer, strip_parens(strip_commas(expanded_to)));
- strcpy(expanded_to, very_long_buffer);
-
- ! sprintf(very_long_buffer, "%s -f %s -s \"%s\" %s",
- ! mailx, filename, subject, expanded_to);
-
- if(batch_only)
- printf("Message sent using dumb mailer %s.\n", mailx);
- ***************
- *** 389,403 ****
- strcpy(expanded_to, very_long_buffer);
- }
-
- ! sprintf(very_long_buffer,"( (%s %s %s ; %s %s) & ) < %s",
- ! mailer, mailerflags, expanded_to,
- ! remove_cmd, whole_msg_file, whole_msg_file);
- }
-
- fclose(reply);
-
- if(batch_only)
- ! printf("Sending mail...\n");
- else {
- PutLine0(LINES,0,"Sending mail...");
- CleartoEOLN();
- --- 392,405 ----
- strcpy(expanded_to, very_long_buffer);
- }
-
- ! sprintf(very_long_buffer,"%s -f %s %s %s 2>nul",
- ! mailer, whole_msg_file, mailerflags, expanded_to);
- }
-
- fclose(reply);
-
- if(batch_only)
- ! printf("Sending mail...\r\n");
- else {
- PutLine0(LINES,0,"Sending mail...");
- CleartoEOLN();
- ***************
- *** 416,422 ****
- } else {
- /* Success case: */
- if(batch_only)
- ! printf("Mail sent!\n");
- else if(mail_only)
- error("Mail sent!");
- else
- --- 418,424 ----
- } else {
- /* Success case: */
- if(batch_only)
- ! printf("Mail sent!\r\n");
- else if(mail_only)
- error("Mail sent!");
- else
- ***************
- *** 431,437 ****
- * file just hang after we're finished with it.
- */
- (void)unlink(filename);
- !
- return(need_redraw);
- }
-
- --- 433,440 ----
- * file just hang after we're finished with it.
- */
- (void)unlink(filename);
- ! (void)unlink(whole_msg_file);
- ! free(whole_msg_file);
- return(need_redraw);
- }
-
- ***************
- *** 750,759 ****
- of headers is irrelevant). Gahhhhh....
- **/
-
- - fprintf(filedesc, "Subject: %s\n", subject);
- -
- - fprintf(filedesc, "To: %s\n", format_long(long_to, strlen("To:")));
- -
- fprintf(filedesc,"Date: %s\n", get_arpa_date());
-
- #ifndef DONT_ADD_FROM
- --- 753,758 ----
- ***************
- *** 775,781 ****
- # else
- # ifdef INTERNET
- # ifdef USE_DOMAIN
- ! # ifdef MMDF
- if (is_submit_mailer)
- fprintf(filedesc,"From: %s <%s>\n", full_username, username);
- else
- --- 774,780 ----
- # else
- # ifdef INTERNET
- # ifdef USE_DOMAIN
- ! # ifdef _MMDF
- if (is_submit_mailer)
- fprintf(filedesc,"From: %s <%s>\n", full_username, username);
- else
- ***************
- *** 783,789 ****
- fprintf(filedesc,"From: %s <%s@%s>\n", full_username,
- username, hostfullname);
- # else
- ! # ifdef MMDF
- if (is_submit_mailer)
- fprintf(filedesc,"From: %s <%s>\n", full_username, username);
- else
- --- 782,788 ----
- fprintf(filedesc,"From: %s <%s@%s>\n", full_username,
- username, hostfullname);
- # else
- ! # ifdef _MMDF
- if (is_submit_mailer)
- fprintf(filedesc,"From: %s <%s>\n", full_username, username);
- else
- ***************
- *** 803,808 ****
- --- 802,811 ----
- # endif
- #endif
-
- + fprintf(filedesc, "Subject: %s\n", subject);
- +
- + fprintf(filedesc, "To: %s\n", format_long(long_to, strlen("To:")));
- +
- if (cc[0] != '\0')
- fprintf(filedesc, "Cc: %s\n", format_long(long_cc, strlen("Cc: ")));
-
- ***************
- *** 833,839 ****
- fprintf(filedesc, "Content-Type: mailform\n");
-
- #ifndef NO_XHEADER
- ! fprintf(filedesc, "X-Mailer: ELM [version %s]\n", version_buff);
- #endif /* !NO_XHEADER */
-
- putc('\n', filedesc);
- --- 836,842 ----
- fprintf(filedesc, "Content-Type: mailform\n");
-
- #ifndef NO_XHEADER
- ! fprintf(filedesc, "X-Mailer: ELM [version %s] for OS/2\n", version_buff);
- #endif /* !NO_XHEADER */
-
- putc('\n', filedesc);
- ***************
- *** 901,907 ****
- emergency_exit();
- }
- }
- ! #ifdef MMDF
- if (copy) fputs(MSG_SEPERATOR, dest);
- #else
- if (copy) fputs("\n", dest); /* ensure a blank line at the end */
- --- 904,910 ----
- emergency_exit();
- }
- }
- ! #ifdef _MMDF
- if (copy) fputs(MSG_SEPERATOR, dest);
- #else
- if (copy) fputs("\n", dest); /* ensure a blank line at the end */
- diff -cbr orig/src/mkhdrs.c new/src/mkhdrs.c
- *** orig/src/mkhdrs.c Sun Oct 04 14:37:06 1992
- --- new/src/mkhdrs.c Tue Aug 04 21:08:02 1992
- ***************
- *** 110,116 ****
- command[j++] = buffer[i];
- command[j] = '\0';
-
- ! sprintf(fname,"%s%s%d", temp_dir, temp_print, getpid());
-
- sprintf(command_buffer, "%s > %s", command, fname);
-
- --- 110,116 ----
- command[j++] = buffer[i];
- command[j] = '\0';
-
- ! sprintf(fname,"%s%d%s", temp_dir, getpid(), temp_print);
-
- sprintf(command_buffer, "%s > %s", command, fname);
-
- diff -cbr orig/src/newmbox.c new/src/newmbox.c
- *** orig/src/newmbox.c Sun Oct 04 14:37:06 1992
- --- new/src/newmbox.c Sun Oct 04 13:29:18 1992
- ***************
- *** 62,71 ****
- # include <sys/time.h>
- #endif
-
- extern int errno;
-
- char *error_name(), *error_description();
- ! char *malloc(), *realloc(), *strcpy(), *strncpy(), *rindex(), *index();
- unsigned long sleep();
- void rewind();
- void exit();
- --- 62,77 ----
- # include <sys/time.h>
- #endif
-
- + #ifndef OS2
- extern int errno;
- + #endif
-
- char *error_name(), *error_description();
- ! char *malloc(), *realloc();
- ! #ifndef __GNUC__
- ! char *alloca();
- ! #endif
- ! char *strcpy(), *strncpy(), *rindex(), *index();
- unsigned long sleep();
- void rewind();
- void exit();
- ***************
- *** 96,101 ****
- --- 102,115 ----
- int err;
- char new_tempfile[SLEN];
-
- + #ifdef OS2
- + char *new_file2 = (char *) alloca(SLEN);
- + _fullpath(new_file2, new_file, SLEN);
- + strlwr(new_file2);
- + unixpath(new_file2);
- + #define new_file new_file2
- + #endif
- +
- /* determine type of new mailfile and calculate temp file name */
- if((new_folder_type = get_folder_type(new_file)) == SPOOL)
- mk_temp_mail_fn(new_tempfile, new_file);
- ***************
- *** 124,129 ****
- --- 138,146 ----
- }
- }
-
- + if (mailfile != NULL)
- + (void) fclose(mailfile); /* close it first, to avoid too many open */
- +
- /* If we were reading a spool file and we are not just reading
- * in the additional new messages to the same file, we need to
- * remove the corresponding tempfile.
- ***************
- *** 147,156 ****
- clear_error();
- clear_central_message();
-
- ! if (mailfile != NULL)
- ! (void) fclose(mailfile); /* close it first, to avoid too many open */
- !
- ! if ((mailfile = fopen(cur_folder,"r")) == NULL) {
- if (errno != ENOENT ) { /* error on anything but file not exist */
- err = errno;
- Write_to_screen("\n\rfail on open in newmbox, open %s failed!!\n\r", 1,
- --- 164,170 ----
- clear_error();
- clear_central_message();
-
- ! if ((mailfile = fopen(cur_folder,"rb")) == NULL) {
- if (errno != ENOENT ) { /* error on anything but file not exist */
- err = errno;
- Write_to_screen("\n\rfail on open in newmbox, open %s failed!!\n\r", 1,
- ***************
- *** 206,216 ****
- * and the last character of mailhome is last slash in filename,
- * it's a spool file .
- */
- ! if((first_word(filename, mailhome)) &&
- ! ((last_slash = rindex(filename, '/')) != NULL) &&
- ! (*(last_slash+1) != '\0') &&
- ! (filename + strlen(mailhome) - 1 == last_slash))
- return(SPOOL);
- /* if file name == default mailbox, its a spool file also
- * even if its not in the spool directory. (SVR4)
- */
- --- 220,247 ----
- * and the last character of mailhome is last slash in filename,
- * it's a spool file .
- */
- ! if (first_word(filename, mailhome) &&
- ! (last_slash = rindex(filename, '/')) != NULL &&
- ! *(last_slash + 1) != '\0')
- ! {
- ! #ifdef OS2
- ! if (!maildir && filename + strlen(mailhome) - 1 == last_slash)
- ! return(SPOOL);
- ! if (maildir && strncmp(last_slash, "/newmail", 8) == 0)
- ! {
- ! char *previous_slash;
- ! *last_slash = 0;
- ! previous_slash = rindex(filename, '/');
- ! *last_slash = '/';
- ! if (previous_slash != NULL &&
- ! filename + strlen(mailhome) - 1 == previous_slash)
- ! return(SPOOL);
- ! }
- ! #else
- ! if (filename + strlen(mailhome) - 1 == last_slash)
- return(SPOOL);
- + #endif
- + }
- /* if file name == default mailbox, its a spool file also
- * even if its not in the spool directory. (SVR4)
- */
- ***************
- *** 228,244 ****
- Strangeness may result if it is not!
- **/
-
- ! char *cp;
-
- ! sprintf(tempfn, "%s%s", default_temp, temp_mbox);
- ! if((cp = rindex(mbox, '/')) != NULL) {
- ! cp++;
- ! if (strcmp(cp, "mbox") == 0 || strcmp(cp, "mailbox") == 0 ||
- ! strcmp(cp, "inbox") == 0 || *cp == '.')
- ! strcat(tempfn, username);
- else
- ! strcat(tempfn, cp);
- }
- }
-
- int
- --- 259,292 ----
- Strangeness may result if it is not!
- **/
-
- ! char *cp, mb[128];
-
- ! strcpy(tempfn, default_temp);
- ! if (tempfn[strlen (tempfn)-1] != '/')
- ! strcat(tempfn, "/");
- ! if((cp = rindex(mbox, '/')) != NULL)
- ! strcpy(mb, ++cp);
- else
- ! strcpy(mb, mbox);
- ! #ifdef OS2
- ! if ( (cp = strrchr(mb, '.')) != NULL && strlen(cp) <= 4 )
- ! *cp = 0;
- ! #endif
- ! if (strcmp(mb, "mbox") == 0 || strcmp(mb, "mailbox") == 0 ||
- ! strcmp(mb, "inbox") == 0)
- ! strcat(tempfn, username);
- ! #ifdef OS2
- ! else if (strcmp(mb, "newmail") == 0) {
- ! strcpy(mb, mbox + strlen(mailhome));
- ! cp = strchr(mb, '/');
- ! if (strncmp(cp, "/newmail", 8) == 0)
- ! *cp = 0;
- ! strcat(tempfn, mb);
- }
- + #endif
- + else
- + strcat(tempfn, mb);
- + strcat(tempfn, temp_mbox);
- }
-
- int
- ***************
- *** 266,271 ****
- --- 314,320 ----
- static int first_read = 0;
- #ifdef MMDF
- int newheader = 0;
- + int fromtoo = 1;
- #endif /* MMDF */
-
- if (folder_type == SPOOL) {
- ***************
- *** 280,286 ****
- error("Ahhhh... I give up.");
- silently_exit(); /* leave without tampering with it! */
- }
- ! if ((temp = fopen(cur_tempfolder,"w")) == NULL) {
- err = errno;
- unlock(); /* remove lock file! */
- Raw(OFF);
- --- 329,335 ----
- error("Ahhhh... I give up.");
- silently_exit(); /* leave without tampering with it! */
- }
- ! if ((temp = fopen(cur_tempfolder,"wb")) == NULL) {
- err = errno;
- unlock(); /* remove lock file! */
- Raw(OFF);
- ***************
- *** 299,305 ****
- chmod(cur_tempfolder, 0700); /* shut off file for other people! */
- }
- else {
- ! if ((temp = fopen(cur_tempfolder,"a")) == NULL) {
- err = errno;
- unlock(); /* remove lock file! */
- Raw(OFF);
- --- 348,354 ----
- chmod(cur_tempfolder, 0700); /* shut off file for other people! */
- }
- else {
- ! if ((temp = fopen(cur_tempfolder,"ab")) == NULL) {
- err = errno;
- unlock(); /* remove lock file! */
- Raw(OFF);
- ***************
- *** 333,338 ****
- --- 382,396 ----
- PutLine0(LINES-2, 0, "Reading message: 0");
- }
-
- + #ifdef MMDF
- + #ifdef OS2
- + if (fgets(buffer, LONG_STRING, mailfile)) {
- + fixline(buffer);
- + fromtoo = !mmdf_strict || strcmp(buffer, MSG_SEPERATOR) != 0;
- + }
- + rewind(mailfile);
- + #endif
- + #endif
- if (add_new_only) {
- if (fseek(mailfile, mailfile_size, 0) == -1) {
- err = errno;
- ***************
- *** 373,378 ****
- --- 431,437 ----
- rm_temps_exit();
- }
- line_bytes = (long) strlen(buffer);
- + fixline(buffer);
-
- /* Fix below to increment line count ONLY if we got a full line.
- * Input lines longer than the fgets buffer size would
- ***************
- *** 401,407 ****
- first_line = FALSE;
-
- #ifdef MMDF
- ! if (!forwarding_mail && strcmp(buffer, MSG_SEPERATOR) != 0 ) {
- #else
- if (! first_word(buffer, "From ") && !forwarding_mail) {
- #endif /* MMDF */
- --- 460,467 ----
- first_line = FALSE;
-
- #ifdef MMDF
- ! if (!forwarding_mail && strcmp(buffer, MSG_SEPERATOR) != 0
- ! && !first_word(buffer, "From ") ) {
- #else
- if (! first_word(buffer, "From ") && !forwarding_mail) {
- #endif /* MMDF */
- ***************
- *** 417,424 ****
- }
-
- #ifdef MMDF
- ! if (strcmp(buffer, MSG_SEPERATOR) == 0) {
- ! newheader = !newheader;
- #else
- if (first_word(buffer,"From ")) {
- #endif /* MMDF */
- --- 477,486 ----
- }
-
- #ifdef MMDF
- ! if (strcmp(buffer, MSG_SEPERATOR) == 0
- ! || !newheader && fromtoo && first_word(buffer,"From ")
- ! && real_from(buffer, NULL)) {
- ! newheader = 1; /* !newheader; */
- #else
- if (first_word(buffer,"From ")) {
- #endif /* MMDF */
- ***************
- *** 572,577 ****
- --- 634,640 ----
- }
- }
- else if (in_header) {
- + newheader = 0;
- #ifdef MMDF
- if (first_word(buffer,"From "))
- real_from(buffer, current_header);
- ***************
- *** 653,658 ****
- --- 716,724 ----
- c = index(current_header->mailx_status, '\n');
- if (c != NULL)
- *c = '\0';
- + c = index(current_header->mailx_status, '\r');
- + if (c != NULL)
- + *c = '\0';
- remove_possible_trailing_spaces(current_header->mailx_status);
-
- /* Okay readjust the status. If there's an 'R', message
- ***************
- *** 688,693 ****
- --- 754,761 ----
- }
- if (!in_header && first_word(buffer, START_ENCODE))
- current_header->encrypted = 1;
- + if (!in_header && first_word(buffer, "Forwarded "))
- + in_header = 1;
- fbytes += (long) line_bytes;
- }
-
- ***************
- *** 724,730 ****
- dprint(0, (debugfile, "newmbox - mbox. != spool mail length"));
- rm_temps_exit();
- }
- ! if ((mailfile = fopen(cur_tempfolder,"r")) == NULL) {
- err = errno;
- MoveCursor(LINES,0);
- Raw(OFF);
- --- 792,798 ----
- dprint(0, (debugfile, "newmbox - mbox. != spool mail length"));
- rm_temps_exit();
- }
- ! if ((mailfile = fopen(cur_tempfolder,"rb")) == NULL) {
- err = errno;
- MoveCursor(LINES,0);
- Raw(OFF);
- diff -cbr orig/src/opt_utils.c new/src/opt_utils.c
- *** orig/src/opt_utils.c Sun Oct 04 14:37:07 1992
- --- new/src/opt_utils.c Sun Mar 29 00:06:07 1992
- ***************
- *** 96,101 ****
- --- 96,102 ----
- #endif /* GETHOSTNAME */
-
-
- + #ifndef OS2
- gethostdomain(hostdom, size) /* get domain of current host */
- char *hostdom;
- int size;
- ***************
- *** 107,113 ****
- if (size < 2)
- return -1;
-
- ! if ((fp = fopen(hostdomfile, "r")) != 0) {
- fgets(buf, sizeof(buf) - 1, fp);
- fclose(fp);
- if ((p = index(buf, '\n')) != NULL)
- --- 108,116 ----
- if (size < 2)
- return -1;
-
- ! sprintf(buf, "%s/%s", elmhome, hostdomfile);
- !
- ! if ((fp = fopen(buf, "r")) != 0) {
- fgets(buf, sizeof(buf) - 1, fp);
- fclose(fp);
- if ((p = index(buf, '\n')) != NULL)
- ***************
- *** 125,130 ****
- --- 128,134 ----
-
- return 0;
- }
- + #endif
-
-
- #ifdef NEED_CUSERID
- diff -cbr orig/src/options.c new/src/options.c
- *** orig/src/options.c Sun Oct 04 14:37:07 1992
- --- new/src/options.c Sun Mar 15 14:35:10 1992
- ***************
- *** 218,223 ****
- --- 218,224 ----
- change_sort(x, y)
- int x,y;
- {
- + char *sort_name();
- /** change the sorting scheme... **/
- /** return !0 if new sort order, else 0 **/
-
- diff -cbr orig/src/pattern.c new/src/pattern.c
- *** orig/src/pattern.c Sun Oct 04 14:37:07 1992
- --- new/src/pattern.c Sat Feb 01 16:02:27 1992
- ***************
- *** 31,37 ****
- --- 31,39 ----
- static char pattern[SLEN] = { "" };
- static char alt_pattern[SLEN] = { "" };
-
- + #ifndef OS2
- extern int errno;
- + #endif
-
- char *error_name(), *shift_lower(), *strcpy();
-
- ***************
- *** 218,224 ****
-
- while (message_number < message_count) {
-
- ! if (fseek(mailfile, headers[message_number]->offset, 0L) == -1) {
-
- dprint(1, (debugfile,
- "Error: seek %ld bytes into file failed. errno %d (%s)\n",
- --- 220,226 ----
-
- while (message_number < message_count) {
-
- ! if (fseek(mailfile, headers[message_number]->offset, 0) == -1) {
-
- dprint(1, (debugfile,
- "Error: seek %ld bytes into file failed. errno %d (%s)\n",
- diff -cbr orig/src/quit.c new/src/quit.c
- *** orig/src/quit.c Sun Oct 04 14:37:08 1992
- --- new/src/quit.c Sat Feb 01 16:01:06 1992
- ***************
- *** 27,33 ****
- --- 27,35 ----
- #include "headers.h"
- #include <errno.h>
-
- + #ifndef OS2
- extern int errno; /* system error number on failure */
- + #endif
-
- long bytes();
-
- diff -cbr orig/src/read_rc.c new/src/read_rc.c
- *** orig/src/read_rc.c Sun Oct 04 14:37:08 1992
- --- new/src/read_rc.c Sun Mar 29 09:56:17 1992
- ***************
- *** 152,158 ****
-
- strcpy(raw_editor,((cp = getenv("EDITOR")) == NULL)? default_editor:cp);
-
- ! strcpy(temp_dir,((cp = getenv("TMPDIR")) == NULL)? default_temp:cp);
- if (temp_dir[strlen (temp_dir)-1] != '/')
- strcat(temp_dir, "/");
-
- --- 152,162 ----
-
- strcpy(raw_editor,((cp = getenv("EDITOR")) == NULL)? default_editor:cp);
-
- ! #ifdef OS2
- ! strcpy(temp_dir, tempdir);
- ! #else
- ! strcpy(temp_dir,((cp = getenv("TMP")) == NULL)? default_temp:cp);
- ! #endif
- if (temp_dir[strlen (temp_dir)-1] != '/')
- strcat(temp_dir, "/");
-
- ***************
- *** 169,175 ****
- strcpy(calendar_file, raw_calendar_file);
-
- /* see if the user has a $HOME/.elm directory */
- ! sprintf(filename, "%s/.elm", home);
- if (access(filename, 00) == -1) {
- if(batch_only) {
- printf("\n\rNotice:\
- --- 173,180 ----
- strcpy(calendar_file, raw_calendar_file);
-
- /* see if the user has a $HOME/.elm directory */
- ! sprintf(filename, "%s/%s", home, dotelm);
- !
- if (access(filename, 00) == -1) {
- if(batch_only) {
- printf("\n\rNotice:\
- ***************
- *** 200,210 ****
-
- /* Look for the elmrc file */
- sprintf(filename,"%s/%s", home, elmrcfile);
- if ((file = fopen(filename, "r")) == NULL) {
- dprint(2,(debugfile,"Warning:User has no \".elm/elmrc\" file\n\n"));
-
- /* look for old-style .elmrc file in $HOME */
- ! sprintf(filename, "%s/.elmrc", home);
- if (access(filename, 00) != -1) {
- move_old_files_to_new();
-
- --- 205,216 ----
-
- /* Look for the elmrc file */
- sprintf(filename,"%s/%s", home, elmrcfile);
- +
- if ((file = fopen(filename, "r")) == NULL) {
- dprint(2,(debugfile,"Warning:User has no \".elm/elmrc\" file\n\n"));
-
- /* look for old-style .elmrc file in $HOME */
- ! sprintf(filename, "%s/%src", home, dotelm);
- if (access(filename, 00) != -1) {
- move_old_files_to_new();
-
- ***************
- *** 513,518 ****
- --- 519,526 ----
- * can read them before screen is cleared */
- if(errors)
- sleep((errors * 2) + 2);
- +
- + fclose(file);
- }
-
- /* see if the user has a folders directory */
- diff -cbr orig/src/remail.c new/src/remail.c
- *** orig/src/remail.c Sun Oct 04 14:37:08 1992
- --- new/src/remail.c Mon Apr 06 19:47:29 1992
- ***************
- *** 38,44 ****
- --- 38,46 ----
- #include "headers.h"
- #include <errno.h>
-
- + #ifndef OS2
- extern int errno;
- + #endif
-
- char *error_name(), *error_description();
-
- ***************
- *** 52,57 ****
- --- 54,60 ----
- char *filename, buffer[VERY_LONG_STRING], ch;
- char mailerflags[NLEN];
- extern char *tempnam();
- + int sys_status;
-
- entered[0] = '\0';
-
- ***************
- *** 84,90 ****
-
- chown (filename, userid, groupid);
-
- ! #ifdef MMDF
- if (strcmp(submitmail, mailer) == 0)
- do_mmdf_addresses(mailfd, strip_parens(strip_commas(expanded)));
- #endif /* MMDF */
- --- 87,93 ----
-
- chown (filename, userid, groupid);
-
- ! #ifdef _MMDF
- if (strcmp(submitmail, mailer) == 0)
- do_mmdf_addresses(mailfd, strip_parens(strip_commas(expanded)));
- #endif /* MMDF */
- ***************
- *** 120,140 ****
- #endif
- strcpy(mailerflags, (sendmail_verbose ? smflagsv : smflags));
- else if (strcmp(submitmail, mailer) == 0) {
- ! strcpy(mailerflags, submitflags_s);
- strcpy(expanded, " ");
- } else
- mailerflags[0] = '\0';
-
- ! sprintf(buffer,"( (%s %s %s ; %s %s) & ) < %s",
- ! mailer, mailerflags, strip_parens(strip_commas(expanded)),
- ! remove_cmd, filename, filename);
-
- PutLine0(LINES,0,"Resending mail...");
- ! system_call(buffer, SH, FALSE, FALSE);
- set_error("Mail resent.");
-
- return(1);
- }
- #ifdef MMDF
- do_mmdf_addresses(dest_file,buffer)
- FILE *dest_file;
- --- 123,151 ----
- #endif
- strcpy(mailerflags, (sendmail_verbose ? smflagsv : smflags));
- else if (strcmp(submitmail, mailer) == 0) {
- ! strcpy(mailerflags, submitflags);
- strcpy(expanded, " ");
- } else
- mailerflags[0] = '\0';
-
- ! sprintf(buffer,"%s -f %s %s %s 2>nul", mailer, filename,
- ! mailerflags, strip_parens(strip_commas(expanded)));
-
- PutLine0(LINES,0,"Resending mail...");
- !
- ! if ( sys_status = system_call(buffer, SH, FALSE, FALSE) ) {
- ! /* problem case: */
- ! sprintf(buffer, "mailer returned error status %d", sys_status);
- ! set_error(buffer);
- ! } else {
- set_error("Mail resent.");
- + }
- +
- + unlink(filename);
-
- return(1);
- }
- +
- #ifdef MMDF
- do_mmdf_addresses(dest_file,buffer)
- FILE *dest_file;
- diff -cbr orig/src/reply.c new/src/reply.c
- *** orig/src/reply.c Sun Oct 04 14:37:09 1992
- --- new/src/reply.c Sat Feb 01 16:03:07 1992
- ***************
- *** 30,37 ****
- --- 30,39 ----
- #ifndef BSD
- # include <sys/types.h>
- # ifndef VMS
- + # ifndef OS2
- # include <sys/utsname.h>
- # endif
- + # endif
- #endif
-
- /** Note that this routine generates automatic header information
- ***************
- *** 41,47 ****
- --- 43,51 ----
-
- char *strip_parens(), *get_token();
-
- + #ifndef OS2
- extern int errno;
- + #endif
-
- char *error_name(), *strcat(), *strcpy();
-
- diff -cbr orig/src/returnadd.c new/src/returnadd.c
- *** orig/src/returnadd.c Sun Oct 04 14:37:09 1992
- --- new/src/returnadd.c Sat May 23 18:45:22 1992
- ***************
- *** 48,54 ****
- --- 48,56 ----
-
- char *shift_lower();
-
- + #ifndef OS2
- extern int errno;
- + #endif
-
- char *error_name(), *strcat(), *strcpy();
-
- ***************
- *** 245,251 ****
- char buf[SLEN], name1[SLEN], name2[SLEN], lastname[SLEN];
- char hold_return[SLEN], alt_name2[SLEN], buf2[SLEN];
- int ok = 1, lines, len_buf, len_buf2;
- ! int using_to = FALSE;
-
- /* now initialize all the char buffers [thanks Keith!] */
-
- --- 247,253 ----
- char buf[SLEN], name1[SLEN], name2[SLEN], lastname[SLEN];
- char hold_return[SLEN], alt_name2[SLEN], buf2[SLEN];
- int ok = 1, lines, len_buf, len_buf2;
- ! int using_to = FALSE, in_header = FALSE;
-
- /* now initialize all the char buffers [thanks Keith!] */
-
- ***************
- *** 275,285 ****
- --- 277,289 ----
- /** okay! Now we're there! **/
-
- lines = headers[msgnum]->lines;
- + in_header = TRUE;
-
- buffer[0] = '\0';
-
- ok = (int) (fgets(buf2, SLEN, mailfile) != NULL);
- if (ok) {
- + fixline(buf2);
- len_buf2 = strlen(buf2);
- if(buf2[len_buf2-1] == '\n') lines--; /* got a full line */
- }
- ***************
- *** 290,295 ****
- --- 294,300 ----
- len_buf = strlen(buf);
- ok = (int) (fgets(buf2, SLEN, mailfile) != NULL);
- if (ok) {
- + fixline(buf2);
- len_buf2 = strlen(buf2);
- if(buf2[len_buf2-1] == '\n') lines--; /* got a full line */
- }
- ***************
- *** 309,314 ****
- --- 314,331 ----
-
- /* At this point, "buf" contains the unfolded header line, while "buf2" contains
- the next single line of text from the mail file */
- +
- + if (in_header) {
- + if (len_buf == 1) /* \n only */
- + in_header = FALSE;
- + }
- + else {
- + if (first_word(buf, "Forwarded "))
- + in_header = TRUE;
- + }
- +
- + if (!in_header)
- + continue;
-
- if (first_word(buf, "From "))
- sscanf(buf, "%*s %s", hold_return);
- diff -cbr orig/src/save_opts.c new/src/save_opts.c
- *** orig/src/save_opts.c Sun Oct 04 14:37:09 1992
- --- new/src/save_opts.c Wed Apr 01 12:18:01 1992
- ***************
- *** 35,41 ****
- --- 35,43 ----
-
- #define absolute(x) ((x) < 0? -(x) : (x))
-
- + #ifndef OS2
- extern int errno;
- + #endif
- extern char version_buff[];
-
- char *error_name(), *sort_name();
- ***************
- *** 64,70 ****
- **/
-
- FILE *newelmrc;
- ! char oldfname[SLEN], newfname[SLEN];
-
- sprintf(newfname, "%s/%s", home, elmrcfile);
- sprintf(oldfname, "%s/%s", home, old_elmrcfile);
- --- 66,72 ----
- **/
-
- FILE *newelmrc;
- ! char oldfname[SLEN], newfname[SLEN], inffname[SLEN];
-
- sprintf(newfname, "%s/%s", home, elmrcfile);
- sprintf(oldfname, "%s/%s", home, old_elmrcfile);
- ***************
- *** 82,91 ****
- }
-
- /** now let's open the datafile if we can... **/
-
- ! if ((elminfo = fopen(ELMRC_INFO, "r")) == NULL)
- error1("Warning: saving without comments! Can't get to %s.",
- ! ELMRC_INFO);
-
- /** next, open the new .elm/elmrc file... **/
-
- --- 84,94 ----
- }
-
- /** now let's open the datafile if we can... **/
- + sprintf(inffname,"%s/%s", helphome, elmrc_info);
-
- ! if ((elminfo = fopen(inffname, "r")) == NULL)
- error1("Warning: saving without comments! Can't get to %s.",
- ! inffname);
-
- /** next, open the new .elm/elmrc file... **/
-
- diff -cbr orig/src/savecopy.c new/src/savecopy.c
- *** orig/src/savecopy.c Sun Oct 04 14:37:09 1992
- --- new/src/savecopy.c Sun Oct 04 10:05:08 1992
- ***************
- *** 39,49 ****
- char *ctime();
-
- extern char in_reply_to[SLEN]; /* In-Reply-To: string */
- extern int errno;
-
- char *strcat(), *strcpy();
- unsigned long sleep();
- ! long time();
-
- save_copy(to, cc, bcc, filename, copy_file, form)
- char *to, *cc, *bcc, *filename, *copy_file;
- --- 39,51 ----
- char *ctime();
-
- extern char in_reply_to[SLEN]; /* In-Reply-To: string */
- + #ifndef OS2
- extern int errno;
- + #endif
-
- char *strcat(), *strcpy();
- unsigned long sleep();
- ! time_t time();
-
- save_copy(to, cc, bcc, filename, copy_file, form)
- char *to, *cc, *bcc, *filename, *copy_file;
- diff -cbr orig/src/showmsg.c new/src/showmsg.c
- *** orig/src/showmsg.c Sun Oct 04 14:37:10 1992
- --- new/src/showmsg.c Sun Mar 29 22:58:23 1992
- ***************
- *** 38,44 ****
- --- 38,46 ----
- # undef tolower
- #endif
-
- + #ifndef OS2
- extern int errno;
- + #endif
-
- char *error_name(), *strcat(), *strcpy();
- void _exit();
- ***************
- *** 136,141 ****
- --- 138,147 ----
- /* put terminal out of raw mode so external pager has normal env */
- Raw(OFF);
-
- + #ifdef OS2
- + if ( (pipe_wr_fp = popen(pager, "w")) == NULL )
- + return -1;
- + #else
- /* create pipe for external pager and fork */
-
- if(pipe(pipe_fd) == -1) {
- ***************
- *** 213,218 ****
- --- 219,225 ----
- Raw(OFF);
- return(val); /* pager may have already touched the screen */
- }
- + #endif
-
- /* and that's it! */
- lines_displayed = 0;
- ***************
- *** 247,253 ****
- /* truncate or pad title2 portion on the right
- * so that line fits exactly */
- padding =
- ! COLUMNS -
- (strlen(title1) + (buf_len=strlen(title2)) + strlen(title3));
-
- sprintf(titlebuf, "%s%-*.*s%s\n", title1, buf_len+padding,
- --- 254,260 ----
- /* truncate or pad title2 portion on the right
- * so that line fits exactly */
- padding =
- ! COLUMNS - 1 -
- (strlen(title1) + (buf_len=strlen(title2)) + strlen(title3));
-
- sprintf(titlebuf, "%s%-*.*s%s\n", title1, buf_len+padding,
- ***************
- *** 422,436 ****
- --- 429,449 ----
- if (cursor_control) transmit_functions(ON);
-
- if (!builtin) {
- + #ifdef OS2
- + pclose(pipe_wr_fp);
- + #else
- fclose(pipe_wr_fp);
- while ((wait_ret = wait(&wait_stat)) != fork_ret
- && wait_ret!= -1)
- ;
- + #endif
- /* turn raw on **after** child terminates in case child
- * doesn't put us back to cooked mode after we return ourselves
- * to raw.
- */
- Raw(ON);
- + EndBold();
- + ClearScreen();
- }
-
- /* If we are to prompt for a user input command and we don't
- diff -cbr orig/src/signals.c new/src/signals.c
- *** orig/src/signals.c Sun Oct 04 14:37:10 1992
- --- new/src/signals.c Tue Aug 04 21:41:13 1992
- ***************
- *** 94,102 ****
- alarm_signal()
- {
- /** silently process alarm signal for timeouts... **/
- ! #ifdef BSD
- if (InGetPrompt)
- longjmp(GetPromptBuf, 1);
- #else
- signal(SIGALRM, alarm_signal);
- #endif
- --- 94,106 ----
- alarm_signal()
- {
- /** silently process alarm signal for timeouts... **/
- ! #if defined(BSD) || defined(OS2)
- if (InGetPrompt)
- longjmp(GetPromptBuf, 1);
- + #ifdef OS2
- + signal(SIGALRM, SIG_ACK);
- + signal(SIGALRM, alarm_signal);
- + #endif
- #else
- signal(SIGALRM, alarm_signal);
- #endif
- ***************
- *** 109,116 ****
- dprint(2, (debugfile, "*** received SIGPIPE ***\n\n"));
-
- pipe_abort = TRUE; /* internal signal ... wheeee! */
- !
- signal(SIGPIPE, pipe_signal);
- }
-
- #ifdef SIGTSTP
- --- 113,121 ----
- dprint(2, (debugfile, "*** received SIGPIPE ***\n\n"));
-
- pipe_abort = TRUE; /* internal signal ... wheeee! */
- ! #ifndef OS2
- signal(SIGPIPE, pipe_signal);
- + #endif
- }
-
- #ifdef SIGTSTP
- diff -cbr orig/src/strings.c new/src/strings.c
- *** orig/src/strings.c Sun Oct 04 14:37:10 1992
- --- new/src/strings.c Sat Mar 21 21:19:18 1992
- ***************
- *** 237,242 ****
- --- 237,243 ----
- if (strlen(word) + current_length > 80) {
- if (iindex > 0) {
- ret_buffer[iindex++] = ','; /* close 'er up, doctor! */
- + ret_buffer[iindex++] = '\r';
- ret_buffer[iindex++] = '\n';
- ret_buffer[iindex++] = '\t';
- }
- diff -cbr orig/src/syscall.c new/src/syscall.c
- *** orig/src/syscall.c Sun Oct 04 14:37:11 1992
- --- new/src/syscall.c Sun May 03 17:32:00 1992
- ***************
- *** 54,59 ****
- --- 54,63 ----
- # include <sys/wait.h>
- #endif
-
- + #ifdef OS2
- + # include <process.h>
- + #endif
- +
- char *argv_zero();
- void _exit();
-
- ***************
- *** 72,82 ****
- --- 76,91 ----
- helpful = (user_level == 0);
-
- if (helpful)
- + #ifdef OS2
- + PutLine0(LINES-3,COLUMNS-40,"(Enter empty command for a shell.)");
- + #else
- PutLine0(LINES-3,COLUMNS-40,"(Use the shell name for a shell.)");
- + #endif
- PutLine0(LINES-2,0,"Shell command: ");
- CleartoEOS();
- command[0] = '\0';
- (void) optionally_enter(command, LINES-2, 15, FALSE, FALSE);
- + #ifndef OS2
- if (command[0] == 0) {
- if (helpful)
- MoveCursor(LINES-3,COLUMNS-40);
- ***************
- *** 85,90 ****
- --- 94,100 ----
- CleartoEOS();
- return 0;
- }
- + #endif
-
- MoveCursor(LINES,0);
- CleartoEOLN();
- ***************
- *** 100,108 ****
- umask(077); /* now put it back to private for mail files */
-
- SetXYLocation(0, 40); /* a location not near the next request, so an absolute is used */
- - PutLine0(LINES, 0, "\n\nPress any key to return to ELM: ");
- Raw(ON);
- (void) getchar();
- if (old_raw == OFF)
- Raw(OFF);
- softkeys_on();
- --- 110,120 ----
- umask(077); /* now put it back to private for mail files */
-
- SetXYLocation(0, 40); /* a location not near the next request, so an absolute is used */
- Raw(ON);
- + if (command[0]) {
- + PutLine0(LINES, 0, "\r\n\r\nPress any key to return to ELM: ");
- (void) getchar();
- + }
- if (old_raw == OFF)
- Raw(OFF);
- softkeys_on();
- ***************
- *** 109,115 ****
- if (cursor_control)
- transmit_functions(ON);
-
- ! if (ret)
- error1("Return code was %d.", ret);
-
- return 1;
- --- 121,127 ----
- if (cursor_control)
- transmit_functions(ON);
-
- ! if (ret && command[0])
- error1("Return code was %d.", ret);
-
- return 1;
- ***************
- *** 151,161 ****
- --- 163,185 ----
- register int (*oldstop)(), (*oldstart)();
- # endif
- #endif
- + #ifndef OS2
- extern int errno;
- + #endif
-
- sh = (shell_type == USER_SHELL) ? shell : "/bin/sh";
- dprint(2, (debugfile, "System Call: %s\n\t%s\n", sh, string));
-
- + #ifdef OS2
- + tflush();
- +
- + if ( shell_type != USER_SHELL )
- + if ( (sh = getenv("COMSPEC")) == NULL )
- + if ( (sh = getenv("SHELL")) == NULL )
- + sh = default_shell;
- +
- + stat = spawnlp(P_WAIT, sh, sh, string[0] ? "/c" : NULL, string, NULL);
- + #else
- /*
- * Note the neat trick with close-on-exec pipes.
- * If the child's exec() succeeds, then the pipe read returns zero.
- ***************
- *** 261,266 ****
- --- 285,292 ----
- (void) signal(SIGCONT, oldstart);
- #endif
-
- + #endif /* OS2 */
- +
- return(stat);
- }
-
- ***************
- *** 318,324 ****
-
- char buffer[SLEN], filename[SLEN], printbuffer[SLEN];
- char message_list[SLEN];
- ! register int retcode, to_print;
-
- if (strlen(printout) == 0) {
- error("Don't know how to print - option \"printmail\" undefined!");
- --- 344,350 ----
-
- char buffer[SLEN], filename[SLEN], printbuffer[SLEN];
- char message_list[SLEN];
- ! register int retcode, to_print, cnt;
-
- if (strlen(printout) == 0) {
- error("Don't know how to print - option \"printmail\" undefined!");
- ***************
- *** 327,333 ****
-
- to_print = make_msg_list(message_list);
-
- ! sprintf(filename,"%s%s%d", temp_dir, temp_print, getpid());
-
- if (in_string(printout, "%s"))
- sprintf(printbuffer, printout, filename);
- --- 353,363 ----
-
- to_print = make_msg_list(message_list);
-
- ! sprintf(filename,"%s%d%s", temp_dir, getpid(), temp_print);
- ! for ( cnt = 0; filename[cnt]; cnt++ )
- ! if ( filename[cnt] == '/' )
- ! filename[cnt] = '\\';
- ! /* some OS/2 print programs :-) are very picky about forward slashes */
-
- if (in_string(printout, "%s"))
- sprintf(printbuffer, printout, filename);
- ***************
- *** 334,340 ****
- else
- sprintf(printbuffer, "%s %s", printout, filename);
-
- ! sprintf(buffer,"(%s -p -f %s%s > %s; %s 2>&1) > /dev/null",
- readmsg,
- (folder_type == NON_SPOOL ? cur_folder : cur_tempfolder),
- message_list,
- --- 364,370 ----
- else
- sprintf(printbuffer, "%s %s", printout, filename);
-
- ! sprintf(buffer,"%s -p -f %s %s >%s & %s 1>nul 2>nul",
- readmsg,
- (folder_type == NON_SPOOL ? cur_folder : cur_tempfolder),
- message_list,
- ***************
- *** 405,411 ****
- MoveCursor(LINES, 0);
- if(helpmsg)
- printf(helpmsg);
- ! sprintf(buffer, "cd %s;ls -C", folders);
- printf("\n\rContents of your folder directory:\n\r\n\r");
- system_call(buffer, SH, FALSE, FALSE);
- while(numlines--)
- --- 435,441 ----
- MoveCursor(LINES, 0);
- if(helpmsg)
- printf(helpmsg);
- ! sprintf(buffer, "dir /w \"%s\"", folders);
- printf("\n\rContents of your folder directory:\n\r\n\r");
- system_call(buffer, SH, FALSE, FALSE);
- while(numlines--)
- diff -cbr orig/src/utils.c new/src/utils.c
- *** orig/src/utils.c Sun Oct 04 14:37:11 1992
- --- new/src/utils.c Mon Apr 06 16:33:02 1992
- ***************
- *** 36,42 ****
- --- 36,44 ----
-
- #include <signal.h>
-
- + #ifndef OS2
- extern int errno;
- + #endif
-
- char *error_name();
- void exit();
- ***************
- *** 68,74 ****
-
- char source[SLEN];
- #ifdef MKDIR
- ! sprintf(source, "%s/.elm", home);
- (void) mkdir(source, 0700);
- #else
- char com[SLEN];
- --- 70,76 ----
-
- char source[SLEN];
- #ifdef MKDIR
- ! sprintf(source, "%s/%s", home, dotelm);
- (void) mkdir(source, 0700);
- #else
- char com[SLEN];
- ***************
- *** 75,83 ****
-
- /** Some systems don't have a mkdir call - how inconvienient! **/
-
- ! sprintf(com, "mkdir %s/.elm", home);
- system_call(com, SH, FALSE, FALSE);
- ! sprintf(com, "chmod 700 %s/.elm", home);
- system_call(com, SH, FALSE, FALSE);
- #endif /* MKDIR */
-
- --- 77,85 ----
-
- /** Some systems don't have a mkdir call - how inconvienient! **/
-
- ! sprintf(com, "mkdir %s/%s", home, dotelm);
- system_call(com, SH, FALSE, FALSE);
- ! sprintf(com, "chmod 700 %s/%s", home, dotelm);
- system_call(com, SH, FALSE, FALSE);
- #endif /* MKDIR */
-
- ***************
- *** 108,114 ****
- (void) system_call("newalias", SH, FALSE, FALSE);
- }
-
- ! sprintf(source, "%s/.elmheaders", home);
- if (access(source, ACCESS_EXISTS) != -1) {
- sprintf(dest, "%s/%s", home, mailheaders);
- printf("\n\rCopying from: %s\n\rCopying to: %s\n\r", source, dest);
- --- 110,116 ----
- (void) system_call("newalias", SH, FALSE, FALSE);
- }
-
- ! sprintf(source, "%s/%sheaders", home, dotelm);
- if (access(source, ACCESS_EXISTS) != -1) {
- sprintf(dest, "%s/%s", home, mailheaders);
- printf("\n\rCopying from: %s\n\rCopying to: %s\n\r", source, dest);
- ***************
- *** 115,121 ****
- copy(source, dest);
- }
-
- ! sprintf(source, "%s/.elmrc", home);
- if (access(source, ACCESS_EXISTS) != -1) {
- sprintf(dest, "%s/%s", home, elmrcfile);
- printf("\n\rCopying from: %s\n\rCopying to: %s\n\r", source, dest);
- --- 117,123 ----
- copy(source, dest);
- }
-
- ! sprintf(source, "%s/%src", home, dotelm);
- if (access(source, ACCESS_EXISTS) != -1) {
- sprintf(dest, "%s/%s", home, elmrcfile);
- printf("\n\rCopying from: %s\n\rCopying to: %s\n\r", source, dest);
- ***************
- *** 142,148 ****
- if(folder_type == SPOOL) dprint(1, (debugfile,
- " The mailbox lock file: %s\n", mk_lockname(cur_folder)));
- dprint(1, (debugfile,
- ! " The composition file : %s%s%d\n", temp_dir, temp_file, getpid()));
- dprint(1, (debugfile,
- " The readmsg data file: %s/%s\n", home, readmsg_file));
-
- --- 144,150 ----
- if(folder_type == SPOOL) dprint(1, (debugfile,
- " The mailbox lock file: %s\n", mk_lockname(cur_folder)));
- dprint(1, (debugfile,
- ! " The composition file : %s%d%s\n", temp_dir, getpid(), temp_file));
- dprint(1, (debugfile,
- " The readmsg data file: %s/%s\n", home, readmsg_file));
-
- ***************
- *** 151,161 ****
- if (hp_terminal) softkeys_off();
-
- if (cursor_control)
- ! MoveCursor(LINES, 0);
-
- PutLine0(LINES,0,
- "\nEmergency exit taken! All temp files intact!\n\n");
-
- exit(1);
- }
- rm_temps_exit()
- --- 153,164 ----
- if (hp_terminal) softkeys_off();
-
- if (cursor_control)
- ! MoveCursor(LINES-1, 0);
-
- PutLine0(LINES,0,
- "\nEmergency exit taken! All temp files intact!\n\n");
-
- + ExitScreen();
- exit(1);
- }
- rm_temps_exit()
- ***************
- *** 167,175 ****
- Raw(OFF);
- if (cursor_control) transmit_functions(OFF);
- if (hp_terminal) softkeys_off();
- ! sprintf(buffer,"%s%d",temp_file, getpid()); /* editor buffer */
- (void) unlink(buffer);
- if (folder_type == SPOOL) {
- (void) unlink(cur_tempfolder);
- }
- sprintf(buffer,"%s/%s", home, readmsg_file); /* readmsg temp */
- --- 170,180 ----
- Raw(OFF);
- if (cursor_control) transmit_functions(OFF);
- if (hp_terminal) softkeys_off();
- ! sprintf(buffer,"%d%s", getpid(), temp_file); /* editor buffer */
- (void) unlink(buffer);
- if (folder_type == SPOOL) {
- + if (mailfile)
- + fclose(mailfile);
- (void) unlink(cur_tempfolder);
- }
- sprintf(buffer,"%s/%s", home, readmsg_file); /* readmsg temp */
- ***************
- *** 176,184 ****
- (void) unlink(buffer);
- unlock(); /* remove lock file if any */
- if(!batch_only) {
- ! MoveCursor(LINES,0);
- NewLine();
- }
- exit(1);
- }
-
- --- 181,190 ----
- (void) unlink(buffer);
- unlock(); /* remove lock file if any */
- if(!batch_only) {
- ! MoveCursor(LINES-1,0);
- NewLine();
- }
- + ExitScreen();
- exit(1);
- }
-
- ***************
- *** 196,205 ****
- if (cursor_control) transmit_functions(OFF);
- if (hp_terminal) softkeys_off();
-
- ! sprintf(buffer,"%s%s%d", temp_dir, temp_file, getpid()); /* editor buffer */
- (void) unlink(buffer);
-
- if (folder_type == SPOOL) {
- (void) unlink(cur_tempfolder);
- }
-
- --- 202,213 ----
- if (cursor_control) transmit_functions(OFF);
- if (hp_terminal) softkeys_off();
-
- ! sprintf(buffer,"%s%d%s", temp_dir, getpid(), temp_file); /* editor buffer */
- (void) unlink(buffer);
-
- if (folder_type == SPOOL) {
- + if (mailfile)
- + fclose(mailfile);
- (void) unlink(cur_tempfolder);
- }
-
- ***************
- *** 209,218 ****
- unlock(); /* remove lock file if any */
-
- if(!batch_only) {
- ! MoveCursor(LINES,0);
- NewLine();
- }
-
- exit(0);
- }
-
- --- 217,227 ----
- unlock(); /* remove lock file if any */
-
- if(!batch_only) {
- ! MoveCursor(LINES-1,0);
- NewLine();
- }
-
- + ExitScreen();
- exit(0);
- }
-
- ***************
- *** 230,241 ****
- if (cursor_control) transmit_functions(OFF);
- if (hp_terminal) softkeys_off();
-
- ! sprintf(buffer,"%s%s%d", temp_dir, temp_file, getpid()); /* editor buffer */
- (void) unlink(buffer);
-
- ! MoveCursor(LINES,0);
- NewLine();
-
- exit(0);
- }
-
- --- 239,251 ----
- if (cursor_control) transmit_functions(OFF);
- if (hp_terminal) softkeys_off();
-
- ! sprintf(buffer,"%s%d%s", temp_dir, getpid(), temp_file); /* editor buffer */
- (void) unlink(buffer);
-
- ! MoveCursor(LINES-1,0);
- NewLine();
-
- + ExitScreen();
- exit(0);
- }
-
- ***************
- *** 256,268 ****
- if (cursor_control) transmit_functions(OFF);
- if (hp_terminal) softkeys_off();
-
- ! sprintf(buffer,"%s%s%d", temp_dir, temp_file, getpid()); /* editor buffer */
- (void) unlink(buffer);
-
- (void) unlink(cur_tempfolder); /* temp mailbox */
-
- ! MoveCursor(LINES,0);
- NewLine();
- exit(0);
- }
- #endif
- --- 266,281 ----
- if (cursor_control) transmit_functions(OFF);
- if (hp_terminal) softkeys_off();
-
- ! sprintf(buffer,"%s%d%s", temp_dir, getpid(), temp_file); /* editor buffer */
- (void) unlink(buffer);
-
- + if (mailfile)
- + fclose(mailfile);
- (void) unlink(cur_tempfolder); /* temp mailbox */
-
- ! MoveCursor(LINES-1,0);
- NewLine();
- + ExitScreen();
- exit(0);
- }
- #endif
- diff -cbr orig/src/validname.c new/src/validname.c
- *** orig/src/validname.c Sun Oct 04 14:37:12 1992
- --- new/src/validname.c Sat May 23 19:38:09 1992
- ***************
- *** 20,27 ****
- *
- ******************************************************************************/
-
- - #include "defs.h"
- -
- #include <stdio.h>
-
- #ifndef NOCHECK_VALIDNAME /* Force a return of valid */
- --- 20,25 ----
- ***************
- *** 32,37 ****
- --- 30,37 ----
- # endif
- #endif
-
- + #include "defs.h"
- +
- int
- valid_name(name)
- char *name;
- ***************
- *** 53,59 ****
- if(getpwnam(name) != NULL)
- return(TRUE);
-
- ! sprintf(filebuf,"%s/%s", mailhome, name);
- if (access(filebuf, ACCESS_EXISTS) == 0)
- return(TRUE);
-
- --- 53,64 ----
- if(getpwnam(name) != NULL)
- return(TRUE);
-
- ! #ifdef OS2
- ! if (maildir)
- ! sprintf(filebuf, "%s%s/newmail%s", mailhome, name, mailext);
- ! else
- ! #endif
- ! sprintf(filebuf,"%s%s%s", mailhome, name, mailext);
- if (access(filebuf, ACCESS_EXISTS) == 0)
- return(TRUE);
-
- diff -cbr orig/utils/answer.c new/utils/answer.c
- *** orig/utils/answer.c Sun Oct 04 14:37:12 1992
- --- new/utils/answer.c Sat Mar 28 17:55:24 1992
- ***************
- *** 32,44 ****
- #include <stdio.h>
- #include <fcntl.h>
- #include <ctype.h>
-
- #include "defs.h" /* ELM system definitions */
-
- #define ELM "elm" /* where the elm program lives */
-
- - #define answer_temp_file "/tmp/answer."
- -
- static char ident[] = { WHAT_STRING };
-
- struct alias_rec user_hash_table [MAX_UALIASES];
- --- 32,43 ----
- #include <stdio.h>
- #include <fcntl.h>
- #include <ctype.h>
- + #include <pwd.h>
-
- #include "defs.h" /* ELM system definitions */
-
- #define ELM "elm" /* where the elm program lives */
-
- static char ident[] = { WHAT_STRING };
-
- struct alias_rec user_hash_table [MAX_UALIASES];
- ***************
- *** 55,60 ****
- --- 54,60 ----
- char name[SLEN], user_name[SLEN];
- int msgnum = 0, eof;
-
- + initpaths();
- read_alias_files();
-
- while (1) {
- ***************
- *** 64,70 ****
-
- prompt: printf("\nMessage to: ");
- if (fgets(user_name, SLEN, stdin) == NULL) {
- ! putchar('\n');
- exit(0);
- }
- if(user_name[0] == '\0')
- --- 64,70 ----
-
- prompt: printf("\nMessage to: ");
- if (fgets(user_name, SLEN, stdin) == NULL) {
- ! putc('\n', stdout);
- exit(0);
- }
- if(user_name[0] == '\0')
- ***************
- *** 94,100 ****
- goto prompt;
- }
-
- ! sprintf(tempfile, "%s%d", answer_temp_file, msgnum++);
-
- if ((fd = fopen(tempfile,"w")) == NULL)
- exit(printf("** Fatal Error: could not open %s to write\n",
- --- 94,100 ----
- goto prompt;
- }
-
- ! sprintf(tempfile, "%s%d.ans", tempdir, msgnum++);
-
- if ((fd = fopen(tempfile,"w")) == NULL)
- exit(printf("** Fatal Error: could not open %s to write\n",
- ***************
- *** 115,124 ****
- fclose(fd);
-
- sprintf(buffer,
- ! "((%s -s \"While You Were Out\" %s ; %s %s) & ) < %s > /dev/null",
- ! ELM, strip_parens(address), remove_cmd, tempfile, tempfile);
-
- system(buffer);
- }
- }
-
- --- 115,125 ----
- fclose(fd);
-
- sprintf(buffer,
- ! "%s -s \"While You Were Out\" %s <%s >nul",
- ! ELM, strip_parens(address), tempfile);
-
- system(buffer);
- + unlink(tempfile);
- }
- }
-
- ***************
- *** 164,171 ****
-
- char fname[SLEN];
- int hash;
-
- ! sprintf(fname, "%s/.elm/aliases.hash", getenv("HOME"));
-
- if ((hash = open(fname, O_RDONLY)) == -1)
- exit(printf("** Fatal Error: Could not open %s!\n", fname));
- --- 165,183 ----
-
- char fname[SLEN];
- int hash;
- + char *getenv();
- + struct passwd *getpwuid();
- + struct passwd *pass;
- + char *homedir, *name;
- +
- + name = getenv("LOGNAME");
- + if((pass = getpwnam(name ? name : "unknown")) == NULL) {
- + printf("You have no password entry!\n");
- + exit(1);
- + }
- + homedir = pass->pw_dir;
-
- ! sprintf(fname, "%s/%s", homedir, ALIAS_HASH);
-
- if ((hash = open(fname, O_RDONLY)) == -1)
- exit(printf("** Fatal Error: Could not open %s!\n", fname));
- ***************
- *** 173,179 ****
- read(hash, user_hash_table, sizeof user_hash_table);
- close(hash);
-
- ! sprintf(fname, "%s/.elm/aliases.data", getenv("HOME"));
-
- if ((user_data = open(fname, O_RDONLY)) == -1)
- return;
- --- 185,191 ----
- read(hash, user_hash_table, sizeof user_hash_table);
- close(hash);
-
- ! sprintf(fname, "%s/%s", homedir, ALIAS_DATA);
-
- if ((user_data = open(fname, O_RDONLY)) == -1)
- return;
- ***************
- *** 317,330 ****
- space = loc + length;
- while (buffer[space] != ' ' && space > loc + 50) space--;
- for (i=loc;i <= space;i++)
- ! putchar(buffer[i]);
- ! putchar('\n');
- loc = space;
- }
- else {
- for (i=loc, len = strlen(buffer);i < len;i++)
- ! putchar(buffer[i]);
- ! putchar('\n');
- loc = len;
- }
- length = 80;
- --- 329,342 ----
- space = loc + length;
- while (buffer[space] != ' ' && space > loc + 50) space--;
- for (i=loc;i <= space;i++)
- ! putc(buffer[i], stdout);
- ! putc('\n', stdout);
- loc = space;
- }
- else {
- for (i=loc, len = strlen(buffer);i < len;i++)
- ! putc(buffer[i], stdout);
- ! putc('\n', stdout);
- loc = len;
- }
- length = 80;
- diff -cbr orig/utils/arepdaem.c new/utils/arepdaem.c
- *** orig/utils/arepdaem.c Sun Oct 04 14:37:12 1992
- --- new/utils/arepdaem.c Sun Oct 04 14:16:10 1992
- ***************
- *** 83,97 ****
-
- static char ident[] = { WHAT_STRING };
-
- ! #define arep_lock_file "LCK..arep"
-
- - #define autoreply_file "/etc/autoreply.data"
- -
- - #define logfile "/etc/autoreply.log" /* first choice */
- - #define logfile2 "/tmp/autoreply.log" /* second choice */
- -
- #define BEGINNING 0 /* see fseek(3S) for info */
- ! #define SLEEP_TIME 3600 /* run once an hour */
- #define MAX_PEOPLE 20 /* max number in program */
-
- #define EXISTS 00 /* lock file exists?? */
- --- 83,95 ----
-
- static char ident[] = { WHAT_STRING };
-
- ! char arep_lock_file[SLEN]; /* autoreply lock file */
- ! char autoreply_file[SLEN]; /* autoreply data file */
- ! char logfile[SLEN]; /* first choice */
- ! #define logfile2 ("/" AUTOREP_LOG) /* second choice */
-
- #define BEGINNING 0 /* see fseek(3S) for info */
- ! #define SLEEP_TIME 1800 /* 3600 /* run once an hour */
- #define MAX_PEOPLE 20 /* max number in program */
-
- #define EXISTS 00 /* lock file exists?? */
- ***************
- *** 130,140 ****
- --- 128,146 ----
- int person, data_changed;
- time_t time;
-
- + initpaths();
- + sprintf(autoreply_file, "%s/%s", elmhome, AUTOREP_FILE);
- + sprintf(logfile, "%s/%s", elmhome, AUTOREP_LOG);
- + sprintf(arep_lock_file, "%s/%s", elmhome, AUTOREP_LOCK);
- +
- + #ifndef OS2
- if (fork()) exit(0);
- + #endif
-
- if (! lock())
- exit(0); /* already running! */
-
- + signal(SIGINT, term_signal); /* Terminate signal */
- signal(SIGTERM, term_signal); /* Terminate signal */
-
- /*
- ***************
- *** 143,150 ****
- --- 149,158 ----
- * The idea is to disassociate from the terminal to
- * prevent signals.
- */
- + #ifndef OS2
- person = getpid();
- setpgrp(person, person);
- + #endif
-
- while (1) {
-
- ***************
- *** 210,216 ****
- if ((file = fopen(autoreply_file,"r")) == NULL) {
- log("No-one is using autoreply...");
- } else {
- ! while (fscanf(file, "%s %s %dl", username, replyfile, &size) != EOF) {
- /* check to see if this person is already in the list */
- if ((person = in_list(username)) != -1) {
- reply_table[person].in_list = 1;
- --- 218,224 ----
- if ((file = fopen(autoreply_file,"r")) == NULL) {
- log("No-one is using autoreply...");
- } else {
- ! while (fscanf(file, "%s %s %ld", username, replyfile, &size) != EOF) {
- /* check to see if this person is already in the list */
- if ((person = in_list(username)) != -1) {
- reply_table[person].in_list = 1;
- ***************
- *** 307,313 ****
-
- log("New mail for %s", reply_table[person].username);
-
- ! if ((mailfile = fopen(reply_table[person].mailfile,"r")) == NULL)
- return(log("can't open mailfile for user %s",
- reply_table[person].username));
-
- --- 315,321 ----
-
- log("New mail for %s", reply_table[person].username);
-
- ! if ((mailfile = fopen(reply_table[person].mailfile,"rb")) == NULL)
- return(log("can't open mailfile for user %s",
- reply_table[person].username));
-
- ***************
- *** 347,352 ****
- --- 355,362 ----
- if (fgets(buffer, SLEN, file) == NULL)
- return(-1);
-
- + fixline(buffer);
- +
- if (first_word(buffer, "From ")) {
- in_header++;
- sscanf(buffer, "%*s %s", hold_return);
- ***************
- *** 473,479 ****
- is to check to see if new mail has arrived.... **/
-
- int ok = 1;
- - extern int errno; /* system error number! */
- struct stat buffer;
-
- if (stat(name, &buffer) != 0)
- --- 483,488 ----
- ***************
- *** 495,501 ****
- This is to check to see if autoreply has changed.... **/
-
- int ok = 1;
- - extern int errno; /* system error number! */
- struct stat buffer;
-
- if (stat(name, &buffer) != 0)
- --- 504,509 ----
- ***************
- *** 517,525 ****
-
- char buffer[VERY_LONG_STRING];
-
- ! sprintf(buffer, "%s/fastmail -f '%s [autoreply]' -s '%s' %s %s",
- ! BIN, reply_table[person].username,
- ! subject, filename, to);
-
- system(buffer);
- }
- --- 525,532 ----
-
- char buffer[VERY_LONG_STRING];
-
- ! sprintf(buffer, "fastmail -f \"%s [autoreply]\" -s \"%s\" %s %s",
- ! reply_table[person].username, subject, filename, to);
-
- system(buffer);
- }
- ***************
- *** 536,542 ****
- long clock;
- #ifndef _POSIX_SOURCE
- struct tm *localtime();
- ! long time();
- #endif
- char buffer[SLEN];
-
- --- 543,549 ----
- long clock;
- #ifndef _POSIX_SOURCE
- struct tm *localtime();
- ! time_t time();
- #endif
- char buffer[SLEN];
-
- ***************
- *** 608,616 ****
- char lock_name[SLEN]; /* name of lock file */
- char pid_buffer[SHORT];
- int pid, create_fd;
- - extern int errno; /* system error number! */
-
- ! sprintf(lock_name, "%s/%s", LOCK_DIR, arep_lock_file);
- #ifdef PIDCHECK
- /** first, try to read the lock file, and if possible, check the pid.
- If we can validate that the pid is no longer active, then remove
- --- 615,622 ----
- char lock_name[SLEN]; /* name of lock file */
- char pid_buffer[SHORT];
- int pid, create_fd;
-
- ! strcpy(lock_name, arep_lock_file);
- #ifdef PIDCHECK
- /** first, try to read the lock file, and if possible, check the pid.
- If we can validate that the pid is no longer active, then remove
- ***************
- *** 655,660 ****
- --- 661,667 ----
- {
- /** remove lock file if it's there! **/
-
- + chmod(arep_lock_file, 0666);
- (void) unlink(arep_lock_file);
- }
-
- diff -cbr orig/utils/autoreply.c new/utils/autoreply.c
- *** orig/utils/autoreply.c Sun Oct 04 14:37:13 1992
- --- new/utils/autoreply.c Sun Mar 29 10:06:00 1992
- ***************
- *** 46,55 ****
-
- static char ident[] = { WHAT_STRING };
-
- ! #define tempdir "/tmp/arep" /* file prefix */
- ! #define autoreply_file "/etc/autoreply.data" /* autoreply data file */
-
- - extern int errno; /* system error code */
- char username[NLEN]; /* login name of user */
-
- main(argc, argv)
- --- 46,53 ----
-
- static char ident[] = { WHAT_STRING };
-
- ! char autoreply_file[SLEN]; /* autoreply data file */
-
- char username[NLEN]; /* login name of user */
-
- main(argc, argv)
- ***************
- *** 63,70 ****
- struct passwd *getpwuid();
- #endif
-
- if (argc > 2) {
- ! printf("Usage: %s <filename>\tto start autoreply,\n", argv[0]);
- printf(" %s off\t\tto turn off autoreply\n", argv[0]);
- printf(" or %s \t\tto check current status\n", argv[0]);
- exit(1);
- --- 61,71 ----
- struct passwd *getpwuid();
- #endif
-
- + initpaths();
- + sprintf(autoreply_file, "%s/%s", elmhome, AUTOREP_FILE);
- +
- if (argc > 2) {
- ! printf("\nUsage: %s <filename>\tto start autoreply,\n", argv[0]);
- printf(" %s off\t\tto turn off autoreply\n", argv[0]);
- printf(" or %s \t\tto check current status\n", argv[0]);
- exit(1);
- ***************
- *** 86,99 ****
- remove_user((argc == 1));
- else {
- strcpy(filename, argv[1]);
- if (access(filename,READ_ACCESS) != 0) {
- printf("Error: Can't read file '%s'\n", filename);
- exit(1);
- }
-
- - if (filename[0] != '/') /* prefix home directory */
- - sprintf(filename,"%s/%s", getenv("HOME"), argv[1]);
- -
- add_user(filename);
- }
-
- --- 87,101 ----
- remove_user((argc == 1));
- else {
- strcpy(filename, argv[1]);
- +
- + if (filename[0] != '/') /* prefix home directory */
- + sprintf(filename,"%s/%s", pass->pw_dir, argv[1]);
- +
- if (access(filename,READ_ACCESS) != 0) {
- printf("Error: Can't read file '%s'\n", filename);
- exit(1);
- }
-
- add_user(filename);
- }
-
- ***************
- *** 113,119 ****
- long filesize, bytes();
-
- if (! stat_only) {
- ! sprintf(tempfile, "%s.%06d", tempdir, getpid());
-
- if ((temp = fopen(tempfile, "w")) == NULL) {
- printf("Error: couldn't open tempfile '%s'. Not removed\n",
- --- 115,121 ----
- long filesize, bytes();
-
- if (! stat_only) {
- ! sprintf(tempfile, "%s%d.ar", tempdir, getpid());
-
- if ((temp = fopen(tempfile, "w")) == NULL) {
- printf("Error: couldn't open tempfile '%s'. Not removed\n",
- ***************
- *** 124,133 ****
-
- if ((repfile = fopen(autoreply_file, "r")) == NULL) {
- if (stat_only) {
- ! printf("You're not currently autoreplying to mail.\n");
- exit(0);
- }
- ! printf("No-one is autoreplying to their mail!\n");
- exit(0);
- }
-
- --- 126,135 ----
-
- if ((repfile = fopen(autoreply_file, "r")) == NULL) {
- if (stat_only) {
- ! printf("\nYou're not currently autoreplying to mail.\n");
- exit(0);
- }
- ! printf("\nNo-one is autoreplying to their mail!\n");
- exit(0);
- }
-
- ***************
- *** 143,159 ****
- }
- else {
- if (stat_only) {
- ! printf("You're currently autoreplying to mail with the file %s\n", filename);
- exit(0);
- }
- found++;
- }
-
- fclose(temp);
- fclose(repfile);
-
- if (! found) {
- ! printf("You're not currently autoreplying to mail%s\n",
- stat_only? "." : "!");
- if (! stat_only)
- unlink(tempfile);
- --- 145,163 ----
- }
- else {
- if (stat_only) {
- ! printf("\nYou're currently autoreplying to mail with the file %s\n", filename);
- exit(0);
- }
- found++;
- }
-
- + if (! stat_only)
- fclose(temp);
- +
- fclose(repfile);
-
- if (! found) {
- ! printf("\nYou're not currently autoreplying to mail%s\n",
- stat_only? "." : "!");
- if (! stat_only)
- unlink(tempfile);
- ***************
- *** 191,200 ****
- unlink(tempfile);
-
- if (found > 1)
- ! printf("Warning: your username appeared %d times!! Removed all\n",
- found);
- else
- ! printf("You've been removed from the autoreply table.\n");
- }
-
- add_user(filename)
- --- 195,204 ----
- unlink(tempfile);
-
- if (found > 1)
- ! printf("\nWarning: your username appeared %d times!! Removed all\n",
- found);
- else
- ! printf("\nYou've been removed from the autoreply table.\n");
- }
-
- add_user(filename)
- ***************
- *** 217,223 ****
-
- fclose(repfile);
-
- ! printf("You've been added to the autoreply system.\n");
- }
-
-
- --- 221,227 ----
-
- fclose(repfile);
-
- ! printf("\nYou've been added to the autoreply system.\n");
- }
-
-
- ***************
- *** 229,235 ****
- is to check to see if new mail has arrived.... **/
-
- int ok = 1;
- - extern int errno; /* system error number! */
- struct stat buffer;
-
- if (stat(name, &buffer) != 0)
- --- 233,238 ----
- diff -cbr orig/utils/expand.c new/utils/expand.c
- *** orig/utils/expand.c Sun Oct 04 14:37:13 1992
- --- new/utils/expand.c Sun May 03 16:19:14 1992
- ***************
- *** 28,36 ****
- --- 28,39 ----
- **/
-
- #include <stdio.h>
- + #include <pwd.h>
- #include "defs.h"
-
- char *expand_define();
- + static struct passwd *pass;
- + static char *home;
-
- int
- expand(filename)
- ***************
- *** 46,61 ****
- **/
-
- FILE *rcfile;
- ! char buffer[SLEN], *expanded_dir, *home, *getenv(), *bufptr;
- int foundit = 0;
-
- bufptr = (char *) buffer; /* same address */
-
- ! if ((home = getenv("HOME")) == NULL) {
- ! printf(
- ! "Can't expand environment variable $HOME to find .elmrc file!\n");
- ! return(NO);
- }
-
- sprintf(buffer, "%s/%s", home, elmrcfile);
-
- --- 49,64 ----
- **/
-
- FILE *rcfile;
- ! char buffer[SLEN], *expanded_dir, *bufptr;
- int foundit = 0;
-
- bufptr = (char *) buffer; /* same address */
-
- ! if((pass = getpwuid(getuid())) == NULL) {
- ! printf("You have no password entry!\n");
- ! exit(1);
- }
- + home = pass->pw_dir;
-
- sprintf(buffer, "%s/%s", home, elmrcfile);
-
- ***************
- *** 122,128 ****
- *value; /* char pointer for munging */
-
- if (*maildir == '~')
- ! sprintf(buffer, "%s%s", getenv("HOME"), ++maildir);
- else if (*maildir == '$') { /* shell variable */
-
- /** break it into a single word - the variable name **/
- --- 125,131 ----
- *value; /* char pointer for munging */
-
- if (*maildir == '~')
- ! sprintf(buffer, "%s%s", home, ++maildir);
- else if (*maildir == '$') { /* shell variable */
-
- /** break it into a single word - the variable name **/
- diff -cbr orig/utils/fastmail.c new/utils/fastmail.c
- *** orig/utils/fastmail.c Sun Oct 04 14:37:13 1992
- --- new/utils/fastmail.c Sun Oct 04 14:02:20 1992
- ***************
- *** 75,84 ****
-
- static char ident[] = { WHAT_STRING };
-
- - #define binrmail "/bin/rmail"
- - #define temphome "/tmp/fastmail."
- -
- -
- char *arpa_dayname[] = { "Sun", "Mon", "Tue", "Wed", "Thu",
- "Fri", "Sat", "" };
-
- --- 75,80 ----
- ***************
- *** 90,97 ****
- --- 86,95 ----
- #if defined(BSD) && !defined(_POSIX_SOURCE)
- char *timezone();
- #else
- + #ifndef OS2
- extern char *tzname[];
- #endif
- + #endif
-
- main(argc, argv)
- int argc;
- ***************
- *** 100,113 ****
-
- extern char *optarg;
- extern int optind;
- ! FILE *tempfile;
- char hostname[NLEN], username[NLEN], from_string[SLEN], subject[SLEN];
- char filename[SLEN], tempfilename[SLEN], command_buffer[256];
- char replyto[SLEN], cc_list[SLEN], bcc_list[SLEN], to_list[SLEN];
- ! char from_addr[SLEN];
- char *tmplogname;
- int c, sendmail_available, debug = 0;
-
- from_string[0] = '\0';
- subject[0] = '\0';
- replyto[0] = '\0';
- --- 98,113 ----
-
- extern char *optarg;
- extern int optind;
- ! FILE *tempfile, *mailpipe;
- char hostname[NLEN], username[NLEN], from_string[SLEN], subject[SLEN];
- char filename[SLEN], tempfilename[SLEN], command_buffer[256];
- char replyto[SLEN], cc_list[SLEN], bcc_list[SLEN], to_list[SLEN];
- ! char from_addr[SLEN], buffer[SLEN];
- char *tmplogname;
- int c, sendmail_available, debug = 0;
-
- + initpaths();
- +
- from_string[0] = '\0';
- subject[0] = '\0';
- replyto[0] = '\0';
- ***************
- *** 126,174 ****
- case 'r' : strcpy(replyto, optarg); break;
- case 's' : strcpy(subject, optarg); break;
- case '?' :
- ! fprintf(stderr,"Usage: fastmail {args} filename address(es)\n");
- ! fprintf(stderr, " where {args} can be;\n");
- ! fprintf(stderr,"\t-b bcc-list\n\t-c cc-list\n\t-d\n");
- ! fprintf(stderr,"\t-f from-name\n\t-F from-addr\n");
- ! fprintf(stderr, "\t-r reply-to\n\t-s subject\n\n");
- ! exit(1);
- }
- }
-
- ! if (optind >= argc) {
- ! fprintf(stderr,"Usage: fastmail {args} filename address(es)\n");
- ! fprintf(stderr, " where {args} can be;\n");
- ! fprintf(stderr,"\t-b bcc-list\n\t-c cc-list\n\t-d\n\t-f from-name\n");
- ! fprintf(stderr,"\t-F from-addr\n");
- ! fprintf(stderr, "\t-r reply-to\n\t-s subject\n\n");
- ! exit(1);
- ! }
-
- strcpy(filename, argv[optind++]);
-
- ! if (optind >= argc) {
- ! fprintf(stderr,"Usage: fastmail {args} filename address(es)\n");
- ! fprintf(stderr, " where {args} can be;\n");
- ! fprintf(stderr,"\t-b bcc-list\n\t-c cc-list\n\t-d\n\t-f from-name\n");
- ! fprintf(stderr,"\t-F from-addr\n");
- ! fprintf(stderr,"\t-r reply-to\n\t-s subject\n\n");
- ! exit(1);
- ! }
-
- #ifdef HOSTCOMPILED
- strncpy(hostname, HOSTNAME, sizeof(hostname));
- #else
- gethostname(hostname, sizeof(hostname));
- #endif
-
- ! tmplogname = getlogin();
- if (tmplogname != NULL)
- strcpy(username, tmplogname);
- else
- username[0] = '\0';
-
- if (strlen(username) == 0)
- cuserid(username);
-
- if (access(filename, READ_ACCESS) == -1) {
- fprintf(stderr, "Error: can't find file %s!\n", filename);
- --- 126,161 ----
- case 'r' : strcpy(replyto, optarg); break;
- case 's' : strcpy(subject, optarg); break;
- case '?' :
- ! usage();
- }
- }
-
- ! if (optind >= argc)
- ! usage();
-
- strcpy(filename, argv[optind++]);
-
- ! if (optind >= argc)
- ! usage();
-
- #ifdef HOSTCOMPILED
- strncpy(hostname, HOSTNAME, sizeof(hostname));
- #else
- gethostname(hostname, sizeof(hostname));
- + gethostdomain(buffer, sizeof(buffer));
- + strcat(hostname, buffer);
- #endif
-
- ! tmplogname = getenv("LOGNAME");
- if (tmplogname != NULL)
- strcpy(username, tmplogname);
- else
- username[0] = '\0';
-
- + #ifndef OS2
- if (strlen(username) == 0)
- cuserid(username);
- + #endif
-
- if (access(filename, READ_ACCESS) == -1) {
- fprintf(stderr, "Error: can't find file %s!\n", filename);
- ***************
- *** 175,181 ****
- exit(1);
- }
-
- ! sprintf(tempfilename, "%s%d", temphome, getpid());
-
- if ((tempfile = fopen(tempfilename, "w")) == NULL) {
- fprintf(stderr, "Couldn't open temp file %s\n", tempfilename);
- --- 162,168 ----
- exit(1);
- }
-
- ! sprintf(tempfilename, "%s%d.fm", tempdir, getpid());
-
- if ((tempfile = fopen(tempfilename, "w")) == NULL) {
- fprintf(stderr, "Couldn't open temp file %s\n", tempfilename);
- ***************
- *** 203,215 ****
- if (strlen(from_addr) > 0)
- fprintf(tempfile, "From: %s (%s)\n", from_addr, from_string);
- else
- ! fprintf(tempfile, "From: %s!%s (%s)\n", hostname, username,
- from_string);
- else
- if (strlen(from_addr) > 0)
- fprintf(tempfile, "From: %s\n", from_addr);
- else
- ! fprintf(tempfile, "From: %s!%s\n", hostname, username);
-
- fprintf(tempfile, "Date: %s\n", get_arpa_date());
-
- --- 190,202 ----
- if (strlen(from_addr) > 0)
- fprintf(tempfile, "From: %s (%s)\n", from_addr, from_string);
- else
- ! fprintf(tempfile, "From: %s@%s (%s)\n", username, hostname,
- from_string);
- else
- if (strlen(from_addr) > 0)
- fprintf(tempfile, "From: %s\n", from_addr);
- else
- ! fprintf(tempfile, "From: %s@%s\n", username, hostname);
-
- fprintf(tempfile, "Date: %s\n", get_arpa_date());
-
- ***************
- *** 243,257 ****
- --- 230,261 ----
- (strlen(bcc_list) > 0 ? " ":""), bcc_list,
- sendmail_available? "sendmail" : "rmail");
-
- + #ifdef OS2
- + sprintf(command_buffer, "%s -t", mailer);
- + #else
- sprintf(command_buffer, "cat %s %s | %s %s %s %s",
- tempfilename, filename,
- sendmail_available? sendmail : mailer,
- to_list, cc_list, bcc_list);
- + #endif
-
- if (debug)
- printf("%s\n", command_buffer);
-
- + #ifdef OS2
- + mailpipe = popen(command_buffer, "w");
- + tempfile = fopen(tempfilename, "r");
- + while ( fgets(buffer, sizeof(buffer), tempfile) != NULL )
- + fputs(buffer, mailpipe);
- + fclose(tempfile);
- + tempfile = fopen(filename, "r");
- + while ( fgets(buffer, sizeof(buffer), tempfile) != NULL )
- + fputs(buffer, mailpipe);
- + fclose(tempfile);
- + pclose(mailpipe);
- + #else
- c = system(command_buffer);
- + #endif
-
- unlink(tempfilename);
-
- ***************
- *** 259,264 ****
- --- 263,283 ----
- }
-
-
- + usage()
- + {
- + printf("\nUsage: fastmail {args} filename address(es)\n");
- + printf( "\nwhere {args} can be:\n\n");
- + printf("\t-b bcc-list addresses to send blind-carbon copies to\n");
- + printf("\t-c cc-list addresses to send carbon copies to\n");
- + printf("\t-d debug\n");
- + printf("\t-f from-name sender's full name\n");
- + printf("\t-F from-addr sender's mail address\n");
- + printf("\t-r reply-to reply-to mail address\n");
- + printf("\t-s subject subject of the message\n");
- + exit(1);
- + }
- +
- +
- char *get_arpa_date()
- {
- /** returns an ARPA standard date. The format for the date
- ***************
- *** 285,291 ****
- struct timezone time_zone;
- # endif
- #else
- ! long time();
- #endif
-
- #ifdef BSD
- --- 304,310 ----
- struct timezone time_zone;
- # endif
- #else
- ! time_t time();
- #endif
-
- #ifdef BSD
- diff -cbr orig/utils/from.c new/utils/from.c
- *** orig/utils/from.c Sun Oct 04 14:37:14 1992
- --- new/utils/from.c Sun Mar 22 11:38:16 1992
- ***************
- *** 56,61 ****
- --- 56,63 ----
- #endif
- extern int optind;
-
- + initpaths();
- +
- while ((c = getopt(argc, argv, "nv")) != EOF)
- switch (c) {
- case (int)'n': number++; break;
- ***************
- *** 65,70 ****
- --- 67,78 ----
- exit(1);
- }
-
- + if((pass = getpwuid(getuid())) == NULL) {
- + printf("You have no password entry!");
- + exit(1);
- + }
- + strcpy(username,pass->pw_name);
- +
- infile[0] = '\0';
- if (optind == argc) {
- /*
- ***************
- *** 71,95 ****
- * determine mail file from environment variable if found,
- * else use password entry
- */
- - if ((cp = getenv("MAIL")) == NULL) {
- - if((pass = getpwuid(getuid())) == NULL) {
- - printf("You have no password entry!");
- - exit(1);
- - }
- - sprintf(infile,"%s%s",mailhome, pass->pw_name);
- - }
- - else
- - strcpy(infile, cp);
- optind -= 1; /* ensure one pass through loop */
- ! }
- !
- ! #ifdef MMDF
- ! if((pass = getpwuid(getuid())) == NULL) {
- ! printf("You have no password entry!");
- ! exit(1);
- }
- - strcpy(username,pass->pw_name);
- - #endif /* MMDF */
-
- multiple_files = (argc - optind > 1);
-
- --- 79,90 ----
- * determine mail file from environment variable if found,
- * else use password entry
- */
- optind -= 1; /* ensure one pass through loop */
- ! if ((cp = getenv("MAIL")) == NULL)
- ! strcpy(infile, argv[optind] = username);
- ! else
- ! strcpy(infile, argv[optind] = cp);
- }
-
- multiple_files = (argc - optind > 1);
-
- ***************
- *** 111,119 ****
- }
-
- if ((mailfile = fopen(infile,"r")) == NULL) {
- - if (optind+1 == argc)
- - printf("No mail.\n");
- - else {
- if (infile[0] == '/')
- printf("Couldn't open folder \"%s\".\n", infile);
- else {
- --- 106,111 ----
- ***************
- *** 122,138 ****
- printf("Couldn't open folders \"%s\" or \"%s\".\n",
- argv[optind], infile);
- else {
- ! if (read_headers()==0)
- ! printf("No messages in that folder!\n");
- fclose(mailfile);
- }
- }
- - }
- } else {
- ! if (read_headers(optind+1 == argc)==0)
- ! if (optind+1 == argc)
- ! printf("No mail\n");
- ! else
- printf("No messages in that folder!\n");
- fclose(mailfile);
- }
- --- 114,126 ----
- printf("Couldn't open folders \"%s\" or \"%s\".\n",
- argv[optind], infile);
- else {
- ! if (read_headers(1)==0)
- ! printf("No mail.\n");
- fclose(mailfile);
- }
- }
- } else {
- ! if (read_headers(0)==0)
- printf("No messages in that folder!\n");
- fclose(mailfile);
- }
- ***************
- *** 164,176 ****
- }
-
- #ifdef MMDF
- ! if (strcmp(buffer, MSG_SEPERATOR) == 0) {
- ! newheader = !newheader;
- ! if (newheader) {
- subject[0] = '\0';
- in_header = 1;
- }
- - }
- #else
- if (first_word(buffer,"From ")
- && real_from(buffer, from_whom)) {
- --- 152,163 ----
- }
-
- #ifdef MMDF
- ! if (strcmp(buffer, MSG_SEPERATOR) == 0 || !newheader &&
- ! first_word(buffer,"From ") && real_from(buffer, from_whom)) {
- ! newheader = 1;
- subject[0] = '\0';
- in_header = 1;
- }
- #else
- if (first_word(buffer,"From ")
- && real_from(buffer, from_whom)) {
- ***************
- *** 180,185 ****
- --- 167,173 ----
- #endif /* MMDF */
- else if (in_header) {
- #ifdef MMDF
- + newheader = 0;
- if (first_word(buffer,"From "))
- real_from(buffer, from_whom);
- #endif /* MMDF */
- diff -cbr orig/utils/listalias.c new/utils/listalias.c
- *** orig/utils/listalias.c Sun Oct 04 14:37:14 1992
- --- new/utils/listalias.c Sun Oct 04 14:21:19 1992
- ***************
- *** 27,35 ****
-
- #include <stdio.h>
- #include <fcntl.h>
-
- #include "defs.h"
- - #include "sysdefs.h"
-
- #ifdef BSD
- FILE *popen();
- --- 27,35 ----
-
- #include <stdio.h>
- #include <fcntl.h>
- + #include <pwd.h>
-
- #include "defs.h"
-
- #ifdef BSD
- FILE *popen();
- ***************
- *** 36,41 ****
- --- 36,44 ----
- #endif
-
- char *getenv();
- + struct passwd *getpwuid();
- + struct passwd *pass;
- + char home[SLEN]; /* the users home directory */
-
- main(argc, argv)
- int argc;
- ***************
- *** 45,61 ****
- struct alias_rec hash_record;
- int hashfile, count = 0;
- char buffer[SLEN], fd_hash[SLEN],
- ! fd_data[SLEN], *home;
-
- if (argc > 2) {
- printf("Usage: listalias <optional-regular-expression>\n");
- exit(1);
- }
-
- ! home = getenv("HOME");
-
- sprintf(fd_hash, "%s/%s", home, ALIAS_HASH);
- sprintf(fd_data, "%s/%s", home, ALIAS_DATA);
-
- if (argc > 1)
- sprintf(buffer, "egrep \"%s\" | sort", argv[1]);
- --- 48,71 ----
- struct alias_rec hash_record;
- int hashfile, count = 0;
- char buffer[SLEN], fd_hash[SLEN],
- ! fd_data[SLEN];
-
- + initpaths();
- +
- if (argc > 2) {
- printf("Usage: listalias <optional-regular-expression>\n");
- exit(1);
- }
-
- ! if((pass = getpwuid(getuid())) == NULL) {
- ! printf("You have no password entry!\n");
- ! exit(1);
- ! }
- ! strcpy(home, pass->pw_dir);
-
- sprintf(fd_hash, "%s/%s", home, ALIAS_HASH);
- sprintf(fd_data, "%s/%s", home, ALIAS_DATA);
- + putc('\n', stdout);
-
- if (argc > 1)
- sprintf(buffer, "egrep \"%s\" | sort", argv[1]);
- ***************
- *** 81,87 ****
-
- while (read(hashfile, &hash_record, sizeof (hash_record)) != 0) {
- if (strlen(hash_record.name) > 0) {
- ! fseek(datafile, ntohl(hash_record.byte), 0L);
- fgets(buffer, SLEN, datafile);
- fprintf(fd_pipe, "%-15s %s", hash_record.name, buffer);
- }
- --- 91,97 ----
-
- while (read(hashfile, &hash_record, sizeof (hash_record)) != 0) {
- if (strlen(hash_record.name) > 0) {
- ! fseek(datafile, ntohl(hash_record.byte), 0);
- fgets(buffer, SLEN, datafile);
- fprintf(fd_pipe, "%-15s %s", hash_record.name, buffer);
- }
- diff -cbr orig/utils/Makefile new/utils/Makefile
- diff -cbr orig/utils/newalias.c new/utils/newalias.c
- *** orig/utils/newalias.c Sun Oct 04 14:37:14 1992
- --- new/utils/newalias.c Sun Mar 29 00:07:17 1992
- ***************
- *** 57,64 ****
-
- #include <stdio.h>
- #include "defs.h"
- - #include "sysdefs.h" /* ELM system definitions */
- #include <ctype.h>
-
- #ifdef BSD
- # include <sys/file.h>
- --- 57,64 ----
-
- #include <stdio.h>
- #include "defs.h"
- #include <ctype.h>
- + #include <pwd.h>
-
- #ifdef BSD
- # include <sys/file.h>
- ***************
- *** 85,90 ****
- --- 85,93 ----
- int is_system=0; /* system file updating? */
- int count=0; /* how many aliases so far? */
- long offset = 0L; /* data file line offset! */
- +
- + struct passwd *getpwuid();
- + struct passwd *pass;
- char home[SLEN]; /* the users home directory */
-
- main(argc, argv)
- ***************
- *** 96,126 ****
- char buffer[LONG_STRING];
- int a, hash, count = 0, owner;
-
- for (a = 1; a < argc; ++a) {
- if (strcmp(argv[a], "-g") == 0)
- is_system = 1;
- else {
- ! printf("Usage: %s [-g]\n", argv[0]);
- exit(1);
- }
- }
-
- if (is_system) { /* update system aliases */
- ! printf("Updating the system alias file...\n");
-
- - strcpy(inputname, system_text_file);
- - strcpy(hashname, system_hash_file);
- - strcpy(dataname, system_data_file);
- init_table(shash_table, MAX_SALIASES);
- }
- else
- ! printf("Updating your personal alias file...\n");
-
- if (! is_system) {
- ! if (strcpy(home, getenv("HOME")) == NULL) {
- ! printf("I'm confused - no HOME variable in environment!\n");
- exit(1);
- }
-
- sprintf(inputname, "%s/%s", home, ALIAS_TEXT);
- sprintf(hashname, "%s/%s", home, ALIAS_HASH);
- --- 99,133 ----
- char buffer[LONG_STRING];
- int a, hash, count = 0, owner;
-
- + initpaths();
- +
- for (a = 1; a < argc; ++a) {
- if (strcmp(argv[a], "-g") == 0)
- is_system = 1;
- else {
- ! printf("\nUsage: %s [-g]\n", argv[0]);
- exit(1);
- }
- }
-
- if (is_system) { /* update system aliases */
- ! printf("\nUpdating the system alias file...\n");
- !
- ! sprintf(inputname, "%s/%s", elmhome, system_text_file);
- ! sprintf(hashname, "%s/%s", elmhome, system_hash_file);
- ! sprintf(dataname, "%s/%s", elmhome, system_data_file);
-
- init_table(shash_table, MAX_SALIASES);
- }
- else
- ! printf("\nUpdating your personal alias file...\n");
-
- if (! is_system) {
- ! if((pass = getpwuid(getuid())) == NULL) {
- ! printf("You have no password entry!\n");
- exit(1);
- }
- + strcpy(home, pass->pw_dir);
-
- sprintf(inputname, "%s/%s", home, ALIAS_TEXT);
- sprintf(hashname, "%s/%s", home, ALIAS_HASH);
- ***************
- *** 144,155 ****
- }
- }
-
- ! if ((hash = open(hashname, O_WRONLY | O_TRUNC | O_CREAT, 0644)) == -1) {
- printf("Couldn't open %s for output!\n", hashname);
- exit(1);
- }
-
- ! if ((data = fopen(dataname,"w")) == NULL) {
- printf("Couldn't open %s for output!\n", dataname);
- exit(1);
- }
- --- 151,162 ----
- }
- }
-
- ! if ((hash = open(hashname, O_WRONLY | O_BINARY | O_TRUNC | O_CREAT, 0644)) == -1) {
- printf("Couldn't open %s for output!\n", hashname);
- exit(1);
- }
-
- ! if ((data = fopen(dataname,"wb")) == NULL) {
- printf("Couldn't open %s for output!\n", dataname);
- exit(1);
- }
- diff -cbr orig/utils/newmail.c new/utils/newmail.c
- *** orig/utils/newmail.c Sun Oct 04 14:37:15 1992
- --- new/utils/newmail.c Sun Mar 22 11:38:29 1992
- ***************
- *** 83,88 ****
- --- 83,89 ----
- #include <errno.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- + #include <pwd.h>
-
- #include "defs.h"
-
- ***************
- *** 138,143 ****
- --- 139,146 ----
- long lastsize,
- newsize; /* file size for comparison.. */
-
- + initpaths();
- +
- #ifdef HOSTCOMPILED
- strncpy(hostname, HOSTNAME, sizeof(hostname));
- #else
- ***************
- *** 166,172 ****
- if (ptr == argv[0] && i == 0 && argv[0][0] == 'w')
- in_window = 1;
-
- ! while ((c = getopt(argc, argv, "di:w")) != EOF) {
- switch (c) {
- case 'd' : debug++; break;
- case 'i' : interval_time = atoi(optarg); break;
- --- 169,175 ----
- if (ptr == argv[0] && i == 0 && argv[0][0] == 'w')
- in_window = 1;
-
- ! while ((c = getopt(argc, argv, "di:wh?")) != EOF) {
- switch (c) {
- case 'd' : debug++; break;
- case 'i' : interval_time = atoi(optarg); break;
- ***************
- *** 199,205 ****
- --- 202,210 ----
- (void) signal(SIGQUIT, SIG_IGN);
- }
- #endif
- + #ifdef SIGHUP
- (void) signal(SIGHUP, SIG_DFL);
- + #endif
-
- if (in_window && ! debug)
- printf("Incoming mail:\n");
- ***************
- *** 206,211 ****
- --- 211,217 ----
-
- while (1) {
-
- + #ifndef OS2
- #ifdef PIDCHECK
- if ( kill(parent_pid,0))
- exit(0);
- ***************
- *** 215,220 ****
- --- 221,227 ----
- exit();
- #endif /* AUTO_BACKGROUND */
- #endif /* PIDCHECK */
- + #endif
-
- if (! isatty(1)) /* we're not sending output to a tty any more */
- exit();
- ***************
- *** 303,309 ****
- while (fgets(buffer, SLEN, folders[current_folder].fd) != NULL) {
- #ifdef MMDF
- if (strcmp(buffer, MSG_SEPERATOR) == 0) {
- ! newheader = !newheader;
- if (newheader) {
- #else
- if (first_word(buffer,"From ")) {
- --- 310,316 ----
- while (fgets(buffer, SLEN, folders[current_folder].fd) != NULL) {
- #ifdef MMDF
- if (strcmp(buffer, MSG_SEPERATOR) == 0) {
- ! newheader = 1;
- if (newheader) {
- #else
- if (first_word(buffer,"From ")) {
- ***************
- *** 314,320 ****
- in_header = 1;
- subject[0] ='\0';
- if (in_window)
- ! putchar((char) 007); /* BEEP!*/
- else
- printf("\n\r"); /* blank lines surrounding message */
-
- --- 321,327 ----
- in_header = 1;
- subject[0] ='\0';
- if (in_window)
- ! putc((char) 007, stdout); /* BEEP!*/
- else
- printf("\n\r"); /* blank lines surrounding message */
-
- ***************
- *** 703,709 ****
- is to check to see if new mail has arrived.... **/
-
- int ok = 1;
- - extern int errno; /* system error number! */
- struct stat buffer;
-
- if (stat(name, &buffer) != 0)
- --- 710,715 ----
- ***************
- *** 722,736 ****
- /** Getting the username on some systems is a real pain, so...
- This routine is guaranteed to return a usable username **/
-
- ! char *return_value, *getlogin(), *cuserid();
- !
- ! if ((return_value = getlogin()) == NULL)
- ! if ((return_value = cuserid(NULL)) == NULL) {
- ! printf("Newmail: I can't get username!\n");
- ! exit(1);
- ! }
-
- ! return( (char *) return_value);
- }
-
- usage(name)
- --- 728,738 ----
- /** Getting the username on some systems is a real pain, so...
- This routine is guaranteed to return a usable username **/
-
- ! struct passwd *password_entry;
- ! struct passwd *getpwuid();
-
- ! if (( password_entry = getpwuid(getuid())) != NULL)
- ! return(password_entry->pw_name);
- }
-
- usage(name)
- diff -cbr orig/utils/readmsg.c new/utils/readmsg.c
- *** orig/utils/readmsg.c Sun Oct 04 14:37:15 1992
- --- new/utils/readmsg.c Sat Mar 28 23:30:29 1992
- ***************
- *** 44,49 ****
- --- 44,50 ----
-
- #include <stdio.h>
- #include <ctype.h>
- + #include <pwd.h>
-
- #include "defs.h"
-
- ***************
- *** 69,74 ****
- --- 70,78 ----
- int numcmp(); /* strcmp, but for numbers */
- char *words(); /* function defined below... */
-
- + struct passwd *getpwuid();
- + struct passwd *pass;
- + char home[SLEN]; /* the users home directory */
-
- extern char *optarg; /* for parsing the ... */
- extern int optind; /* .. starting arguments */
- ***************
- *** 84,90 ****
- infile[SLEN], /* input filename */
- buffer[SLEN], /* file reading buffer */
- string[SLEN], /* string match buffer */
- ! *cp;
-
- int current_in_queue = 0, /* these are used for... */
- current = 0, /* ...going through msgs */
- --- 88,95 ----
- infile[SLEN], /* input filename */
- buffer[SLEN], /* file reading buffer */
- string[SLEN], /* string match buffer */
- ! *cp,
- ! *prog = argv[0];
-
- int current_in_queue = 0, /* these are used for... */
- current = 0, /* ...going through msgs */
- ***************
- *** 102,107 ****
- --- 107,114 ----
- string[0] = '\0'; /* init match string to empty */
- infile[0] = '\0'; /* init mail file to empty */
-
- + initpaths();
- +
- /**** start of the actual program ****/
-
- while ((num = getopt(argc, argv, "nhf:p")) != EOF) {
- ***************
- *** 115,123 ****
- argv[0], infile);
- break;
- case 'p' : page_breaks++; break;
- ! case '?' : printf(
- ! "Usage: %s [-n|-h] [-f filename] [-p] <message list>\n",
- ! argv[0]);
- exit(1);
- }
- }
- --- 122,128 ----
- argv[0], infile);
- break;
- case 'p' : page_breaks++; break;
- ! case '?' : usage(prog);
- exit(1);
- }
- }
- ***************
- *** 135,148 ****
- /** now let's figure out the parameters to the program... **/
-
- if (argc == 1) { /* no arguments... called from 'Elm'? */
- ! sprintf(filename, "%s/%s", getenv("HOME"), readmsg_file);
- if ((file = fopen(filename, "r")) != NULL) {
- fscanf(file, "%d", &(read_message[messages++]));
- fclose(file);
- }
- else { /* no arguments AND no .readmsg file!! */
- ! fprintf(stderr,
- ! "Usage: readmsg [-n|-h] [-f filename] [-p] <message list>\n");
- exit(1);
- }
- }
- --- 140,157 ----
- /** now let's figure out the parameters to the program... **/
-
- if (argc == 1) { /* no arguments... called from 'Elm'? */
- ! if((pass = getpwuid(getuid())) == NULL) {
- ! printf("You have no password entry!\n");
- ! exit(1);
- ! }
- ! strcpy(home, pass->pw_dir);
- ! sprintf(filename, "%s/%s", home, readmsg_file);
- if ((file = fopen(filename, "r")) != NULL) {
- fscanf(file, "%d", &(read_message[messages++]));
- fclose(file);
- }
- else { /* no arguments AND no .readmsg file!! */
- ! usage(prog);
- exit(1);
- }
- }
- ***************
- *** 233,241 ****
-
- while (fgets(buffer, SLEN, file) != NULL) {
- #ifdef MMDF
- ! if (strcmp(buffer, MSG_SEPERATOR) == 0)
- ! newheader = !newheader;
- ! if (newheader && buffer[0] == '\001') {
- #else
- if (real_from(buffer)) {
- #endif /* MMDF */
- --- 242,253 ----
-
- while (fgets(buffer, SLEN, file) != NULL) {
- #ifdef MMDF
- ! if (strcmp(buffer, MSG_SEPERATOR) == 0 ||
- ! !newheader && real_from(buffer))
- ! newheader = 1; /* !newheader; */
- ! else
- ! newheader = 0;
- ! if (newheader) {
- #else
- if (real_from(buffer)) {
- #endif /* MMDF */
- ***************
- *** 248,253 ****
- --- 260,266 ----
- current++;
- not_in_header = 0; /* we're in the header! */
- }
- +
- if (current == read_message[current_in_queue] || list_all_messages)
- #ifdef MMDF
- if ((include_headers==ALL || not_in_header)
- ***************
- *** 268,273 ****
- --- 281,296 ----
- exit(0);
- }
-
- + usage(prog)
- + char *prog;
- + {
- + printf("\nUsage: %s [-n|-h] [-f filename] [-p] <message list>\n", prog);
- + printf("\n -n don't print any headers"
- + "\n -h print all headers"
- + "\n -p printf form feeds between messages\n"
- + "\n -f filename use this instead of default mailbox\n");
- + }
- +
- int
- count_messages(file)
- FILE *file;
- ***************
- *** 282,293 ****
-
- while (fgets(buffer, SLEN, file) != NULL)
- #ifdef MMDF
- ! if ((strcmp(buffer, MSG_SEPERATOR) == 0)
- ! && (++newheader % 2))
- #else
- ! if (real_from(buffer))
- #endif /* MMDF */
- count++;
-
- rewind( file );
- return( count );
- --- 305,322 ----
-
- while (fgets(buffer, SLEN, file) != NULL)
- #ifdef MMDF
- ! if (strcmp(buffer, MSG_SEPERATOR) == 0
- ! || !newheader && real_from(buffer)) {
- ! newheader = 1;
- #else
- ! if (real_from(buffer)) |
- #endif /* MMDF */
- count++;
- + }
- + #ifdef MMDF
- + else
- + newheader = 0;
- + #endif /* MMDF */
-
- rewind( file );
- return( count );
- ***************
- *** 309,320 ****
-
- while (fgets(buffer, SLEN, mailfile) != NULL) {
- #ifdef MMDF
- ! if ((strcmp(buffer, MSG_SEPERATOR) == 0)
- ! && (++newheader % 2))
- #else
- ! if (real_from(buffer))
- #endif /* MMDF */
- message_count++;
-
- if (in_string(buffer, string)) {
- read_message[messages++] = message_count;
- --- 338,355 ----
-
- while (fgets(buffer, SLEN, mailfile) != NULL) {
- #ifdef MMDF
- ! if (strcmp(buffer, MSG_SEPERATOR) == 0
- ! || !newheader && real_from(buffer)) {
- ! newheader = 1;
- #else
- ! if (real_from(buffer)) {
- #endif /* MMDF */
- message_count++;
- + }
- + #ifdef MMDF
- + else
- + newheader = 0;
- + #endif /* MMDF */
-
- if (in_string(buffer, string)) {
- read_message[messages++] = message_count;
- ***************
- *** 375,381 ****
-
- if (messages_listed++)
- if (page_break)
- ! putchar(FORMFEED);
- else
- printf(
- "\n--------------------------------------------------------------------\n\n\n");
- --- 410,416 ----
-
- if (messages_listed++)
- if (page_break)
- ! putc(FORMFEED, stdout);
- else
- printf(
- "\n--------------------------------------------------------------------\n\n\n");
- ***************
- *** 386,392 ****
- if (strlen(date) > 0) { printf("%s", date); displayed_line++;}
-
- if (displayed_line)
- ! putchar('\n');
- }
-
- char *words(word, num_words, buffer)
- --- 421,427 ----
- if (strlen(date) > 0) { printf("%s", date); displayed_line++;}
-
- if (displayed_line)
- ! putc('\n', stdout);
- }
-
- char *words(word, num_words, buffer)
-