Subject: elm 2.4 Patch #23b Summary: This is an official patch for elm 2.4 system. Please apply it. Priority: HIGH THIS IS PART 2 OF A 5 PART PATCH Fix: From rn, say "| patch -p -N -d DIR", where DIR is your elm source directory. Outside of rn, say "cd DIR; patch -p -N + * + * Revision 5.30 1993/08/03 19:28:39 syd + * Elm tries to replace the system toupper() and tolower() on current + * BSD systems, which is unnecessary. Even worse, the replacements + * collide during linking with routines in isctype.o. This patch adds + * a Configure test to determine whether replacements are really needed + * (BROKE_CTYPE definition). The header file is now included + * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled + * there. Inclusion of was removed from *all* the individual + * files, and the toupper() and tolower() routines in lib/opt_utils.c + * were dropped. + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * + * Revision 5.29 1993/08/03 19:05:33 syd + * When STDC is used on Convex the feof() function is defined as + * a true library routine in the header files and moreover the + * library routine also leaks royally. It returns always 1!! + * So we have to use a macro. Convex naturally does not provide + * you with one though if you are using a STDC compiler. So we + * have to include one. + * From: Jukka Ukkonen + * + * Revision 5.28 1993/07/20 02:59:53 syd + * Support aliases both on 64 bit and 32 bit machines at the same time. + * From: Dan Mosedale + * * Revision 5.27 1993/05/08 19:41:13 syd * make it now depend on mallocvoid * *************** *** 138,143 **** --- 178,184 ---- #include /* for fundamental types */ + #include /* Must get the _IOEOF flag for feof() on Convex */ #include "../config.h" #include "sysdefs.h" /* system/configurable defines */ *************** *** 311,318 **** #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] #define ifmain(a,b) (inalias ? b : a) --- 352,367 ---- #define DECEMBER 11 #define equal(s,w) (strcmp(s,w) == 0) ! #define min(a,b) (a) < (b) ? (a) : (b) ! /* ! * Control character mapping like "c - 'A' + 1" does not work ! * correctly for a DEL. Neither does it allow mapping from ! * a control character to the letter that is normally used with ! * an up-arrow prefix to represent the control char. ! * The correct mapping should be done like this... ! */ ! #define ctrl(c) (((c) + '@') & 0x7f) ! #define plural(n) n == 1 ? "" : "s" #define lastch(s) s[strlen(s)-1] #define ifmain(a,b) (inalias ? b : a) *************** *** 482,487 **** --- 531,553 ---- char mailx_status[WLEN];/** mailx status flags (RO...) **/ }; + #ifdef __alpha + #define int32 int + #else + #define int32 long + #endif + + struct alias_disk_rec { + int32 status; /* DELETED, TAGGED, VISIBLE, ... */ + int32 alias; /* alias name */ + int32 last_name; /* actual personal (last) name */ + int32 name; /* actual personal name (first last) */ + int32 comment; /* comment, doesn't show in headers */ + int32 address; /* non expanded address */ + int32 type; /* mask-- sys/user, person/group */ + int32 length; /* length of alias data on file */ + }; + struct alias_rec { int status; /* DELETED, TAGGED, VISIBLE, ... */ char *alias; /* alias name */ *************** *** 530,535 **** --- 596,615 ---- # include # endif #endif + + #ifdef __convex__ + /* + * Nice work Convex people! Thanks a million! + * When STDC is used feof() is defined as a true library routine + * in the header files and moreover the library routine also leaks + * royally. (It returns always 1!!) Consequently this macro is + * unavoidable.) + */ + # ifndef feof + # define feof(p) ((p)->_flag&_IOEOF) + # endif + #endif + #ifndef ANSI_C /* ANSI puts these in string.h */ char *index(), *rindex(); /* names will be traslated by define in config.h */ char *strtok(), *strcpy(), *strcat(), *strncpy(); /* more in string.h in ANSI */ *************** *** 573,583 **** #ifdef POSIX_SIGNALS #define signal posix_signal ! #ifdef __STDC__ extern SIGHAND_TYPE (*posix_signal(int, SIGHAND_TYPE (*)(int)))(int); ! #else /* __STDC__ */ extern SIGHAND_TYPE (*posix_signal())(); ! #endif /* __STDC__ */ #else /* POSIX_SIGNALS */ #ifdef SIGSET #define signal sigset --- 653,663 ---- #ifdef POSIX_SIGNALS #define signal posix_signal ! #if ANSI_C extern SIGHAND_TYPE (*posix_signal(int, SIGHAND_TYPE (*)(int)))(int); ! #else /* ANSI_C */ extern SIGHAND_TYPE (*posix_signal())(); ! #endif /* ANSI_C */ #else /* POSIX_SIGNALS */ #ifdef SIGSET #define signal sigset *************** *** 587,592 **** --- 667,695 ---- #endif /* SIGSET */ #endif /* POSIX_SIGNALS */ + /* + * Some of the old BSD ctype conversion macros corrupted characters. + * We will substitute our own versions if required. + */ + #include + #ifdef BROKE_CTYPE + # undef toupper + # define toupper(c) (islower(c) ? ((c) - 'a' + 'A') : (c)) + # undef tolower + # define tolower(c) (isupper(c) ? ((c) - 'A' + 'a') : (c)) + #endif + + /* + * if the seek constants arent set in an include file + * lets define them ourselves + */ + #ifndef SEEK_SET + #define SEEK_SET 0 /* Set file pointer to "offset" */ + #define SEEK_CUR 1 /* Set file pointer to current plus "offset" */ + #define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ + #endif + + /* * The "safe_malloc_fail_handler" vector points to a routine that is invoked * if one of the safe_malloc() routines fails. At startup, this will point Index: hdrs/elm.h Prereq: 5.9 *** ../elm2.4/hdrs/elm.h Sat May 8 16:03:17 1993 --- hdrs/elm.h Tue Aug 10 14:49:33 1993 *************** *** 1,8 **** ! /* $Id: elm.h,v 5.9 1993/05/08 20:03:12 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 5.9 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- ! /* $Id: elm.h,v 5.10 1993/08/10 18:49:32 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 5.10 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,27 ---- * ******************************************************************************* * $Log: elm.h,v $ + * Revision 5.10 1993/08/10 18:49:32 syd + * When an environment variable was given as the tmpdir definition the src + * and dest overlapped in expand_env. This made elm produce a garbage + * expansion because expand_env cannot cope with overlapping src and + * dest. I added a new variable raw_temp_dir to keep src and dest not to + * overlap. + * From: Jukka Ukkonen + * * Revision 5.9 1993/05/08 20:03:12 syd * add sleepmsg to list * *************** *** 115,120 **** --- 123,129 ---- char cur_tempfolder[SLEN] = {0};/* name of temp folder open for a mailbox */ char defaultfile[SLEN] = {0}; /* name of default folder */ char temp_dir[SLEN] = {0}; /* name of temp directory */ + char raw_temp_dir[SLEN] = {0}; /* unexpanded name of temp directory */ char hostname[SLEN] = {0}; /* name of machine we're on*/ char hostdomain[SLEN] = {0}; /* name of domain we're in */ char hostfullname[SLEN] = {0}; /* name of FQDN we're in */ Index: hdrs/filter.h Prereq: 5.10 *** ../elm2.4/hdrs/filter.h Sun Jun 6 14:24:47 1993 --- hdrs/filter.h Tue Aug 3 15:28:44 1993 *************** *** 1,8 **** ! /* $Id: filter.h,v 5.10 1993/06/06 17:34:40 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 5.10 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- ! /* $Id: filter.h,v 5.11 1993/08/03 19:28:39 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 5.11 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,31 ---- * ******************************************************************************* * $Log: filter.h,v $ + * Revision 5.11 1993/08/03 19:28:39 syd + * Elm tries to replace the system toupper() and tolower() on current + * BSD systems, which is unnecessary. Even worse, the replacements + * collide during linking with routines in isctype.o. This patch adds + * a Configure test to determine whether replacements are really needed + * (BROKE_CTYPE definition). The header file is now included + * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled + * there. Inclusion of was removed from *all* the individual + * files, and the toupper() and tolower() routines in lib/opt_utils.c + * were dropped. + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * * Revision 5.10 1993/06/06 17:34:40 syd * remove useless _vbuf definition * *************** *** 68,77 **** #include "regexp.h" - #ifdef BSD - # undef tolower - #endif - /** define a few handy macros for later use... **/ #define the_same(a,b) (strncmp(a,b,strlen(b)) == 0) --- 80,85 ---- Index: hdrs/headers.h Prereq: 5.10 *** ../elm2.4/hdrs/headers.h Sat May 8 16:03:18 1993 --- hdrs/headers.h Tue Aug 10 16:49:55 1993 *************** *** 1,8 **** ! /* $Id: headers.h,v 5.10 1993/05/08 20:03:12 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 5.10 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- ! /* $Id: headers.h,v 5.11 1993/08/10 20:49:40 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 5.11 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,22 ---- * ******************************************************************************* * $Log: headers.h,v $ + * Revision 5.11 1993/08/10 20:49:40 syd + * Add raw_temp_dir + * * Revision 5.10 1993/05/08 20:03:12 syd * add sleepmsg to list * *************** *** 115,120 **** --- 118,124 ---- extern char cur_tempfolder[SLEN]; /* name of temp folder open for a mailbox */ extern char defaultfile[SLEN]; /* name of default folder */ extern char temp_dir[SLEN]; /* name of temp directory */ + extern char raw_temp_dir[SLEN]; /* unexpanded name of temp directory */ extern char hostname[SLEN]; /* name of machine we're on*/ extern char hostdomain[SLEN]; /* name of domain we're in */ extern char hostfullname[SLEN]; /* name of FQDN we're in */ Index: hdrs/mcprt.h *** ../elm2.4/hdrs/mcprt.h Sat Oct 3 18:35:08 1992 --- hdrs/mcprt.h Sun Aug 22 22:46:28 1993 *************** *** 48,56 **** --- 48,62 ---- #include #ifdef USENLS + # ifdef I_STDARG + extern int MCprintf(char *fmt, ...); + extern int MCfprintf(FILE *fptr, char *fmt, ...); + extern int MCsprintf(char *cptr, char *fmt, ...); + # else extern int MCprintf(); extern int MCfprintf(); extern int MCsprintf(); + # endif #endif #endif Index: hdrs/mcprtlib.h *** ../elm2.4/hdrs/mcprtlib.h Sat Oct 3 18:35:09 1992 --- hdrs/mcprtlib.h Sun Aug 22 22:48:18 1993 *************** *** 41,47 **** 03/20/91 2 schulert Ultrix cc has trouble with void*, so change them to int* 01/18/91 3 hamilton #if not rescanned 01/12/91 1 schulert conditionally use prototypes ! rework to use either varargs or stdargs 11/03/90 2 hamilton Alphalpha->Alfalfa & OmegaMail->Poste 08/10/90 1 nazgul Initial version */ --- 41,47 ---- 03/20/91 2 schulert Ultrix cc has trouble with void*, so change them to int* 01/18/91 3 hamilton #if not rescanned 01/12/91 1 schulert conditionally use prototypes ! rework to use either varargs or stdarg 11/03/90 2 hamilton Alphalpha->Alfalfa & OmegaMail->Poste 08/10/90 1 nazgul Initial version */ *************** *** 49,56 **** --- 49,61 ---- /* taken from Xm/lib/VaSimple.h currently no one defines MISSING_STDARG_H */ + #ifdef I_STDARG + # include + # define Va_start(a,b) va_start(a,b) + #else # include # define Va_start(a,b) va_start(a) + #endif #define MCFree 0x0010 /* Reminder to MCPrintFree */ #define MCCatalog 0x0100 /* Probably came from catalog */ Index: hdrs/ndbz.h Prereq: 5.2 *** ../elm2.4/hdrs/ndbz.h Sat Oct 10 21:47:09 1992 --- hdrs/ndbz.h Mon Jul 19 22:59:54 1993 *************** *** 1,8 **** ! /* $Id: ndbz.h,v 5.2 1992/10/11 01:46:35 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 5.2 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- ! /* $Id: ndbz.h,v 5.3 1993/07/20 02:59:53 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 5.3 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,23 ---- * ******************************************************************************* * $Log: ndbz.h,v $ + * Revision 5.3 1993/07/20 02:59:53 syd + * Support aliases both on 64 bit and 32 bit machines at the same time. + * From: Dan Mosedale + * * Revision 5.2 1992/10/11 01:46:35 syd * change dbm name to dbz to avoid conflicts with partial call * ins from shared librarys, and from mixing code with yp code. *************** *** 57,63 **** * to have a distinctive name for it. Beware, this is just for readability, * don't try to change this. */ ! #define of_t long #define SOF (sizeof(of_t)) /* --- 61,73 ---- * to have a distinctive name for it. Beware, this is just for readability, * don't try to change this. */ ! ! /* ! * Big kludge: this is set up as 32-bit rather than a long so that ndbz db's ! * will work across NFS on 64 bit machines as well as 32 bit machines. ! */ ! ! #define of_t int32 #define SOF (sizeof(of_t)) /* Index: hdrs/s_elm.h *** ../elm2.4/hdrs/s_elm.h Mon May 31 15:35:18 1993 --- hdrs/s_elm.h Tue Aug 3 14:58:35 1993 *************** *** 1,4 **** ! /* s_elm.h created from s_elm.us by gencat on Mon May 31 15:35:18 EDT 1993 */ #define ElmSet 0x3 #define ElmYes 0x1 --- 1,4 ---- ! /* s_elm.h created from s_elm.us by gencat on Tue Aug 3 14:58:35 EDT 1993 */ #define ElmSet 0x3 #define ElmYes 0x1 *************** *** 499,505 **** #define ElmTooManyWeedHeaders 0x233 #define ElmTooManyWeedPmalloc 0x234 #define ElmNoMemDefaultWeed 0x235 ! #define ElmCantExpandEnvVar 0x236 #define ElmCouldntMakeTempFileName 0x237 #define ElmCouldntOpenForWriting 0x238 #define ElmSureYouWantToRemail 0x239 --- 499,505 ---- #define ElmTooManyWeedHeaders 0x233 #define ElmTooManyWeedPmalloc 0x234 #define ElmNoMemDefaultWeed 0x235 ! #define ElmCannotInitErrorExpanding 0x236 #define ElmCouldntMakeTempFileName 0x237 #define ElmCouldntOpenForWriting 0x238 #define ElmSureYouWantToRemail 0x239 Index: hdrs/save_opts.h Prereq: 5.8 *** ../elm2.4/hdrs/save_opts.h Sat May 8 16:02:01 1993 --- hdrs/save_opts.h Tue Aug 10 14:49:32 1993 *************** *** 1,8 **** ! /* @(#)$Id: save_opts.h,v 5.8 1993/05/08 18:56:16 syd Exp syd $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 5.8 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- ! /* @(#)$Id: save_opts.h,v 5.10 1993/08/10 18:49:32 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 5.10 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,30 ---- * ******************************************************************************* * $Log: save_opts.h,v $ + * Revision 5.10 1993/08/10 18:49:32 syd + * When an environment variable was given as the tmpdir definition the src + * and dest overlapped in expand_env. This made elm produce a garbage + * expansion because expand_env cannot cope with overlapping src and + * dest. I added a new variable raw_temp_dir to keep src and dest not to + * overlap. + * From: Jukka Ukkonen + * + * Revision 5.9 1993/06/12 05:28:06 syd + * Missing checkin + * * Revision 5.8 1993/05/08 18:56:16 syd * created a new elmrc variable named "readmsginc". This specifies an * increment by which the message count is updated. If this variable is *************** *** 230,236 **** #endif {"timeout", -1L,DT_NUM,(char *)&timeout}, {"titles", -1L,DT_BOL,(char *)&title_messages}, ! {"tmpdir", -1L,DT_STR,temp_dir}, {"userlevel", -1L,DT_NUM,(char *)&user_level}, {"username", -1L,DT_SYN,"fullname"}, {"usetite", -1L,DT_BOL|FL_AND,(char *)&use_tite}, --- 241,247 ---- #endif {"timeout", -1L,DT_NUM,(char *)&timeout}, {"titles", -1L,DT_BOL,(char *)&title_messages}, ! {"tmpdir", -1L,DT_STR,raw_temp_dir}, {"userlevel", -1L,DT_NUM,(char *)&user_level}, {"username", -1L,DT_SYN,"fullname"}, {"usetite", -1L,DT_BOL|FL_AND,(char *)&use_tite}, Index: lib/Makefile.SH Prereq: 5.11 *** ../elm2.4/lib/Makefile.SH Sun Apr 11 21:51:43 1993 --- lib/Makefile.SH Tue Aug 3 15:28:46 1993 *************** *** 36,42 **** echo "Extracting lib/Makefile (with variable substitutions)" cat >Makefile <Makefile < header file is now included + # globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled + # there. Inclusion of was removed from *all* the individual + # files, and the toupper() and tolower() routines in lib/opt_utils.c + # were dropped. + # From: chip@chinacat.unicom.com (Chip Rosenthal) + # + # Revision 5.14 1993/08/03 19:17:33 syd + # Implement new timezone handling. New file lib/get_tz.c with new timezone + # routines. Added new TZMINS_USE_xxxxxx and TZNAME_USE_xxxxxx configuration + # definitions. Obsoleted TZNAME, ALTCHECK, and TZ_MINUTESWEST configuration + # definitions. Updated Configure. Modified lib/getarpdate.c and + # lib/strftime.c to use new timezone routines. + # + # From: chip@chinacat.unicom.com (Chip Rosenthal) + # + # Revision 5.13 1993/08/02 18:14:35 syd + # add missing references for mcprt.c/mcprtlib.c to defs.h + # From: Syd + # + # Revision 5.12 1993/06/10 03:02:46 syd + # break_down_tolist() tried to blindly split address lists at "," which + # caused bogus results with addreses that had a comma inside a comment + # or quoted text, such as "user@domain (Last, First)". This patch steps + # through the address in quanta of RFC-822 tokens when searching for a + # delimiting comma. It also adds "rfc822_toklen()" to the library to + # get that length. + # From: chip@chinacat.unicom.com (Chip Rosenthal) + # # Revision 5.11 1993/04/12 01:51:42 syd # Added safe_malloc(), safe_realloc(), and safe_strdup(). They # will be used in the new elmalias utility. *************** *** 162,167 **** --- 196,202 ---- getarpdate.c \ getfullnam.c \ getword.c \ + get_tz.c \ header_cmp.c \ in_list.c \ in_string.c \ *************** *** 182,187 **** --- 217,223 ---- qstrings.c \ remfirstwd.c \ reverse.c \ + rfc822tlen.c \ safemalloc.c \ shiftlower.c \ strfcpy.c \ *************** *** 207,212 **** --- 243,249 ---- expand.o \ figadrssee.o \ gcos_name.o \ + get_tz.o \ getaddrfrm.o \ getarpdate.o \ getfullnam.o \ *************** *** 231,236 **** --- 268,274 ---- realfrom.o \ remfirstwd.o \ reverse.o \ + rfc822tlen.o \ safemalloc.o \ shiftlower.o \ strfcpy.o \ *************** *** 280,285 **** --- 318,324 ---- # Dependencies of C object files add_site.o: $(INCLDIR)/headers.h addrmchusr.o: $(INCLDIR)/headers.h + atonum.o: $(INCLDIR)/defs.h mk_aliases.o: $(INCLDIR)/headers.h $(INCLDIR)/ndbz.h $(INCLDIR)/s_newalias.h aliasdb.o: $(INCLDIR)/headers.h $(INCLDIR)/ndbz.h mk_lockname.o: $(INCLDIR)/headers.h *************** *** 291,296 **** --- 330,336 ---- expand.o: $(INCLDIR)/defs.h $(INCLDIR)/s_elmrc.h figadrssee.o: $(INCLDIR)/headers.h gcos_name.o: $(INCLDIR)/headers.h + get_tz.o: $(INCLDIR)/defs.h getaddrfrm.o: $(INCLDIR)/headers.h getarpdate.o: $(INCLDIR)/headers.h getfullnam.o: $(INCLDIR)/headers.h *************** *** 302,309 **** ldstate.o: $(INCLDIR)/defs.h len_next.o: ../config.h mail_gets.o: ../config.h ! mcprt.o: $(INCLDIR)/mcprt.h $(INCLDIR)/mcprtlib.h ! mcprtlib.o: $(INCLDIR)/mcprtlib.h $(INCLDIR)/nl_types.h move_left.o: $(INCLDIR)/headers.h msgcat.o: $(INCLDIR)/msgcat.h $(INCLDIR)/nl_types.h ndbz.o: $(INCLDIR)/headers.h $(INCLDIR)/ndbz.h --- 342,349 ---- ldstate.o: $(INCLDIR)/defs.h len_next.o: ../config.h mail_gets.o: ../config.h ! mcprt.o: $(INCLDIR)/mcprt.h $(INCLDIR)/mcprtlib.h $(INCLDIR)/defs.h ! mcprtlib.o: $(INCLDIR)/mcprtlib.h $(INCLDIR)/nl_types.h $(INCLDIR)/defs.h move_left.o: $(INCLDIR)/headers.h msgcat.o: $(INCLDIR)/msgcat.h $(INCLDIR)/nl_types.h ndbz.o: $(INCLDIR)/headers.h $(INCLDIR)/ndbz.h Index: lib/aliasdb.c Prereq: 5.3 *** ../elm2.4/lib/aliasdb.c Tue Apr 20 21:40:16 1993 --- lib/aliasdb.c Sun Sep 19 19:41:00 1993 *************** *** 1,5 **** /******************************************************************************* ! * The Elm Mail System - $Revision: 5.3 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- + + static char rcsid[] = "@(#)$Id: aliasdb.c,v 5.8 1993/09/19 23:40:48 syd Exp $"; + /******************************************************************************* ! * The Elm Mail System - $Revision: 5.8 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 11,16 **** --- 14,50 ---- * ******************************************************************************* * $Log: aliasdb.c,v $ + * Revision 5.8 1993/09/19 23:40:48 syd + * Defince SEEK_SET in one of our headers as a last resort + * From: Syd + * + * Revision 5.7 1993/08/03 19:28:39 syd + * Elm tries to replace the system toupper() and tolower() on current + * BSD systems, which is unnecessary. Even worse, the replacements + * collide during linking with routines in isctype.o. This patch adds + * a Configure test to determine whether replacements are really needed + * (BROKE_CTYPE definition). The header file is now included + * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled + * there. Inclusion of was removed from *all* the individual + * files, and the toupper() and tolower() routines in lib/opt_utils.c + * were dropped. + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * + * Revision 5.6 1993/07/20 02:59:53 syd + * Support aliases both on 64 bit and 32 bit machines at the same time. + * From: Dan Mosedale + * + * Revision 5.5 1993/06/10 03:12:10 syd + * Add missing rcs id lines + * From: Syd + * + * Revision 5.4 1993/06/10 02:58:26 syd + * Correct problem in fetch_alias() with alias record fixup that caused + * core dump on machines with pointers larger than int. This problem + * was reported on comp.mail.elm by Richard Eckman and Jim Brown. Simplify + * get_one_alias() by having it use fetch_alias(). + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * * Revision 5.3 1993/04/21 01:40:12 syd * add seekset define * *************** *** 35,53 **** **/ #include "headers.h" - #include #include "ndbz.h" - #ifndef SEEK_SET - #define SEEK_SET 0 /* Set file pointer to "offset" */ - #define SEEK_CUR 1 /* Set file pointer to current plus "offset" */ - #define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ - #endif - #ifdef BSD # include - # undef tolower - # undef toupper #endif /* byte-ordering stuff */ --- 69,78 ---- *************** *** 74,82 **** return(out.o); } ! read_one_alias(db, ar) DBZ *db; ! struct alias_rec *ar; { /* * Read an alias (name, address, etc.) from the data file --- 99,107 ---- return(out.o); } ! read_one_alias(db, adr) DBZ *db; ! struct alias_disk_rec *adr; { /* * Read an alias (name, address, etc.) from the data file *************** *** 87,104 **** if (data_file == NULL) return(0); /* no alias file, but hash exists, error condition */ ! if (fread((char *) ar, sizeof(struct alias_rec), 1, data_file) <= 0) ! return(0); - ar->status = (int) MAPIN(ar->status); - ar->alias = (char *) MAPIN(ar->alias); - ar->last_name = (char *) MAPIN(ar->last_name); - ar->name = (char *) MAPIN(ar->name); - ar->comment = (char *) MAPIN(ar->comment); - ar->address = (char *) MAPIN(ar->address); - ar->type = (int) MAPIN(ar->type); - ar->length = (long) MAPIN(ar->length); - return(1); } --- 112,130 ---- if (data_file == NULL) return(0); /* no alias file, but hash exists, error condition */ ! if (fread((char *) adr, sizeof(struct alias_disk_rec), 1, data_file) ! <= 0) ! return(0); ! ! adr->status = (int32) MAPIN(adr->status); ! adr->alias = (int32) MAPIN(adr->alias); ! adr->last_name = (int32) MAPIN(adr->last_name); ! adr->name = (int32) MAPIN(adr->name); ! adr->comment = (int32) MAPIN(adr->comment); ! adr->address = (int32) MAPIN(adr->address); ! adr->type = (int32) MAPIN(adr->type); ! adr->length = (int32) MAPIN(adr->length); return(1); } *************** *** 122,128 **** char *alias; { datum key, val; ! struct alias_rec arec; long pos; register struct alias_rec *ar; register char *buf, *s; --- 148,154 ---- char *alias; { datum key, val; ! struct alias_disk_rec adrec; long pos; register struct alias_rec *ar; register char *buf, *s; *************** *** 159,194 **** /* * Move to the position of the selected alias record. */ ! pos = *((long *)(val.dptr)) - sizeof(struct alias_rec); if (fseek(db->dbz_basef, pos, SEEK_SET) != 0) return (struct alias_rec *)NULL; } /* * We are now positioned at the alias record we want. Pull it in. */ ! if (!read_one_alias(db, &arec)) return (struct alias_rec *)NULL; /* * Allocate space to hold the alias record and data content. */ ar = (struct alias_rec *) ! safe_malloc(sizeof(struct alias_rec) + arec.length); ! *ar = arec; buf = (char *)ar + sizeof(struct alias_rec); /* ! * Read in the data content and fixup pointers in the alias record. */ if (fread(buf, ar->length, 1, db->dbz_basef) != 1) return (struct alias_rec *)NULL; - ar->alias += (int) buf; - ar->last_name += (int) buf; - ar->name += (int) buf; - ar->comment += (int) buf; - ar->address += (int) buf; return ar; } --- 185,239 ---- /* * Move to the position of the selected alias record. */ ! pos = *((long *)(val.dptr)) - sizeof(struct alias_disk_rec); if (fseek(db->dbz_basef, pos, SEEK_SET) != 0) return (struct alias_rec *)NULL; } /* + * Each alias in the data file is stored as a (struct alias_rec) + * followed by text information for that alias record. The + * size of the following text information is specified by `length', + * and the value of the other members of the structure are actually + * offsets into that buffer space. So, to load in an alias we + * need to: (1) read the alias record, (2) see how long the data + * buffer is and pull it in, and (3) fixup the pointers in the + * alias record so they point into the data buffer. + */ + + /* * We are now positioned at the alias record we want. Pull it in. */ ! if (!read_one_alias(db, &adrec)) return (struct alias_rec *)NULL; /* * Allocate space to hold the alias record and data content. */ + ar = (struct alias_rec *) ! safe_malloc(sizeof(struct alias_rec) + (size_t)adrec.length); ! buf = (char *)ar + sizeof(struct alias_rec); + /* + * Fixup pointers in the alias record. + */ + ar->status = (int)adrec.status; + ar->alias = (char *) ((size_t) adrec.alias + (size_t) buf); + ar->last_name = (char *) ((size_t) adrec.last_name + (size_t) buf); + ar->name = (char *) ((size_t) adrec.name + (size_t) buf); + ar->comment = (char *) ((size_t) adrec.comment + (size_t) buf); + ar->address = (char *) ((size_t) adrec.address + (size_t) buf); + ar->type = (int)adrec.type; + ar->length = (size_t)adrec.length; + /* ! * Read in the data content */ if (fread(buf, ar->length, 1, db->dbz_basef) != 1) return (struct alias_rec *)NULL; return ar; } Index: lib/atonum.c Prereq: 5.1 *** ../elm2.4/lib/atonum.c Mon Jan 18 23:46:39 1993 --- lib/atonum.c Tue Aug 3 15:28:47 1993 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: atonum.c,v 5.1 1993/01/19 04:46:21 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.1 $ $State: Exp $ * * Copyright (c) 1993 USENET Community Trust ******************************************************************************* --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: atonum.c,v 5.2 1993/08/03 19:28:39 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.2 $ $State: Exp $ * * Copyright (c) 1993 USENET Community Trust ******************************************************************************* *************** *** 13,25 **** * ******************************************************************************* * $Log: atonum.c,v $ * Revision 5.1 1993/01/19 04:46:21 syd * Initial Checkin * * ******************************************************************************/ ! #include /* * This is similar to atoi(), but it complains if the string --- 13,37 ---- * ******************************************************************************* * $Log: atonum.c,v $ + * Revision 5.2 1993/08/03 19:28:39 syd + * Elm tries to replace the system toupper() and tolower() on current + * BSD systems, which is unnecessary. Even worse, the replacements + * collide during linking with routines in isctype.o. This patch adds + * a Configure test to determine whether replacements are really needed + * (BROKE_CTYPE definition). The header file is now included + * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled + * there. Inclusion of was removed from *all* the individual + * files, and the toupper() and tolower() routines in lib/opt_utils.c + * were dropped. + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * * Revision 5.1 1993/01/19 04:46:21 syd * Initial Checkin * * ******************************************************************************/ ! #include "defs.h" /* * This is similar to atoi(), but it complains if the string Index: lib/can_access.c Prereq: 5.6 *** ../elm2.4/lib/can_access.c Thu May 13 23:52:11 1993 --- lib/can_access.c Sun Aug 22 22:46:07 1993 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: can_access.c,v 5.6 1993/05/14 03:52:10 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.6 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: can_access.c,v 5.8 1993/08/23 02:46:07 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.8 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,35 ---- * ******************************************************************************* * $Log: can_access.c,v $ + * Revision 5.8 1993/08/23 02:46:07 syd + * Don't declare _exit() if already did it. + * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg) + * + * Revision 5.7 1993/08/03 19:28:39 syd + * Elm tries to replace the system toupper() and tolower() on current + * BSD systems, which is unnecessary. Even worse, the replacements + * collide during linking with routines in isctype.o. This patch adds + * a Configure test to determine whether replacements are really needed + * (BROKE_CTYPE definition). The header file is now included + * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled + * there. Inclusion of was removed from *all* the individual + * files, and the toupper() and tolower() routines in lib/opt_utils.c + * were dropped. + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * * Revision 5.6 1993/05/14 03:52:10 syd * When compiled on a POSIX host PL22 failed checking whether the file is * readable and a regular file or not. There was one `!' missing in the *************** *** 48,60 **** #include "headers.h" #include - #include #include #ifdef BSD # include #endif extern int errno; /* system error number */ int --- 64,79 ---- #include "headers.h" #include #include #ifdef BSD # include #endif + #ifndef I_UNISTD + void _exit(); + #endif + extern int errno; /* system error number */ int *************** *** 66,72 **** int the_stat = 0, pid, w; struct stat stat_buf; - void _exit(); #if defined(BSD) && !defined(WEXITSTATUS) union wait status; #else --- 85,90 ---- Index: lib/can_open.c Prereq: 5.2 *** ../elm2.4/lib/can_open.c Fri Dec 11 20:29:27 1992 --- lib/can_open.c Sun Aug 22 22:46:08 1993 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: can_open.c,v 5.2 1992/12/12 01:29:26 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.2 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: can_open.c,v 5.4 1993/08/23 02:46:07 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.4 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,35 ---- * ******************************************************************************* * $Log: can_open.c,v $ + * Revision 5.4 1993/08/23 02:46:07 syd + * Don't declare _exit() if already did it. + * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg) + * + * Revision 5.3 1993/08/03 19:28:39 syd + * Elm tries to replace the system toupper() and tolower() on current + * BSD systems, which is unnecessary. Even worse, the replacements + * collide during linking with routines in isctype.o. This patch adds + * a Configure test to determine whether replacements are really needed + * (BROKE_CTYPE definition). The header file is now included + * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled + * there. Inclusion of was removed from *all* the individual + * files, and the toupper() and tolower() routines in lib/opt_utils.c + * were dropped. + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * * Revision 5.2 1992/12/12 01:29:26 syd * Fix double inclusion of sys/types.h * From: Tom Moore *************** *** 30,42 **** #include "headers.h" #include - #include #include #ifdef BSD # include #endif extern int errno; /* system error number */ int --- 46,61 ---- #include "headers.h" #include #include #ifdef BSD # include #endif + #ifndef I_UNISTD + void _exit(); + #endif + extern int errno; /* system error number */ int *************** *** 49,55 **** FILE *fd; int the_stat = 0, pid, w, preexisted = 0; - void _exit(); #if defined(BSD) && !defined(WEXITSTATUS) union wait status; #else --- 68,73 ---- Index: lib/date_util.c Prereq: 5.2 *** ../elm2.4/lib/date_util.c Wed Jan 27 15:54:25 1993 --- lib/date_util.c Tue Aug 3 15:28:48 1993 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: date_util.c,v 5.2 1993/01/27 20:54:24 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.2 $ $State: Exp $ * * Copyright (c) 1993 USENET Community Trust ******************************************************************************* --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: date_util.c,v 5.3 1993/08/03 19:28:39 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.3 $ $State: Exp $ * * Copyright (c) 1993 USENET Community Trust ******************************************************************************* *************** *** 13,18 **** --- 13,30 ---- * ******************************************************************************* * $Log: date_util.c,v $ + * Revision 5.3 1993/08/03 19:28:39 syd + * Elm tries to replace the system toupper() and tolower() on current + * BSD systems, which is unnecessary. Even worse, the replacements + * collide during linking with routines in isctype.o. This patch adds + * a Configure test to determine whether replacements are really needed + * (BROKE_CTYPE definition). The header file is now included + * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled + * there. Inclusion of was removed from *all* the individual + * files, and the toupper() and tolower() routines in lib/opt_utils.c + * were dropped. + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * * Revision 5.2 1993/01/27 20:54:24 syd * There is a small bug in this routine in Chip's PL21 patch. The code * calls atonum to convert the 4 digit timezone field. However this field *************** *** 27,33 **** ******************************************************************************/ #include "headers.h" - #include /* * Date processing functions: --- 39,44 ---- Index: lib/expand.c Prereq: 5.3 *** ../elm2.4/lib/expand.c Thu Dec 10 20:45:27 1992 --- lib/expand.c Sun Sep 19 19:38:55 1993 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: expand.c,v 5.3 1992/12/11 01:45:04 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.3 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: expand.c,v 5.4 1993/09/19 23:38:55 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.4 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,24 ---- * ******************************************************************************* * $Log: expand.c,v $ + * Revision 5.4 1993/09/19 23:38:55 syd + * expand() didn't read the global rc file if the user elmrc didn't exist or + * didn't have an entry for maildir. + * From: Jan.Djarv@sa.erisoft.se (Jan Djarv) + * * Revision 5.3 1992/12/11 01:45:04 syd * remove sys/types.h include, it is now included by defs.h * and this routine includes defs.h or indirectly includes defs.h *************** *** 44,56 **** char *expand_define(); int expand(filename) char *filename; { /** Expand the filename since the first character is a meta- character that should expand to the "maildir" variable ! in the users ".elmrc" file... Note: this is a brute force way of getting the entry out of the .elmrc file, and isn't recommended for the faint --- 49,93 ---- char *expand_define(); + static char* + expand_maildir(rcfile, filename, buffer) + FILE *rcfile; + char *filename; + char *buffer; + { + char *home = NULL, *bufptr; + int foundit = 0; + + bufptr = (char *) buffer; /* same address */ + + while (! foundit && mail_gets(buffer, SLEN, rcfile) != 0) { + if (strncmp(buffer, "maildir", 7) == 0 || + strncmp(buffer, "folders", 7) == 0) { + while (*bufptr != '=' && *bufptr) + bufptr++; + bufptr++; /* skip the equals sign */ + while (whitespace(*bufptr) && *bufptr) + bufptr++; + home = bufptr; /* remember this address */ + + while (! whitespace(*bufptr) && *bufptr != '\n') + bufptr++; + + *bufptr = '\0'; /* remove trailing space */ + foundit++; + } + } + + return home; + } + int expand(filename) char *filename; { /** Expand the filename since the first character is a meta- character that should expand to the "maildir" variable ! in the users ".elmrc" file or in the global rc file... Note: this is a brute force way of getting the entry out of the .elmrc file, and isn't recommended for the faint *************** *** 58,68 **** **/ FILE *rcfile; ! char buffer[SLEN], *expanded_dir, *home, *bufptr; ! int foundit = 0; - bufptr = (char *) buffer; /* same address */ - if ((home = getenv("HOME")) == NULL) { printf(catgets(elm_msg_cat, ElmrcSet, ElmrcExpandHome, "Can't expand environment variable $HOME to find .elmrc file!\n")); --- 95,102 ---- **/ FILE *rcfile; ! char buffer[SLEN], *home, *expanded_dir; if ((home = getenv("HOME")) == NULL) { printf(catgets(elm_msg_cat, ElmrcSet, ElmrcExpandHome, "Can't expand environment variable $HOME to find .elmrc file!\n")); *************** *** 71,105 **** sprintf(buffer, "%s/%s", home, elmrcfile); ! if ((rcfile = fopen(buffer, "r")) == NULL) { ! printf(catgets(elm_msg_cat, ElmrcSet, ElmrcOpenElmrc, ! "Can't open your \".elmrc\" file (%s) for reading!\n"), ! buffer); ! return(NO); } ! while (! foundit && mail_gets(buffer, SLEN, rcfile) != 0) { ! if (strncmp(buffer, "maildir", 7) == 0 || ! strncmp(buffer, "folders", 7) == 0) { ! while (*bufptr != '=' && *bufptr) ! bufptr++; ! bufptr++; /* skip the equals sign */ ! while (whitespace(*bufptr) && *bufptr) ! bufptr++; ! home = bufptr; /* remember this address */ ! ! while (! whitespace(*bufptr) && *bufptr != '\n') ! bufptr++; ! ! *bufptr = '\0'; /* remove trailing space */ ! foundit++; } } ! fclose(rcfile); /* be nice... */ ! ! if (! foundit) { ! /* Use default */ sprintf(buffer, "~/%s", default_folders); home = buffer; } --- 105,125 ---- sprintf(buffer, "%s/%s", home, elmrcfile); ! home = NULL; ! if ((rcfile = fopen(buffer, "r")) != NULL) { ! home = expand_maildir(rcfile, filename, buffer); ! fclose(rcfile); } ! if (home == NULL) { /* elmrc didn't exist or maildir wasn't in it */ ! if ((rcfile = fopen(system_rc_file, "r")) != NULL) { ! home = expand_maildir(rcfile, filename, buffer); ! fclose(rcfile); } } ! if (home == NULL) { ! /* Didn't find it, use default */ sprintf(buffer, "~/%s", default_folders); home = buffer; } Index: lib/figadrssee.c Prereq: 5.2 *** ../elm2.4/lib/figadrssee.c Wed Feb 3 11:25:46 1993 --- lib/figadrssee.c Sat Jun 12 01:33:39 1993 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: figadrssee.c,v 5.2 1993/02/03 16:25:45 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.2 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: figadrssee.c,v 5.3 1993/06/12 05:33:32 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.3 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,23 ---- * ******************************************************************************* * $Log: figadrssee.c,v $ + * Revision 5.3 1993/06/12 05:33:32 syd + * Remove useless auto + * From: Syd + * * Revision 5.2 1993/02/03 16:25:45 syd * Adresses with double quoted strings that contains comma was parsed * wrongly by break_down_tolist() and figure_out_addressee(). *************** *** 42,48 **** **/ char *address, *bufptr, mybuf[SLEN]; - register int index2 = 0; if (equal(mail_to, username)) return; /* can't be better! */ --- 46,51 ---- Index: lib/gcos_name.c Prereq: 5.2 *** ../elm2.4/lib/gcos_name.c Tue Jan 19 22:02:33 1993 --- lib/gcos_name.c Tue Aug 3 15:28:49 1993 *************** *** 1,7 **** ! static char rcsid[] = "@(#)$Id: gcos_name.c,v 5.2 1993/01/20 03:02:19 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.2 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,7 ---- ! static char rcsid[] = "@(#)$Id: gcos_name.c,v 5.3 1993/08/03 19:28:39 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.3 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 13,18 **** --- 13,30 ---- * ******************************************************************************* * $Log: gcos_name.c,v $ + * Revision 5.3 1993/08/03 19:28:39 syd + * Elm tries to replace the system toupper() and tolower() on current + * BSD systems, which is unnecessary. Even worse, the replacements + * collide during linking with routines in isctype.o. This patch adds + * a Configure test to determine whether replacements are really needed + * (BROKE_CTYPE definition). The header file is now included + * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled + * there. Inclusion of was removed from *all* the individual + * files, and the toupper() and tolower() routines in lib/opt_utils.c + * were dropped. + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * * Revision 5.2 1993/01/20 03:02:19 syd * Move string declarations to defs.h * From: Syd *************** *** 28,39 **** **/ #include "headers.h" - #include - - #ifdef BSD - #undef tolower - #undef toupper - #endif char * gcos_name(gcos_field, logname) --- 40,45 ---- Index: lib/get_tz.c *** /dev/null Sun Sep 19 14:13:21 1993 --- lib/get_tz.c Tue Aug 10 14:57:50 1993 *************** *** 0 **** --- 1,298 ---- + + static char rcsid[] = "@(#)$Id: get_tz.c,v 5.1 1993/08/10 18:56:53 syd Exp $"; + + /******************************************************************************* + * The Elm Mail System - $Revision: 5.1 $ $State: Exp $ + * + * Copyright (c) 1992, 1993 USENET Community Trust + ******************************************************************************* + * Bug reports, patches, comments, suggestions should be sent to: + * + * Syd Weinstein, Elm Coordinator + * elm@DSI.COM dsinc!elm + * + ******************************************************************************* + * $Log: get_tz.c,v $ + * Revision 5.1 1993/08/10 18:56:53 syd + * Initial Checkin + * + * + ******************************************************************************/ + + /* + * get_tz - Site-specific timezone handling. + * + * get_tz_mins(tm) - Return timezone adjustment in minutes west of GMT. + * get_tz_name(tm) - Return timezone name. + * + * These procedures return timezone infomation for the time specified by "tm". + * If "tm" is NULL, then the local, current timezone info are returned. + * + * On some systems, regardless of the "tm" value, the local timezone + * values are returned. + * + * On some systems, when passing a non-NULL "tm" value, a call to "tzset()" + * must be performed prior to invoking these routines to obtain proper + * timezone information. Note that some systems will implicitly call + * "tzset()" through other routines, such as "localtime()". On such + * systems an explicit "tzset()" is not required if the "tm" value was + * obtained through a routine that does the implicit setup. + * + * The task of discovering timezone info is a horrid mess because so many + * systems have different notions about how to do it. The goal of these + * routines is to encapsulate the system dependancies here. Two definitions, + * TZMINS_USE_xxxxxx and TZNAME_USE_xxxxxx must be enabled as appropriate + * for this system. Exactly _one_ definition from each group must be + * specified. The available choices are: + * + * TZMINS_USE_xxxxxx specifies how to get timezone offset. + * + * TZMINS_USE_TM_TZADJ use (struct tm*)->tm_tzadj + * TZMINS_USE_TM_GMTOFF use (struct tm*)->tm_gmtoff + * TZMINS_USE_TZAZ_GLOBAL use "timezone, altzone" externals + * TZMINS_USE_TZ_GLOBAL use "timezone" external + * TZMINS_USE_FTIME use ftime() function + * TZMINS_USE_TIMEOFDAY use gettimeofday() function + * + * TZNAME_USE_xxxxxx specifies how to get timezone name. + * + * TZNAME_USE_TM_NAME use (struct tm *)->tm_name + * TZNAME_USE_TM_ZONE use (struct tm *)->tm_zone + * TZNAME_USE_TZNAME use "tzname[]" external + * TZNAME_USE_TIMEZONE use timezone() function + * + * The TZMINS_HANDLING and TZNAME_HANDLING definitions are just used + * to verify the configurations were setup correctly. They force + * compiler warnings and/or errors in the event of a configuration problem. + */ + + #include "defs.h" + + #ifdef I_TIME + # include + #endif + #ifdef I_SYSTIME + # include + #endif + #ifdef TZMINS_USE_FTIME + # include + #endif + + #ifndef _POSIX_SOURCE + extern struct tm *localtime(); + extern time_t time(); + #endif + + /****************************************************************************/ + + int get_tz_mins(tm) + struct tm *tm; + { + + if (tm == 0) { + time_t t; + (void) time(&t); + tm = localtime(&t); + } + + #ifdef TZMINS_USE_TM_TZADJ + #define TZMINS_HANDLING 1 + /* + * This system maintains the timezone offset in the (struct tm) + * as a number of _seconds_ west of GMT. + */ + return (int)(tm->tm_tzadj / 60); + #endif + + #ifdef TZMINS_USE_TM_GMTOFF + #define TZMINS_HANDLING 2 + /* + * This system maintains the timezone offset in the (struct tm) + * as a number of _seconds_ _east_ of GMT. Since this is an + * easterly pointing offset, we need to flip the sign to go the + * other direction. + */ + return (int)(-tm->tm_gmtoff / 60); + #endif + + #ifdef TZMINS_USE_TZAZ_GLOBAL + #define TZMINS_HANDLING 3 + /* + * This system maintains timezone offsets in global variables + * as a number of _seconds_ west of GMT. There are two globals, + * one for when DST is in effect and one for when it is not, + * and we need to select the correct one. + */ + { + extern long altzone, timezone; + return (int)((tm->tm_isdst ? altzone : timezone) / 60); + } + #endif + + #ifdef TZMINS_USE_TZ_GLOBAL + #define TZMINS_HANDLING 4 + /* + * This system maintains the timezone offset in a global variable as + * a number of _seconds_ west of GMT. We need to correct this value + * if DST is in effect. Note that the global "daylight" indicates + * that DST applies to this site and NOT necessarily that the DST + * correction needs to be applied right now. Be careful -- some + * systems have a "timezone()" procedure and this method will return + * the address of that procedure rather than a timezone offset! + */ + { + extern long timezone; + extern int daylight; + return (int)(timezone/60) - + ((daylight && tm->tm_isdst) ? 60 : 0); + } + #endif + + #ifdef TZMINS_USE_TIMEOFDAY + #define TZMINS_HANDLING 5 + /* + * This system uses gettimeofday() to obtain the timezone + * information as minutes west of GMT. The returned value will + * not be corrected for DST (unless you are unlucky enough to + * own a Unix written by some unmentionable vendor), so we will + * need to account for that. Be careful -- some systems that + * have this procedure depreciate its use for timezone information + * and recommend it only for the high-resolution time information. + * On these systems the timezone info may be some kernel default + * or even garbage. + */ + { + struct timeval tv; + struct timezone tz; + (void) gettimeofday(&tv, &tz); + #ifdef AIX + return tz.tz_minuteswest; + #else + return tz.tz_minuteswest - + (tm->tm_isdst && tz.tz_dsttime != DST_NONE ? 60 : 0); + #endif + } + #endif + + #ifdef TZMINS_USE_FTIME + #define TZMINS_HANDLING 6 + /* + * This system uses ftime() to obtain the timezone information + * as minutes west of GMT. The returned value will not be + * corrected for DST, so we will need to account for that. Be + * careful -- some systems that have this procedure depreciate + * its use for timezone information and recommend it only for + * the high-resolution time information. On these systems the + * timezone info may be some kernel default or even garbage. + */ + { + struct timeb tb; + (void) ftime(&tb); + return tb.timezone - (tm->tm_isdst ? 60 : 0); + } + #endif + + #ifndef TZMINS_HANDLING + /* Force a compile error if the timezone config is wrong. */ + no_tzmins_handling_defined(TZMINS_HANDLING); + #endif + } + + /****************************************************************************/ + + char *get_tz_name(tm) + struct tm *tm; + { + + if (tm == 0) { + time_t t; + (void) time(&t); + tm = localtime(&t); + } + + #ifdef TZNAME_USE_TM_NAME + #define TZNAME_HANDLING 1 + /* + * This system maintains the timezone name in the (struct tm). + */ + return tm->tm_name; + #endif + + #ifdef TZNAME_USE_TM_ZONE + #define TZNAME_HANDLING 2 + /* + * This system maintains the timezone name in the (struct tm). + */ + return tm->tm_zone; + #endif + + #ifdef TZNAME_USE_TZNAME + #define TZNAME_HANDLING 3 + /* + * This system maintains a global array that contains two timezone + * names, one for when DST is in effect and one for when it is not. + * We simply need to pick the right one. + */ + { + extern char *tzname[]; + return tzname[tm->tm_isdst]; + } + #endif + + #ifdef TZNAME_USE_TIMEZONE + #define TZNAME_HANDLING 4 + /* + * This system provides a timezone() procedure to get a timezone + * name. Be careful -- some systems have this procedure but + * depreciate its use, and in some cases it is outright broke. + */ + { + extern char *timezone(); + return timezone(get_tz_mins(tm), tm->tm_isdst); + } + #endif + + #ifndef TZNAME_HANDLING + /* Force a compile error if the timezone config is wrong. */ + no_tzname_handling_defined(TZNAME_HANDLING); + #endif + } + + /****************************************************************************/ + + #ifdef _TEST + + /* + * It would be best to futz around with the TZ setting when running this + * test. In all cases, the "null" and the "localtime()" results should + * be identical, and the "gmtime()" results should indicate "GMT 0" + * regardless of TZ setting. Here are a few possible TZ settings you + * can try, and the result you should expect. + * + * TZ=GMT always GMT 0 + * TZ=CST6CDT CST 360 or CDT 300, depending upon time of year + * TZ=EST5EDT EST 300 or EDT 240, depending upon time of year + * TZ=EST5EDT;0,364 always EDT 240 + * TZ=EST5EDT;0,0 always EST 300 + * + * Oh...this all assumes your system supports TZ. :-) + */ + + main() + { + time_t t; + struct tm *tm; + static char f[] = "using %s tm struct - name=\"%s\" mins_west=\"%d\"\n"; + + (void) time(&t); + tm = (struct tm *)0; + printf(f, "null", get_tz_name(tm), get_tz_mins(tm)); + tm = localtime(&t); + printf(f, "localtime()", get_tz_name(tm), get_tz_mins(tm)); + tm = gmtime(&t); + printf(f, "gmtime()", get_tz_name(tm), get_tz_mins(tm)); + exit(0); + } + + #endif /*_TEST*/ + Index: lib/getaddrfrm.c Prereq: 5.3 *** ../elm2.4/lib/getaddrfrm.c Sun May 16 16:55:52 1993 --- lib/getaddrfrm.c Tue Aug 3 15:28:49 1993 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: getaddrfrm.c,v 5.3 1993/05/16 20:55:52 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.3 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: getaddrfrm.c,v 5.4 1993/08/03 19:28:39 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.4 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,31 ---- * ******************************************************************************* * $Log: getaddrfrm.c,v $ + * Revision 5.4 1993/08/03 19:28:39 syd + * Elm tries to replace the system toupper() and tolower() on current + * BSD systems, which is unnecessary. Even worse, the replacements + * collide during linking with routines in isctype.o. This patch adds + * a Configure test to determine whether replacements are really needed + * (BROKE_CTYPE definition). The header file is now included + * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled + * there. Inclusion of was removed from *all* the individual + * files, and the toupper() and tolower() routines in lib/opt_utils.c + * were dropped. + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * * Revision 5.3 1993/05/16 20:55:52 syd * Fix bug where text following "<" within double-quote delimited comment * is taken as an address. *************** *** 34,40 **** **/ #include "headers.h" - #include #ifdef USE_EMBEDDED_ADDRESSES --- 46,51 ---- Index: lib/getarpdate.c Prereq: 5.8 *** ../elm2.4/lib/getarpdate.c Sat May 8 15:22:46 1993 --- lib/getarpdate.c Tue Aug 3 15:20:59 1993 *************** *** 1,7 **** ! static char rcsid[] = "@(#)$Id: getarpdate.c,v 5.8 1993/05/08 19:22:46 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.8 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,7 ---- ! static char rcsid[] = "@(#)$Id: getarpdate.c,v 5.9 1993/08/03 19:17:33 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.9 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 13,18 **** --- 13,27 ---- * ******************************************************************************* * $Log: getarpdate.c,v $ + * Revision 5.9 1993/08/03 19:17:33 syd + * Implement new timezone handling. New file lib/get_tz.c with new timezone + * routines. Added new TZMINS_USE_xxxxxx and TZNAME_USE_xxxxxx configuration + * definitions. Obsoleted TZNAME, ALTCHECK, and TZ_MINUTESWEST configuration + * definitions. Updated Configure. Modified lib/getarpdate.c and + * lib/strftime.c to use new timezone routines. + * + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * * Revision 5.8 1993/05/08 19:22:46 syd * On the DEC Alpha, OSF/1 the following change made things happy. * From: dave@opus.csd.uwm.edu (Dave Rasmussen) *************** *** 49,58 **** * ******************************************************************************/ - /** - - **/ - #include "headers.h" #ifdef I_TIME --- 58,63 ---- *************** *** 61,75 **** #ifdef I_SYSTIME # include #endif - #ifdef BSD - # include - #endif - - #include #ifndef _POSIX_SOURCE extern struct tm *localtime(); - extern struct tm *gmtime(); extern time_t time(); #endif --- 66,74 ---- *************** *** 79,93 **** static char *arpa_monname[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""}; ! #ifdef TZNAME ! extern char *tzname[]; ! #else ! char *timezone(); ! #endif ! ! #ifdef _AIX370 ! #undef ALTCHECK ! #endif /* _AIX370 */ char * get_arpa_date() --- 78,85 ---- static char *arpa_monname[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""}; ! extern int get_tz_mins(); ! extern char *get_tz_name(); char * get_arpa_date() *************** *** 100,190 **** **/ static char buffer[SLEN]; /* static character buffer */ ! struct tm *the_time; /* Time structure, see CTIME(3C) */ ! time_t junk; /* time in seconds.... */ long tzmin; /* number of minutes off gmt */ char *tzsign; /* + or - gmt */ ! ! #if !defined(TZNAME) || defined(_AIX) ! # ifndef TZ_MINUTESWEST ! struct timeb loc_time; ! ! junk = time((time_t *) 0); ! ftime(&loc_time); ! # else /* TZ_MINUTESWEST */ ! struct timeval time_val; ! struct timezone time_zone; ! ! gettimeofday(&time_val, &time_zone); ! junk = time_val.tv_sec; ! # endif /* TZ_MINUTESWEST */ ! ! #else /* TZNAME */ ! # ifndef __osf__ ! extern time_t timezone; ! # endif /* __osf__ */ ! # ifdef ALTCHECK ! extern time_t altzone; ! # endif ! ! junk = time((time_t *) 0); /* this must be here for it to work! */ ! #endif /* TZNAME */ ! ! the_time = localtime(&junk); ! if (the_time->tm_year < 100) ! the_time->tm_year += 1900; ! #if !defined(TZNAME) || defined(_AIX) ! # ifdef TZ_MINUTESWEST ! # ifndef AIX ! if (the_time->tm_isdst && time_zone.tz_dsttime != DST_NONE) ! tzmin = - (time_zone.tz_minuteswest - 60); ! else ! # endif /* AIX */ ! tzmin = - time_zone.tz_minuteswest; ! # else /* TZ_MINUTESWEST */ ! tzmin = the_time->tm_gmtoff / 60; ! # endif /* TZ_MINUTESWEST */ ! #else /* TZNAME */ ! # ifdef ALTCHECK ! if (the_time->tm_isdst) ! tzmin = - (altzone / 60); ! else ! tzmin = - (timezone / 60); ! # else /* ALTCHECK */ ! tzmin = - (timezone / 60); ! # endif /* ALTCHECK */ ! #endif /* TZNAME */ ! if (tzmin >= 0) tzsign = "+"; ! else { tzsign = "-"; tzmin = -tzmin; } - sprintf(buffer, "%s, %d %s %d %02d:%02d:%02d %s%02d%02d (%s)", ! arpa_dayname[the_time->tm_wday], ! the_time->tm_mday, ! arpa_monname[the_time->tm_mon], the_time->tm_year, ! the_time->tm_hour, the_time->tm_min, the_time->tm_sec, ! tzsign, tzmin / 60, tzmin % 60, ! #if !defined(TZNAME) || defined(_AIX) ! #ifdef TZ_MINUTESWEST ! # ifdef GOULD_NP1 ! the_time->tm_zone); ! # else ! # ifndef _AIX ! timezone(time_zone.tz_minuteswest, the_time->tm_isdst)); ! # else /* AIX has tzname */ ! tzname[the_time->tm_isdst]); ! # endif ! # endif ! #else ! timezone(loc_time.timezone, the_time->tm_isdst)); ! #endif ! #else ! tzname[the_time->tm_isdst]); ! #endif ! return( (char *) buffer); } --- 92,118 ---- **/ static char buffer[SLEN]; /* static character buffer */ ! time_t curr_time; /* time in seconds.... */ ! struct tm *curr_tm; /* Time structure, see CTIME(3C) */ long tzmin; /* number of minutes off gmt */ char *tzsign; /* + or - gmt */ ! int year; /* current year - with century */ ! (void) time(&curr_time); ! curr_tm = localtime(&curr_time); ! if ((year = curr_tm->tm_year) < 100) ! year += 1900; ! if ((tzmin = -get_tz_mins(curr_tm)) >= 0) { tzsign = "+"; ! } else { tzsign = "-"; tzmin = -tzmin; } sprintf(buffer, "%s, %d %s %d %02d:%02d:%02d %s%02d%02d (%s)", ! arpa_dayname[curr_tm->tm_wday], ! curr_tm->tm_mday, arpa_monname[curr_tm->tm_mon], year, ! curr_tm->tm_hour, curr_tm->tm_min, curr_tm->tm_sec, ! tzsign, tzmin / 60, tzmin % 60, get_tz_name(curr_tm)); ! return buffer; } Index: lib/getword.c Prereq: 5.1 *** ../elm2.4/lib/getword.c Mon Jan 18 23:46:52 1993 --- lib/getword.c Tue Aug 3 15:28:50 1993 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: getword.c,v 5.1 1993/01/19 04:46:21 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.1 $ $State: Exp $ * * Copyright (c) 1993 USENET Community Trust ******************************************************************************* --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: getword.c,v 5.2 1993/08/03 19:28:39 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.2 $ $State: Exp $ * * Copyright (c) 1993 USENET Community Trust ******************************************************************************* *************** *** 13,18 **** --- 13,30 ---- * ******************************************************************************* * $Log: getword.c,v $ + * Revision 5.2 1993/08/03 19:28:39 syd + * Elm tries to replace the system toupper() and tolower() on current + * BSD systems, which is unnecessary. Even worse, the replacements + * collide during linking with routines in isctype.o. This patch adds + * a Configure test to determine whether replacements are really needed + * (BROKE_CTYPE definition). The header file is now included + * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled + * there. Inclusion of was removed from *all* the individual + * files, and the toupper() and tolower() routines in lib/opt_utils.c + * were dropped. + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * * Revision 5.1 1993/01/19 04:46:21 syd * Initial Checkin * *************** *** 20,26 **** ******************************************************************************/ #include - #include #include "defs.h" int get_word(buffer, start, word, wordlen) --- 32,37 ---- Index: lib/header_cmp.c Prereq: 5.2 *** ../elm2.4/lib/header_cmp.c Sat Nov 7 15:59:52 1992 --- lib/header_cmp.c Tue Aug 3 15:28:50 1993 *************** *** 1,7 **** ! static char rcsid[] = "@(#)$Id: header_cmp.c,v 5.2 1992/11/07 20:59:49 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.2 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,7 ---- ! static char rcsid[] = "@(#)$Id: header_cmp.c,v 5.3 1993/08/03 19:28:39 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.3 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 13,18 **** --- 13,30 ---- * ******************************************************************************* * $Log: header_cmp.c,v $ + * Revision 5.3 1993/08/03 19:28:39 syd + * Elm tries to replace the system toupper() and tolower() on current + * BSD systems, which is unnecessary. Even worse, the replacements + * collide during linking with routines in isctype.o. This patch adds + * a Configure test to determine whether replacements are really needed + * (BROKE_CTYPE definition). The header file is now included + * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled + * there. Inclusion of was removed from *all* the individual + * files, and the toupper() and tolower() routines in lib/opt_utils.c + * were dropped. + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * * Revision 5.2 1992/11/07 20:59:49 syd * fix typo * *************** *** 32,42 **** **/ #include "headers.h" - #include - - #ifdef BSD - #undef tolower - #endif char * --- 44,49 ---- Index: lib/istrcmp.c Prereq: 5.1 *** ../elm2.4/lib/istrcmp.c Sat Oct 3 18:42:24 1992 --- lib/istrcmp.c Tue Aug 3 15:28:51 1993 *************** *** 1,7 **** ! static char rcsid[] = "@(#)$Id: istrcmp.c,v 5.1 1992/10/03 22:41:36 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.1 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,7 ---- ! static char rcsid[] = "@(#)$Id: istrcmp.c,v 5.2 1993/08/03 19:28:39 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.2 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 13,18 **** --- 13,30 ---- * ******************************************************************************* * $Log: istrcmp.c,v $ + * Revision 5.2 1993/08/03 19:28:39 syd + * Elm tries to replace the system toupper() and tolower() on current + * BSD systems, which is unnecessary. Even worse, the replacements + * collide during linking with routines in isctype.o. This patch adds + * a Configure test to determine whether replacements are really needed + * (BROKE_CTYPE definition). The header file is now included + * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled + * there. Inclusion of was removed from *all* the individual + * files, and the toupper() and tolower() routines in lib/opt_utils.c + * were dropped. + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * * Revision 5.1 1992/10/03 22:41:36 syd * Initial checkin as of 2.4 Release at PL0 * *************** *** 24,35 **** **/ #include "headers.h" - #include - - #ifdef BSD - #undef tolower - #endif - int istrcmp(s1,s2) --- 36,41 ---- *************** *** 38,45 **** /* case insensitive comparison */ register int d; for (;;) { ! d = ( isupper(*s1) ? tolower(*s1) : *s1 ) ! - ( isupper(*s2) ? tolower(*s2) : *s2 ) ; if ( d != 0 || *s1 == '\0' || *s2 == '\0' ) return d; ++s1; --- 44,50 ---- /* case insensitive comparison */ register int d; for (;;) { ! d = (tolower(*s1) - tolower(*s2)); if ( d != 0 || *s1 == '\0' || *s2 == '\0' ) return d; ++s1; Index: lib/ldstate.c Prereq: 5.5 *** ../elm2.4/lib/ldstate.c Wed Feb 3 10:26:31 1993 --- lib/ldstate.c Sun Aug 22 22:46:53 1993 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: ldstate.c,v 5.5 1993/02/03 15:26:13 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.5 $ $State: Exp $ * * Copyright (c) 1992 USENET Community Trust ******************************************************************************* --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: ldstate.c,v 5.6 1993/08/23 02:46:51 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.6 $ $State: Exp $ * * Copyright (c) 1992 USENET Community Trust ******************************************************************************* *************** *** 13,18 **** --- 13,22 ---- * ******************************************************************************* * $Log: ldstate.c,v $ + * Revision 5.6 1993/08/23 02:46:51 syd + * Test ANSI_C, not __STDC__ (which is not set on e.g. AIX). + * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg) + * * Revision 5.5 1993/02/03 15:26:13 syd * protect atol in ifndef __STDC__ as some make it a macro, and its in stdlib.h * *************** *** 57,64 **** * the (struct folder_state) record. */ ! #ifndef __STDC__ /* avoid problemswith systems that declare atol as a macro */ ! extern long atol(); #endif static char *elm_fgetline(buf, buflen, fp) --- 61,68 ---- * the (struct folder_state) record. */ ! #if !ANSI_C /* avoid problems with systems that declare atol as a macro */ ! extern long atol(); #endif static char *elm_fgetline(buf, buflen, fp) Index: lib/len_next.c Prereq: 5.4 *** ../elm2.4/lib/len_next.c Sun Apr 11 21:27:30 1993 --- lib/len_next.c Tue Aug 3 15:28:51 1993 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: len_next.c,v 5.4 1993/04/12 01:27:30 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.4 $ $State: Exp $ * * Copyright (c) 1992 USENET Community Trust ******************************************************************************* --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: len_next.c,v 5.5 1993/08/03 19:28:39 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.5 $ $State: Exp $ * * Copyright (c) 1992 USENET Community Trust ******************************************************************************* *************** *** 13,18 **** --- 13,30 ---- * ******************************************************************************* * $Log: len_next.c,v $ + * Revision 5.5 1993/08/03 19:28:39 syd + * Elm tries to replace the system toupper() and tolower() on current + * BSD systems, which is unnecessary. Even worse, the replacements + * collide during linking with routines in isctype.o. This patch adds + * a Configure test to determine whether replacements are really needed + * (BROKE_CTYPE definition). The header file is now included + * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled + * there. Inclusion of was removed from *all* the individual + * files, and the toupper() and tolower() routines in lib/opt_utils.c + * were dropped. + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * * Revision 5.4 1993/04/12 01:27:30 syd * len_next_part() was botching quote-delimited strings. * From: chip@chinacat.unicom.com (Chip Rosenthal) *************** *** 54,61 **** **/ - #include - int len_next_part(str) --- 66,71 ---- Index: lib/mail_gets.c Prereq: 5.2 *** ../elm2.4/lib/mail_gets.c Sun Apr 11 21:13:30 1993 --- lib/mail_gets.c Tue Aug 3 15:28:52 1993 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: mail_gets.c,v 5.2 1993/04/12 01:13:30 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.2 $ $State: Exp $ * * Copyright (c) 1992 USENET Community Trust ******************************************************************************* --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: mail_gets.c,v 5.4 1993/08/03 19:28:39 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.4 $ $State: Exp $ * * Copyright (c) 1992 USENET Community Trust ******************************************************************************* *************** *** 13,18 **** --- 13,39 ---- * ******************************************************************************* * $Log: mail_gets.c,v $ + * Revision 5.4 1993/08/03 19:28:39 syd + * Elm tries to replace the system toupper() and tolower() on current + * BSD systems, which is unnecessary. Even worse, the replacements + * collide during linking with routines in isctype.o. This patch adds + * a Configure test to determine whether replacements are really needed + * (BROKE_CTYPE definition). The header file is now included + * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled + * there. Inclusion of was removed from *all* the individual + * files, and the toupper() and tolower() routines in lib/opt_utils.c + * were dropped. + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * + * Revision 5.3 1993/08/03 19:05:33 syd + * When STDC is used on Convex the feof() function is defined as + * a true library routine in the header files and moreover the + * library routine also leaks royally. It returns always 1!! + * So we have to use a macro. Convex naturally does not provide + * you with one though if you are using a STDC compiler. So we + * have to include one. + * From: Jukka Ukkonen + * * Revision 5.2 1993/04/12 01:13:30 syd * In some cases, with certain editors, the user can create an * aliases.text file in which the last line is terminated with an EOF but *************** *** 33,40 **** **/ #include ! #include ! int mail_gets(buffer, size, mailfile) --- 54,60 ---- **/ #include ! #include "defs.h" int mail_gets(buffer, size, mailfile) *************** *** 46,51 **** --- 66,72 ---- register char *c = buffer; size--; /* allow room for zero terminator on end, just in case */ + while (!feof(mailfile) && !ferror(mailfile) && line_bytes < size) { ch = getc(mailfile); /* Macro, faster than fgetc() ! */ Index: lib/mcprt.c *** ../elm2.4/lib/mcprt.c Sat Oct 3 18:42:25 1992 --- lib/mcprt.c Sun Aug 22 22:49:36 1993 *************** *** 1,4 **** --- 1,6 ---- + static char rcsid[] = "@(#)$Id: mcprt.c,v 5.5 1993/08/23 02:49:35 syd Exp $"; + /*********************************************************** Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts. *************** *** 35,41 **** 01/18/91 3 hamilton #if not rescanned 01/12/91 1 schulert conditionally use prototypes ! rework to use either varargs or stdargs 11/03/90 2 hamilton Alphalpha->Alfalfa & OmegaMail->Poste 08/10/90 1 nazgul printf, sprintf and fprintf */ --- 37,43 ---- 01/18/91 3 hamilton #if not rescanned 01/12/91 1 schulert conditionally use prototypes ! rework to use either varargs or stdarg 11/03/90 2 hamilton Alphalpha->Alfalfa & OmegaMail->Poste 08/10/90 1 nazgul printf, sprintf and fprintf */ *************** *** 47,55 **** --- 49,61 ---- #include "mcprt.h" #include "mcprtlib.h" + #ifdef I_STDARG + int MCprintf(char *fmt, ...) + #else int MCprintf(fmt, va_alist) char *fmt; va_dcl + #endif { MCRockT *rock; int len, i; *************** *** 65,74 **** --- 71,84 ---- return len; } + #ifdef I_STDARG + int MCfprintf(FILE *fptr, char *fmt, ...) + #else int MCfprintf(fptr, fmt, va_alist) FILE *fptr; char *fmt; va_dcl + #endif { MCRockT *rock; int len, i; *************** *** 84,93 **** --- 94,107 ---- return len; } + #ifdef I_STDARG + int MCsprintf(char *cptr, char *fmt, ...) + #else int MCsprintf(cptr, fmt, va_alist) char *cptr; char *fmt; va_dcl + #endif { MCRockT *rock; int len, i; Index: lib/mcprtlib.c *** ../elm2.4/lib/mcprtlib.c Sat Oct 3 18:42:26 1992 --- lib/mcprtlib.c Sun Aug 22 22:54:32 1993 *************** *** 1,4 **** --- 1,6 ---- + static char rcsid[] = "@(#)$Id: mcprtlib.c,v 5.5 1993/08/23 02:54:31 syd Exp $"; + /*********************************************************** Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts. *************** *** 47,53 **** #define CATGETS #include - #include #include "defs.h" #include "mcprtlib.h" --- 49,54 ---- *************** *** 292,297 **** --- 293,302 ---- * Set the correct types and figure out how many data segments we are going * to have. */ + /* Initialize typeList */ + for (i = 0; i < typeCnt; i++) + typeList[i].type = 0; + for (replyCnt = i = 0; i < argCnt; ++i) { if (argList[i].type) { pos = argList[i].pos-1; *************** *** 580,586 **** if (rock->typeList) free((char *) rock->typeList); if (rock->replyList) { ! for (i = 0; i < rock->argCnt; ++i) { if ((rock->replyList[i].argType & MCFree) && rock->replyList[i].data) free(rock->replyList[i].data); } --- 585,591 ---- if (rock->typeList) free((char *) rock->typeList); if (rock->replyList) { ! for (i = 0; i < rock->replyCnt; ++i) { if ((rock->replyList[i].argType & MCFree) && rock->replyList[i].data) free(rock->replyList[i].data); }