Subject: elm 2.4 Patch #24a Date: Fri Sep 23 21:43:13 EDT 1994 Summary: This is an official patch for elm 2.4 system. Please apply it. Priority: LOW ========================================================= Patch Set - Patches 24: Tue Sep 20 14:01:13 EDT 1994 Elm 2.4PL23 -> Elm 2.4PL24 Remove autoreply/arepdaem, its a security hole From: Syd Fix where buffer was not getting null terminated during its construction, so the strcat failed (due to garbage data existing in the array at malloc() time). From: lm@yallara.cs.rmit.oz.au (Luke Mewburn) Fix ANSI prototype stripping macro From: "Tom Moore" fixed ReadCh() to recover from EINTR and EAGAIN instead of just returning an unexpected EOF. From: Jukka Ukkonen Replaced the get_tz_mins() routine in lib/get_tz.c with a portable version that requires no configuration. Rewrote the test case in lib/get_tz.c, and also wrote in support to simplify configuration tests. Dropped TZMINS_USE_XXXX configuration parameter. Simplified timezone determination in Configure. The new get_tz_mins() introduces two side effects. First it steps on the static data returned by localtime(). Second, it uses a routine in lib/date_util.c, which requires debug initializations. Rewrote get_arpa_date() to work around the first issue. Rather than doing the same for lib/strftime.c, just removed the timezone stuff with a conditional compile. Elm does not use it. Added debugging initializations to util/fastmail.c. From: chip@chinacat.unicom.com (Chip Rosenthal) I made the following changes to elm 2.4pl23 module pmalloc.c after testing on a DEC Alpha running OSF1 v1.3. The difficulty is that the Alpha hardware requires certain alignment for some operations which was not supplied by pmalloc (8 byte for addresses instead of 4 byte). I made a simple minded change to pmalloc.c to force alignment of the allocated data block to be adequate on DEC Alpha OSF1. From: jim@lime.rsmas.miami.edu (Jim Brown) detect whether atol() is a macro From: Mitch DSouza Recognize the "#$HDR" magic cookie as the header to place in the user's elmrc file rather than hardwiring a minimally helpful string into the binary. From: chip@chinacat.unicom.com (Chip Rosenthal) Fix Elm looping if an EOF is received. From: Gregory Neil Shapiro There is a bug in the alias-system of elm-2.4.23 that did not appear in elm-2.4.21. When searching for a string in the alias-table with the '//' command, elm sometimes gets a segmentation fault. With help of a debugger, I found that the function shift_lower gets a NULL argument. A fix is appended, but maybe the problem lies elsewhere. From: Sjaak Schilperoort The latest Linux shared library (4.5.8) "catches" a double fclose() by generating a SIGSEGV. :-/ From: fin!chip@dg-rtp.dg.com (Chip Salzenberg) Fix a line of debug output that is too long From: "C.R. Ritson" Here are some more of fixes to correctly call fflush() and unlock() in sequence. From: Jukka Ukkonen I had to put in some changes to builtin+ to allow it to display 8-bit letters as they should when the message has been sent through a real 8-bit channel like ESMTP with 8bit MIME Content- Transfer-Encoding. From: Jukka Ukkonen Tune the Ultrix fix for ispell From: Bill Gianopoulos Solaris 2.3 can return EACCES or EEXIST for lockfile already existing. From: xcea@uxa.ecn.bgu.edu (Chad Adams) Below are the changes required to compile/link elm 2.4 pl23 under QNX 4.2 with the Watcom 9.5 compiler (very picky). From: "Brian Campbell" In utils/from.c there was a conditionalized declaration of getpwuid() which was triggered by the environment being non- POSIX instead of non-STDC. From: Jukka Antero Ukkonen There was a typo in src/curses.c. An include read out like "# include " though the file name should have been varargs.h. From: Jukka Antero Ukkonen Just a minor fix to an impossible character comparison. From: Jukka Ukkonen I found a few months old patch I have not sent you before (I guess). It avoids unknowingly confusing some too rigidly and simple mindedly coded mailers with weird settings like charset=us-ascii and textencoding=8bit This patch will force 7bit encoding with charset=us-ascii. E.g. older versions of pine will dump core on 8bit & us-ascii. From: Jukka Ukkonen I had to add a region of conditional compilation around "defs.h" to make Configure work correctly with the TZNAME_USE_xxxx stuff. From: Jukka Ukkonen The "copy_message" function in src/fileio.c incorrectly computes the size of the message. The "bytes_seen" variable currently counts all bytes in the message ***including the message header*** when it should only be counting the bytes in the actual body of the message. From: Thomas Dwyer III Extra } in edit_mailbox removed. From: Jan.Djarv@sa.erisoft.se (Jan Djarv) Add an fflush to detect over quota on file saves. From: Larry Schwimmer Block sigwinch when in the external pager. From: jwa@yog-sothoth.dcrt.nih.gov (James W. Adams) Work around null from names by looking to see whether the second or third field is a valid month and using that to determine if there is an address. From: alex@samwise.dccs.upenn.edu (Alex Garthwaite) Fix up Solaris and SVR4 timeout signal handling From: Syd Add extern declaration of strerror to avoid compiler warning. From: Jan.Djarv@sa.erisoft.se (Jan Djarv) Moved #defines for SETJMP & LONGJMP from src/editmsg.c to hdrs/defs.h and used them instead of (set|long)jmp directly. This makes the usage consistent and Solaris 2.3 behaves correctly w.r.t stop/continue. From: Jan.Djarv@sa.erisoft.se (Jan Djarv) 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 filexp <&2 - exit 1 - fi - case "\$1" in - */*) - echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` - ;; - *) - echo \$dir - ;; - esac - fi - ;; - *) - echo \$1 - ;; - esac - EOSS - chmod +x filexp - $eunicefix filexp - - : determine where public executables go - case "$bin" in - '') - dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin` - ;; - *) dflt="$bin" - ;; - esac - cont=true - while $test "$cont" ; do - echo " " - rp="Where do you want to put the public executables? [$dflt]" - $echo $n "$rp $c" - . myread - bin="$ans" - bin=`filexp $bin` - if test -d $bin; then - cont='' - else - case "$fastread" in - yes) dflt=y;; - *) dflt=n;; - esac - rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]" - $echo $n "$rp $c" - . myread - dflt='' - case "$ans" in - y*) cont='';; - esac - fi - done - : see if date exists, if so, init c_date if $test ! "x$date" = "x" ; then c_date=`LANGUAGE= $date` --- 703,708 ---- *************** *** 1034,1039 **** --- 962,1005 ---- passcat='cat /etc/passwd' fi + : set up shell script to do ~ expansion + cat >filexp <&2 + exit 1 + fi + case "\$1" in + */*) + echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` + ;; + *) + echo \$dir + ;; + esac + fi + ;; + *) + echo \$1 + ;; + esac + EOSS + chmod +x filexp + $eunicefix filexp + # determine text processor to use, default to troff if found. case "$roff" in '') *************** *** 4003,4009 **** if $test -n "$i_sysutime"; then echo "Found " i_utime="$undef" ! i_sys/utime="$define" else echo "Did not find or " i_utime="$undef" --- 3969,3975 ---- if $test -n "$i_sysutime"; then echo "Found " i_utime="$undef" ! i_sysutime="$define" else echo "Did not find or " i_utime="$undef" *************** *** 4162,4167 **** --- 4128,4166 ---- Log='$Log' Header='$Header' + : determine where public executables go + case "$bin" in + '') + dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin` + ;; + *) dflt="$bin" + ;; + esac + cont=true + while $test "$cont" ; do + echo " " + rp="Where do you want to put the public executables? [$dflt]" + $echo $n "$rp $c" + . myread + bin="$ans" + bin=`filexp $bin` + if test -d $bin; then + cont='' + else + case "$fastread" in + yes) dflt=y;; + *) dflt=n;; + esac + rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]" + $echo $n "$rp $c" + . myread + dflt='' + case "$ans" in + y*) cont='';; + esac + fi + done + : see if there is a strftime set strftime d_strftime eval $inlibc *************** *** 4274,4280 **** if $test -d "$lib"; then cont='' else ! dflt=n rp="Directory $lib doesn't exist. Use that name anyway? [$dflt]" $echo $n "$rp $c" . myread --- 4273,4282 ---- if $test -d "$lib"; then cont='' else ! case "$fastread" in ! yes) dflt=y;; ! *) dflt=n;; ! esac rp="Directory $lib doesn't exist. Use that name anyway? [$dflt]" $echo $n "$rp $c" . myread *************** *** 4617,4623 **** fi : figure out timezone handling - # timezone handling part 1 of 4 - setup test files cp ../lib/get_tz.c try.c 2>/dev/null \ || $echo "Oh no! I cannot find the \"lib/get_tz.c\" file." cat >defs.h < #include - int get_tz_mins(); - char *get_tz_name(); - #ifdef TEST_FOR_TZMINS - #define TZNAME_USE_TZNAME - #ifdef tzname - # undef tzname - #endif - #define tzname tzfoo - char *tzfoo[] = { "FOO", "BAR" }; - main() { printf("%d\n", get_tz_mins((struct tm *)0)); exit(0); } - #else - main() { printf("%s\n", get_tz_name((struct tm *)0)); exit(0); } - #endif EOF - - # timezone handling part 2 of 4 - timezone offsets configuration $echo " " ! it_worked=0 if $test -f try.c ; then ! $echo "Trying to figure out how to get timezone offsets." ! dflt_handling=$tzmins_handling ! for tzmins_handling in DFLT TM_TZADJ TM_GMTOFF TZAZ_GLOBAL TZ_GLOBAL \ ! FTIME TIMEOFDAY ERROR ; do ! case "$tzmins_handling" in ! DFLT) tzmins_handling=$dflt_handling ;; ! ERROR) tzmins_handling=$dflt_handling ; break ;; ! $dflt_handling) tzmins_handling= ;; ! esac ! $test "$tzmins_handling" = "" && continue ! $echo "Trying -DTZMINS_USE_$tzmins_handling" ! $cc -DTZMINS_USE_$tzmins_handling -DTEST_FOR_TZMINS \ ! $ccflags try.c -o try >/dev/null 2>&1 || continue ! ./try >try.out 2>&1 || continue ! $echo "Alright! That seems to have worked." ! dflt=y ! rp="Are you `cat try.out` mins west of the prime meridian? [$dflt]" ! $echo $n "$rp $c" ! . myread ! case "$ans" in ! N*|n*) $echo "OK...I'll keep trying." ;; ! *) it_worked=1 ; break ;; ! esac ! done ! fi ! if $test $it_worked -ne 1 ; then ! $echo "I cannot figure out how to get timezone offsets." ! if $test "$tzmins_handling" != "" ; then ! $echo "You said \"$tzmins_handling\" worked last time so I'll use that." ! else ! $echo "You are going to have to manually set \"tzmins_handling\"." ! fi ! fi ! ! # timezone handling part 3 of 4 - timezone names configuration ! $echo " " ! it_worked=0 ! if $test "$tzmins_handling" != "" -a -f try.c ; then ! $echo "Trying to figure out how to get timezone names." ! dflt_handling=$tzname_handling for tzname_handling in DFLT TM_NAME TM_ZONE TZNAME TIMEZONE ERROR ; do case "$tzname_handling" in ! DFLT) tzname_handling=$dflt_handling ;; ! ERROR) tzname_handling=$dflt_handling ; break ;; ! $dflt_handling) tzname_handling= ;; esac - $test "$tzname_handling" = "" && continue $echo "Trying -DTZNAME_USE_$tzname_handling" ! $cc -DTZMINS_USE_$tzmins_handling -DTZNAME_USE_$tzname_handling \ ! $ccflags try.c -o try >/dev/null 2>&1 || continue ! ./try >try.out 2>&1 || continue ! $echo "Alright! That seems to have worked." ! dflt=y ! rp="Is \"`cat try.out`\" your local timezone name? [$dflt]" ! $echo $n "$rp $c" ! . myread ! case "$ans" in ! N*|n*) $echo "OK...I'll keep trying." ;; ! *) it_worked=1 ; break ;; ! esac done fi ! if $test $it_worked -ne 1 ; then $echo "I cannot figure out how to get timezone names." ! if $test "$tzname_handling" != "" ; then $echo "You said \"$tzname_handling\" worked last time so I'll use that." else ! $echo "You are going to have to manually set \"tzname_handling\"." fi fi - - # timezone handling part 4 of 4 - cleanup $rm -f defs.h try.c try.o try try.out --- 4626,4668 ---- #$i_systime I_SYSTIME #include #include EOF $echo " " ! dflt_handling=$tzname_handling ! tzname_handling= if $test -f try.c ; then ! $echo "Figuring out how to get timezone names." for tzname_handling in DFLT TM_NAME TM_ZONE TZNAME TIMEZONE ERROR ; do case "$tzname_handling" in ! DFLT) $test "$dflt_handling" = "" && continue ! tzname_handling=$dflt_handling ! ;; ! ERROR) tzname_handling= ! break ! ;; ! $dflt_handling) : avoid doing default twice ! continue ! ;; esac $echo "Trying -DTZNAME_USE_$tzname_handling" ! $cc -D_CONFIGURE -DTZNAME_USE_$tzname_handling $ccflags \ ! try.c -o try >/dev/null 2>&1 ! if $test $? -eq 0 && ./try >try.out 2>&1 ; then ! $echo "Alright! That seems to have worked." ! break ! fi done fi ! if $test "$tzname_handling" = "" ; then $echo "I cannot figure out how to get timezone names." ! if $test "$dflt_handling" != "" ; then ! tzname_handling="$dflt_handling" $echo "You said \"$tzname_handling\" worked last time so I'll use that." else ! tzname_handling=UNKNOWN ! $echo "You will have to set \"tzname_handling\" manually." fi fi $rm -f defs.h try.c try.o try try.out *************** *** 4982,4988 **** shsharp='$shsharp' sharpbang='$sharpbang' tmpdir='$tmpdir' - tzmins_handling='$tzmins_handling' tzname_handling='$tzname_handling' use_pmake='$use_pmake' xencf='$xencf' --- 4929,4934 ---- Index: Instruct *** ../elm2.4/Instruct Sun Dec 6 22:44:43 1992 --- Instruct Thu Mar 10 12:20:28 1994 *************** *** 1,7 **** Instructions ------------ ! Last Update: $Date: 1992/12/07 03:44:37 $ This file contains instructions on how to create and install --- 1,7 ---- Instructions ------------ ! Last Update: $Date: 1994/03/10 17:20:23 $ This file contains instructions on how to create and install *************** *** 49,57 **** that for the moment) you should now be able to list the directory "bin" and find the following files: ! answer checkalias filter messages printmail ! arepdaemon elm frm newalias readmsg ! autoreply fastmail listalias newmail next, you can install all the software on your system by; --- 49,57 ---- that for the moment) you should now be able to list the directory "bin" and find the following files: ! answer elmalias frm newalias prlong ! checkalias fastmail listalias newmail readmsg ! elm filter messages printmail next, you can install all the software on your system by; Index: MANIFEST *** ../elm2.4/MANIFEST Sun Sep 26 22:14:42 1993 --- MANIFEST Thu Mar 10 12:14:46 1994 *************** *** 17,23 **** doc/Ref.guide doc/Users.guide doc/answer.1 - doc/autoreply.1 doc/chkalias.1 doc/elm-help.0 doc/elm-help.1 --- 17,22 ---- *************** *** 64,71 **** hdrs/regexp.h hdrs/s_aliases.h hdrs/s_answer.h - hdrs/s_arepdaem.h - hdrs/s_autoreply.h hdrs/s_elm.h hdrs/s_elmalias.h hdrs/s_elmrc.h --- 63,68 ---- *************** *** 133,140 **** lib/validname.c nls/C/C/C/s_aliases.m nls/C/C/C/s_answer.m - nls/C/C/C/s_arepdaem.m - nls/C/C/C/s_autoreply.m nls/C/C/C/s_elm.m nls/C/C/C/s_elmalias.m nls/C/C/C/s_elmrc.m --- 130,135 ---- *************** *** 220,227 **** test/test.mail utils/Makefile.SH utils/answer.c - utils/arepdaem.c - utils/autoreply.c utils/checkalias.SH utils/elmalias.c utils/fastmail.c --- 215,220 ---- Index: Overview *** ../elm2.4/Overview Fri Jan 29 16:08:56 1993 --- Overview Thu Mar 10 12:18:49 1994 *************** *** 19,29 **** other UNIX Mail Transport Agent (according to what's on your system) and is a full replacement of programs like "/bin/mail" and "mailx". The system is more than just a single program, however, and includes ! programs like "frm" to list a 'table of contents' of your mail, "printmail" to quickly paginate mail files (to allow 'clean' ! printouts), and "autoreply", a systemwide daemon that can autoanswer ! mail for people while they're on vacation without having multiple ! copies spawned on the system. 2. What's New about Elm? --- 19,27 ---- other UNIX Mail Transport Agent (according to what's on your system) and is a full replacement of programs like "/bin/mail" and "mailx". The system is more than just a single program, however, and includes ! programs like "frm" to list a 'table of contents' of your mail, and "printmail" to quickly paginate mail files (to allow 'clean' ! printouts). 2. What's New about Elm? Index: Patchlist *** ../elm2.4/Patchlist Sun Sep 26 22:14:42 1993 --- Patchlist Tue Sep 20 14:01:14 1994 *************** *** 1,4 **** --- 1,151 ---- ========================================================= + Patch Set - Patches 24: Tue Sep 20 14:01:13 EDT 1994 + Elm 2.4PL23 -> Elm 2.4PL24beta + + Remove autoreply/arepdaem, its a security hole + From: Syd + + Fix where buffer was not getting null terminated during its + construction, so the strcat failed (due to garbage data existing in the + array at malloc() time). + From: lm@yallara.cs.rmit.oz.au (Luke Mewburn) + + Fix ANSI prototype stripping macro + From: "Tom Moore" + + fixed ReadCh() to recover from EINTR and EAGAIN instead + of just returning an unexpected EOF. + From: Jukka Ukkonen + + Replaced the get_tz_mins() routine in lib/get_tz.c with a portable + version that requires no configuration. Rewrote the test case in + lib/get_tz.c, and also wrote in support to simplify configuration + tests. Dropped TZMINS_USE_XXXX configuration parameter. Simplified + timezone determination in Configure. The new get_tz_mins() introduces + two side effects. First it steps on the static data returned by + localtime(). Second, it uses a routine in lib/date_util.c, which + requires debug initializations. Rewrote get_arpa_date() to work around + the first issue. Rather than doing the same for lib/strftime.c, just + removed the timezone stuff with a conditional compile. Elm does not + use it. Added debugging initializations to util/fastmail.c. + From: chip@chinacat.unicom.com (Chip Rosenthal) + + I made the following changes to elm 2.4pl23 module pmalloc.c after testing on + a DEC Alpha running OSF1 v1.3. The difficulty is that the Alpha hardware + requires certain alignment for some operations which was not supplied by + pmalloc (8 byte for addresses instead of 4 byte). I made a simple minded + change to pmalloc.c to force alignment of the allocated data block to be + adequate on DEC Alpha OSF1. + From: jim@lime.rsmas.miami.edu (Jim Brown) + + detect whether atol() is a macro + From: Mitch DSouza + + Recognize the "#$HDR" magic cookie as the header to place in the + user's elmrc file rather than hardwiring a minimally helpful + string into the binary. + From: chip@chinacat.unicom.com (Chip Rosenthal) + + Fix Elm looping if an EOF is received. + From: Gregory Neil Shapiro + + There is a bug in the alias-system of elm-2.4.23 that did not appear in + elm-2.4.21. When searching for a string in the alias-table with the '//' + command, elm sometimes gets a segmentation fault. With help of a debugger, + I found that the function shift_lower gets a NULL argument. A fix is + appended, but maybe the problem lies elsewhere. + From: Sjaak Schilperoort + + The latest Linux shared library (4.5.8) "catches" a double fclose() + by generating a SIGSEGV. :-/ + From: fin!chip@dg-rtp.dg.com (Chip Salzenberg) + + Fix a line of debug output that is too long + From: "C.R. Ritson" + + Here are some more of fixes to correctly call fflush() and unlock() in sequence. + From: Jukka Ukkonen + + I had to put in some changes to builtin+ to allow it to display + 8-bit letters as they should when the message has been sent + through a real 8-bit channel like ESMTP with 8bit MIME Content- + Transfer-Encoding. + From: Jukka Ukkonen + + Tune the Ultrix fix for ispell + From: Bill Gianopoulos + + Solaris 2.3 can return EACCES or EEXIST for lockfile already existing. + From: xcea@uxa.ecn.bgu.edu (Chad Adams) + + Below are the changes required to compile/link elm 2.4 pl23 under + QNX 4.2 with the Watcom 9.5 compiler (very picky). + From: "Brian Campbell" + + In utils/from.c there was a conditionalized declaration of + getpwuid() which was triggered by the environment being non- + POSIX instead of non-STDC. + From: Jukka Antero Ukkonen + + There was a typo in src/curses.c. An include read out like + "# include " though the file name should have been + varargs.h. + From: Jukka Antero Ukkonen + + Just a minor fix to an impossible character comparison. + From: Jukka Ukkonen + + I found a few months old patch I have not sent you before (I guess). + It avoids unknowingly confusing some too rigidly and simple mindedly + coded mailers with weird settings like + + charset=us-ascii and textencoding=8bit + + This patch will force 7bit encoding with charset=us-ascii. + E.g. older versions of pine will dump core on 8bit & us-ascii. + From: Jukka Ukkonen + + I had to add a region of conditional compilation around "defs.h" + to make Configure work correctly with the TZNAME_USE_xxxx stuff. + From: Jukka Ukkonen + + The "copy_message" function in src/fileio.c incorrectly computes the + size of the message. The "bytes_seen" variable currently counts all + bytes in the message ***including the message header*** when it should + only be counting the bytes in the actual body of the message. + From: Thomas Dwyer III + + Extra } in edit_mailbox removed. + From: Jan.Djarv@sa.erisoft.se (Jan Djarv) + + Add an fflush to detect over quota on file saves. + From: Larry Schwimmer + + Block sigwinch when in the external pager. + From: jwa@yog-sothoth.dcrt.nih.gov (James W. Adams) + + Work around null from names by looking to see whether the second or + third field is a valid month and using that to determine if there + is an address. + From: alex@samwise.dccs.upenn.edu (Alex Garthwaite) + + Fix up Solaris and SVR4 timeout signal handling + From: Syd + + Add extern declaration of strerror to avoid compiler warning. + From: Jan.Djarv@sa.erisoft.se (Jan Djarv) + + Moved #defines for SETJMP & LONGJMP from src/editmsg.c to hdrs/defs.h and + used them instead of (set|long)jmp directly. This makes the usage consistent + and Solaris 2.3 behaves correctly w.r.t stop/continue. + From: Jan.Djarv@sa.erisoft.se (Jan Djarv) + + + + + + + ========================================================= Patch Set - Patches 23a through 23d: Sun Sep 19 19:48:31 EDT 1993 Elm 2.4PL22 -> Elm 2.4PL23 Index: config.h.SH *** ../elm2.4/config.h.SH Sun Sep 26 22:14:42 1993 --- config.h.SH Mon May 30 12:55:57 1994 *************** *** 583,597 **** */ #define SIGHAND_TYPE $sigtype - /* TZMINS_USE_xxxxxx: - * Specify how to get timezone offset. Possible values are: - * 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: * Specify how to get timezone name. Possible values are: * TZNAME_USE_TM_NAME use (struct tm *)->tm_name --- 583,588 ---- *************** *** 599,605 **** * TZNAME_USE_TZNAME use "tzname[]" external * TZNAME_USE_TIMEZONE use timezone() function */ - #define TZMINS_USE_$tzmins_handling #define TZNAME_USE_$tzname_handling /* XENIX: --- 590,595 ---- Index: doc/Makefile.SH Prereq: 5.11 *** ../elm2.4/doc/Makefile.SH Sun Apr 11 22:12:07 1993 --- doc/Makefile.SH Thu Mar 10 12:20:29 1994 *************** *** 16,28 **** echo "Extracting doc/Makefile (with variable substitutions)" cat >Makefile <Makefile < catman/autoreply$(CATMANEXT) - @if $(TEST) "$(PACKED)" = y ; then \ - $(RM) $@ ; \ - $(PACKER) catman/autoreply$(CATMANEXT) ; \ else \ true ; \ fi --- 391,396 ---- Index: doc/Users.guide Prereq: 5.8 *** ../elm2.4/doc/Users.guide Sat May 8 16:19:23 1993 --- doc/Users.guide Thu Mar 10 12:21:24 1994 *************** *** 1,4 **** ! .\" @(#)$Id: Users.guide,v 5.8 1993/05/08 20:00:22 syd Exp $ .\" .\" Users guide to the ELM mail system. .\" format with: --- 1,4 ---- ! .\" @(#)$Id: Users.guide,v 5.9 1994/03/10 17:21:21 syd Exp $ .\" .\" Users guide to the ELM mail system. .\" format with: *************** *** 12,17 **** --- 12,20 ---- .\" (C) Copyright 1988-1992 Usenet Community Trust .\" .\" $Log: Users.guide,v $ + .\" Revision 5.9 1994/03/10 17:21:21 syd + .\" remove autoreply + .\" .\" Revision 5.8 1993/05/08 20:00:22 syd .\" fix mail added >From lines .\" From: Syd *************** *** 875,885 **** .lp \h'10p'answer 1.0i An answering-machine transcription program. Please see the manual entry for more information on how to use this program. - - .lp \h'10p'autoreply 1.0i - This program, in conjunction with the \f2arepdaemon\f1, enables users - to automatically reply to incoming mail when they're not directly - available. .lp \h'10p'checkalias 1.0i A script for checking aliases simply. --- 878,883 ---- Index: doc/elmrc-info Prereq: 5.10 *** ../elm2.4/doc/elmrc-info Sun Sep 26 22:14:44 1993 --- doc/elmrc-info Fri Mar 11 16:19:26 1994 *************** *** 1,6 **** ! #@(#)$Id: elmrc-info,v 5.10 1993/08/23 02:53:52 syd Exp $ # Elm Version 2.4 ! # For yes/no settings with ?, ON means yes, OFF means no shell # The shell to use for shell escapes --- 1,17 ---- ! #@(#)$Id: elmrc-info,v 5.11 1994/03/11 21:19:26 syd Exp $ # Elm Version 2.4 ! # ! #$HDR - magic line to mark comments to put at top of user's elmrc file. ! # ! # For yes/no settings, ON means yes, OFF means no. ! # ! # Lines beginning with "#" (like this one!) are comments. ! # ! # The "###" lines mean that you do not have a value set and the system ! # default will be used. The value shown was the default at the time ! # this file was created. Yes...the default could have changed between ! # then and now. ! # shell # The shell to use for shell escapes Index: filter/filter.c Prereq: 5.6 *** ../elm2.4/filter/filter.c Sun Sep 26 22:14:44 1993 --- filter/filter.c Mon May 30 12:31:55 1994 *************** *** 1,8 **** ! static char rcsid[] ="@(#)$Id: filter.c,v 5.6 1993/08/03 19:28:39 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: filter.c,v 5.7 1994/05/30 16:31:40 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.7 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,23 ---- * ******************************************************************************* * $Log: filter.c,v $ + * Revision 5.7 1994/05/30 16:31:40 syd + * make getpwuid dependent on ANSI_C not posix flag + * From: Syd + * * Revision 5.6 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 *************** *** 98,104 **** extern char *optarg; FILE *fd; /* for output to temp file! */ struct passwd *passwd_entry; ! #ifndef _POSIX_SOURCE struct passwd *getpwuid(); /* for /etc/passwd */ #endif char filename[SLEN], /* name of the temp file */ --- 102,108 ---- extern char *optarg; FILE *fd; /* for output to temp file! */ struct passwd *passwd_entry; ! #ifndef ANSI_C struct passwd *getpwuid(); /* for /etc/passwd */ #endif char filename[SLEN], /* name of the temp file */ Index: filter/rules.c Prereq: 5.8 *** ../elm2.4/filter/rules.c Sun Sep 26 22:15:11 1993 --- filter/rules.c Fri Mar 11 15:40:24 1994 *************** *** 1,8 **** ! static char rcsid[] ="@(#)$Id: rules.c,v 5.8 1993/08/03 19:28:39 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,8 ---- ! static char rcsid[] ="@(#)$Id: rules.c,v 5.9 1994/03/11 20:40:24 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.9 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,25 ---- * ******************************************************************************* * $Log: rules.c,v $ + * Revision 5.9 1994/03/11 20:40:24 syd + * Fix where buffer was not getting null terminated during its + * construction, so the strcat failed (due to garbage data existing in the + * array at malloc() time). + * From: lm@yallara.cs.rmit.oz.au (Luke Mewburn) + * * Revision 5.8 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 *************** *** 359,365 **** else regsub = word[i] - '0'; if (display) { ! strcat(buffer,catgets(elm_msg_cat, FilterSet, regmessage[regsub].id, regmessage[regsub].str)); --- 365,371 ---- else regsub = word[i] - '0'; if (display) { ! strcpy(buffer + j,catgets(elm_msg_cat, FilterSet, regmessage[regsub].id, regmessage[regsub].str)); Index: hdrs/defs.h Prereq: 5.33 *** ../elm2.4/hdrs/defs.h Sun Sep 26 22:14:45 1993 --- hdrs/defs.h Thu Sep 1 15:42:39 1994 *************** *** 1,8 **** ! /* $Id: defs.h,v 5.33 1993/09/19 23:40:48 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 5.33 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- ! /* $Id: defs.h,v 5.35 1994/09/01 19:42:39 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 5.35 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,30 ---- * ******************************************************************************* * $Log: defs.h,v $ + * Revision 5.35 1994/09/01 19:42:39 syd + * Moved #defines for SETJMP & LONGJMP from src/editmsg.c to hdrs/defs.h and + * used them instead of (set|long)jmp directly. This makes the usage consistent + * and Solaris 2.3 behaves correctly w.r.t stop/continue. + * From: Jan.Djarv@sa.erisoft.se (Jan Djarv) + * + * Revision 5.34 1994/05/15 23:10:08 syd + * Below are the changes required to compile/link elm 2.4 pl23 under + * QNX 4.2 with the Watcom 9.5 compiler (very picky). + * From: "Brian Campbell" + * * Revision 5.33 1993/09/19 23:40:48 syd * Defince SEEK_SET in one of our headers as a last resort * From: Syd *************** *** 649,654 **** --- 660,667 ---- #define MCprintf printf #define MCfprintf fprintf #define MCsprintf sprintf + #else + #include "mcprt.h" #endif #ifdef POSIX_SIGNALS *************** *** 666,671 **** --- 679,694 ---- #endif #endif /* SIGSET */ #endif /* POSIX_SIGNALS */ + + #if defined(POSIX_SIGNALS) && !defined(__386BSD__) + # define JMP_BUF sigjmp_buf + # define SETJMP(env) sigsetjmp((env), 1) + # define LONGJMP(env,val) siglongjmp((env), (val)) + #else + # define JMP_BUF jmp_buf + # define SETJMP(env) setjmp(env) + # define LONGJMP(env,val) longjmp((env), (val)) + #endif /* * Some of the old BSD ctype conversion macros corrupted characters. Index: hdrs/elm.h Prereq: 5.10 *** ../elm2.4/hdrs/elm.h Sun Sep 26 22:14:45 1993 --- hdrs/elm.h Thu Sep 1 15:42:40 1994 *************** *** 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 --- 1,8 ---- ! /* $Id: elm.h,v 5.12 1994/09/01 19:42:39 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 5.12 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,29 ---- * ******************************************************************************* * $Log: elm.h,v $ + * Revision 5.12 1994/09/01 19:42:39 syd + * Moved #defines for SETJMP & LONGJMP from src/editmsg.c to hdrs/defs.h and + * used them instead of (set|long)jmp directly. This makes the usage consistent + * and Solaris 2.3 behaves correctly w.r.t stop/continue. + * From: Jan.Djarv@sa.erisoft.se (Jan Djarv) + * + * Revision 5.11 1994/08/30 18:16:05 syd + * Fix up Solaris and SVR4 signal handling for timeout + * From: Syd + * * 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 *************** *** 81,90 **** #include "../hdrs/curses.h" #include "../hdrs/defs.h" - - #ifdef BSD #include - #endif /******** static character string containing the version number *******/ --- 91,97 ---- *************** *** 283,289 **** int mailgroupid; /* groupid for current user */ #endif ! #ifdef BSD ! jmp_buf GetPromptBuf; /* setjmp buffer */ int InGetPrompt; /* set if in GetPrompt() in read() */ - #endif --- 290,294 ---- int mailgroupid; /* groupid for current user */ #endif ! JMP_BUF GetPromptBuf; /* setjmp buffer */ int InGetPrompt; /* set if in GetPrompt() in read() */ Index: hdrs/headers.h Prereq: 5.11 *** ../elm2.4/hdrs/headers.h Sun Sep 26 22:14:45 1993 --- hdrs/headers.h Thu Sep 1 15:42:40 1994 *************** *** 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 --- 1,8 ---- ! /* $Id: headers.h,v 5.13 1994/09/01 19:42:39 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 5.13 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,29 ---- * ******************************************************************************* * $Log: headers.h,v $ + * Revision 5.13 1994/09/01 19:42:39 syd + * Moved #defines for SETJMP & LONGJMP from src/editmsg.c to hdrs/defs.h and + * used them instead of (set|long)jmp directly. This makes the usage consistent + * and Solaris 2.3 behaves correctly w.r.t stop/continue. + * From: Jan.Djarv@sa.erisoft.se (Jan Djarv) + * + * Revision 5.12 1994/08/30 18:16:05 syd + * Fix up Solaris and SVR4 signal handling for timeout + * From: Syd + * * Revision 5.11 1993/08/10 20:49:40 syd * Add raw_temp_dir * *************** *** 81,90 **** #include "curses.h" #include "defs.h" - - #ifdef BSD #include - #endif #ifdef MIME #include "mime.h" --- 91,97 ---- *************** *** 274,280 **** extern int mailgroupid; /* groupid for current user */ #endif ! #ifdef BSD ! extern jmp_buf GetPromptBuf; /* setjmp buffer */ extern int InGetPrompt; /* set if in GetPrompt() in read() */ - #endif --- 281,285 ---- extern int mailgroupid; /* groupid for current user */ #endif ! extern JMP_BUF GetPromptBuf; /* setjmp buffer */ extern int InGetPrompt; /* set if in GetPrompt() in read() */ Index: hdrs/mcprt.h *** ../elm2.4/hdrs/mcprt.h Sun Sep 26 22:14:46 1993 --- hdrs/mcprt.h Thu Jun 30 12:42:29 1994 *************** *** 48,54 **** #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, ...); --- 48,54 ---- #include #ifdef USENLS ! # ifdef ANSI_C extern int MCprintf(char *fmt, ...); extern int MCfprintf(FILE *fptr, char *fmt, ...); extern int MCsprintf(char *cptr, char *fmt, ...); Index: hdrs/s_elmrc.h *** ../elm2.4/hdrs/s_elmrc.h Sat Oct 3 18:35:12 1992 --- hdrs/s_elmrc.h Fri Mar 11 16:18:49 1994 *************** *** 1,4 **** ! /* s_elmrc.h created from s_elmrc.us by gencat on Sat Oct 3 18:34:09 EDT 1992 */ #define ElmrcSet 0x1 #define ElmrcExpandHome 0x1 --- 1,4 ---- ! /* s_elmrc.h created from s_elmrc.us by gencat on Fri Mar 11 16:18:48 EST 1994 */ #define ElmrcSet 0x1 #define ElmrcExpandHome 0x1 *************** *** 10,13 **** #define ElmrcOptionsFile 0x7 #define ElmrcSavedAutoFor 0x8 #define ElmrcSavedAuto 0x9 - #define ElmrcYesNoMeans 0xa --- 10,12 ---- Index: lib/errno.c Prereq: 5.3 *** ../elm2.4/lib/errno.c Tue Apr 20 21:58:28 1993 --- lib/errno.c Thu Sep 1 15:42:07 1994 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: errno.c,v 5.3 1993/04/21 01:58:20 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: errno.c,v 5.4 1994/09/01 19:42: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,23 ---- * ******************************************************************************* * $Log: errno.c,v $ + * Revision 5.4 1994/09/01 19:42:07 syd + * Add extern declaration of strerror to avoid compiler warning. + * From: Jan.Djarv@sa.erisoft.se (Jan Djarv) + * * Revision 5.3 1993/04/21 01:58:20 syd * change to detect strerror routine * From: Syd *************** *** 91,96 **** --- 95,102 ---- int errnumber; { #ifdef STRERROR + + extern char *strerror(); return strerror(errnumber); Index: lib/get_tz.c Prereq: 5.1 *** ../elm2.4/lib/get_tz.c Sun Sep 26 22:14:49 1993 --- lib/get_tz.c Mon May 30 12:53:43 1994 *************** *** 1,8 **** ! 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 ******************************************************************************* --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: get_tz.c,v 5.4 1994/05/30 16:53:35 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.4 $ $State: Exp $ * * Copyright (c) 1992, 1993 USENET Community Trust ******************************************************************************* *************** *** 13,71 **** * ******************************************************************************* * $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 --- 13,46 ---- * ******************************************************************************* * $Log: get_tz.c,v $ + * Revision 5.4 1994/05/30 16:53:35 syd + * back out revision, uses local defs.h + * + * Revision 5.3 1994/05/30 16:46:07 syd + * I had to add a region of conditional compilation around "defs.h" + * to make Configure work correctly with the TZNAME_USE_xxxx stuff. + * From: Jukka Ukkonen + * + * Revision 5.2 1994/03/11 20:55:23 syd + * Replaced the get_tz_mins() routine in lib/get_tz.c with a portable + * version that requires no configuration. Rewrote the test case in + * lib/get_tz.c, and also wrote in support to simplify configuration + * tests. Dropped TZMINS_USE_XXXX configuration parameter. Simplified + * timezone determination in Configure. The new get_tz_mins() introduces + * two side effects. First it steps on the static data returned by + * localtime(). Second, it uses a routine in lib/date_util.c, which + * requires debug initializations. Rewrote get_arpa_date() to work around + * the first issue. Rather than doing the same for lib/strftime.c, just + * removed the timezone stuff with a conditional compile. Elm does not + * use it. Added debugging initializations to util/fastmail.c. + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * * Revision 5.1 1993/08/10 18:56:53 syd * Initial Checkin * * ******************************************************************************/ #include "defs.h" #ifdef I_TIME *************** *** 74,204 **** #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; --- 49,132 ---- #ifdef I_SYSTIME # include #endif #ifndef _POSIX_SOURCE extern struct tm *localtime(); + extern struct tm *gmtime(); extern time_t time(); #endif ! #ifdef _CONFIGURE ! /* ! * The "Configure" program will try to determine the proper setting to make ! * "get_tz_name()" work. It will compile the program with _CONFIGURE enabled. ! * We do not want to build "get_tz_mins()" when doing the config tests. ! */ ! #define get_tz_mins() 0 ! main() { ! char *get_tz_name(); ! puts(get_tz_name((struct tm *)0)); ! exit(0); ! } #endif ! #ifndef _CONFIGURE /*{*/ ! /* ! * get_tz_mins() - Return the local timezone offset in minutes west of GMT. ! * ! * WARNING -- This routine will step on the static data returned by ! * localtime() and gmtime(). Precautions must be taken in the calling ! * routine to avoid trouncing the time information being used. ! * ! * An earlier version of Elm had a more complicated routine of the same ! * name. This implementation is more limited in that it calculates only ! * the local TZ offset. The old routine was able to calculate any TZ ! * offset given a (struct tm *). ! */ ! int get_tz_mins() ! { ! time_t tval; ! struct tm *tm; ! long t2, t1; ! extern long make_gmttime(); /* from date_util.c */ ! time(&tval); ! tm = localtime(&tval); ! t1 = make_gmttime(tm->tm_year, tm->tm_mon, tm->tm_mday, ! tm->tm_hour, tm->tm_min, tm->tm_sec); ! tm = gmtime(&tval); ! t2 = make_gmttime(tm->tm_year, tm->tm_mon, tm->tm_mday, ! tm->tm_hour, tm->tm_min, tm->tm_sec); ! return (int) ((t2-t1)/60); } + #endif /*}!_CONFIGURE*/ + ! /* ! * get_tz_name(tm) - Return timezone name. ! * ! * Try to return the timezone name associated with the time specified by ! * "tm", or the local timezone name if "tm" is NULL. On some systems, you ! * will get the local timezone name regardless of the "tm" value. ! * ! * Exactly one of the following definitions must be enabled to indicate ! * the system-specific method for timezone name handling. ! * ! * 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 TZNAME_HANDLING definition is just used to verify the configurations ! * was setup correctly. It will force a compiler warning or error if there ! * is a configuration problem. ! */ char *get_tz_name(tm) struct tm *tm; *************** *** 245,254 **** * 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 --- 173,186 ---- * 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. + * WARNING!!! The "get_tz_mins()" routine is destructive + * to any (struct tm *) value that was obtained by gmtime() or + * localtime(). */ { extern char *timezone(); ! int isdst = tm->tm_isdst; ! return timezone(get_tz_mins(), isdst); } #endif *************** *** 258,296 **** #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); } --- 190,247 ---- #endif } #ifdef _TEST /* ! * This routine tests the timezone procedures by forcing a TZ value ! * and checking the results. This test routine is *not* portable. It ! * will work only on systems that (1) use the TZ environment parameter, ! * (2) have a putenv() procedure, and (3) putenv() takes a single argument. */ + int debug = 1; + FILE *debugfile = stderr; + + struct { + char *tz_setting; + char *expected_ans; + } trytable[] = { + { "", "local timezone setting" }, + { "TZ=GMT", "always GMT/0" }, + { "TZ=CST6CDT", "either CDT/300 or CST/360" }, + { "TZ=EST5EDT", "either EDT/240 or EST/300" }, + { "TZ=EST5EDT;0,364", "always EDT/240" }, + { "TZ=EST5EDT;0,0", "always EST/300" }, + { NULL, NULL } + }; + main() { time_t t; ! int i; ! extern char *getenv(); ! puts("Notes:"); ! puts("\"get_tz_name(gmtime)\" trial should always show GMT."); ! puts("\"get_tz_name(NULL)\" should match \"get_tz_name(localtime)\"."); ! puts("Results marked \"either/or\" depend whether DST in effect now."); ! ! for (i = 0 ; trytable[i].tz_setting != NULL ; ++i) { ! if (trytable[i].tz_setting[0] != '\0') ! putenv(trytable[i].tz_setting); ! putchar('\n'); ! printf("expected result: %s\n", trytable[i].expected_ans); ! printf("getenv(\"TZ\") = \"%s\"\n", getenv("TZ")); ! printf("get_tz_mins() = %d\n", get_tz_mins()); ! (void) time(&t); ! printf("get_tz_name(NULL) = \"%s\"\n", ! get_tz_name((struct tm *)0)); ! printf("get_tz_name(localtime) = \"%s\"\n", ! get_tz_name(localtime(&t))); ! printf("get_tz_name(gmtime) = \"%s\"\n", ! get_tz_name(gmtime(&t))); ! } exit(0); } Index: lib/getarpdate.c Prereq: 5.9 *** ../elm2.4/lib/getarpdate.c Sun Sep 26 22:14:49 1993 --- lib/getarpdate.c Fri Mar 11 15:55:24 1994 *************** *** 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 --- 1,7 ---- ! static char rcsid[] = "@(#)$Id: getarpdate.c,v 5.10 1994/03/11 20:55:23 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.10 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 13,18 **** --- 13,32 ---- * ******************************************************************************* * $Log: getarpdate.c,v $ + * Revision 5.10 1994/03/11 20:55:23 syd + * Replaced the get_tz_mins() routine in lib/get_tz.c with a portable + * version that requires no configuration. Rewrote the test case in + * lib/get_tz.c, and also wrote in support to simplify configuration + * tests. Dropped TZMINS_USE_XXXX configuration parameter. Simplified + * timezone determination in Configure. The new get_tz_mins() introduces + * two side effects. First it steps on the static data returned by + * localtime(). Second, it uses a routine in lib/date_util.c, which + * requires debug initializations. Rewrote get_arpa_date() to work around + * the first issue. Rather than doing the same for lib/strftime.c, just + * removed the timezone stuff with a conditional compile. Elm does not + * use it. Added debugging initializations to util/fastmail.c. + * From: chip@chinacat.unicom.com (Chip Rosenthal) + * * 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 *************** *** 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; } --- 106,155 ---- **/ 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 */ ! int tzsign; /* + or - gmt */ int year; /* current year - with century */ + /* + * The get_tz_mins() routine steps on the static data returned + * by localtime(), so we need to save off the value obtained here. + */ (void) time(&curr_time); ! curr_tm = *localtime(&curr_time); ! ! if ((year = curr_tm.tm_year) < 100) year += 1900; ! ! if ((tzmin = -get_tz_mins()) >= 0) { ! tzsign = '+'; } else { ! tzsign = '-'; tzmin = -tzmin; } ! ! sprintf(buffer, "%s, %d %s %d %02d:%02d:%02d %c%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; } + + + #ifdef _TEST + int debug = 1; + FILE *debugfile = stderr; + main() + { + printf("system(\"date\") says: "); + fflush(stdout); + system("date"); + fflush(stdout); + printf("get_arpa_date() says: %s\n", get_arpa_date()); + exit(0); + } + #endif +