Subject: elm 2.4 Patch #24b 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 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.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) *************** *** 61,67 **** * the (struct folder_state) record. */ ! #if !ANSI_C /* avoid problems with systems that declare atol as a macro */ extern long atol(); #endif --- 65,71 ---- * the (struct folder_state) record. */ ! #if !defined(ANSI_C) && !defined(atol) /* avoid problems with systems that declare atol as a macro */ extern long atol(); #endif Index: lib/mcprt.c Prereq: 5.5 *** ../elm2.4/lib/mcprt.c Sun Sep 26 22:14:50 1993 --- lib/mcprt.c Thu Jun 30 12:44:02 1994 *************** *** 1,5 **** ! 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. --- 1,5 ---- ! static char rcsid[] = "@(#)$Id: mcprt.c,v 5.6 1994/06/30 16:43:14 syd Exp $"; /*********************************************************** Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts. *************** *** 49,55 **** #include "mcprt.h" #include "mcprtlib.h" ! #ifdef I_STDARG int MCprintf(char *fmt, ...) #else int MCprintf(fmt, va_alist) --- 49,55 ---- #include "mcprt.h" #include "mcprtlib.h" ! #ifdef ANSI_C int MCprintf(char *fmt, ...) #else int MCprintf(fmt, va_alist) *************** *** 71,77 **** return len; } ! #ifdef I_STDARG int MCfprintf(FILE *fptr, char *fmt, ...) #else int MCfprintf(fptr, fmt, va_alist) --- 71,77 ---- return len; } ! #ifdef ANSI_C int MCfprintf(FILE *fptr, char *fmt, ...) #else int MCfprintf(fptr, fmt, va_alist) *************** *** 94,100 **** return len; } ! #ifdef I_STDARG int MCsprintf(char *cptr, char *fmt, ...) #else int MCsprintf(cptr, fmt, va_alist) --- 94,100 ---- return len; } ! #ifdef ANSI_C int MCsprintf(char *cptr, char *fmt, ...) #else int MCsprintf(cptr, fmt, va_alist) Index: lib/ndbz.c Prereq: 5.11 *** ../elm2.4/lib/ndbz.c Sun Sep 26 22:14:51 1993 --- lib/ndbz.c Fri Mar 11 16:34:01 1994 *************** *** 1,7 **** ! static char rcsid[] = "@(#)$Id: ndbz.c,v 5.11 1993/08/23 02:46:51 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,7 ---- ! static char rcsid[] = "@(#)$Id: ndbz.c,v 5.12 1994/03/11 21:01:35 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.12 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 13,18 **** --- 13,22 ---- * ******************************************************************************* * $Log: ndbz.c,v $ + * Revision 5.12 1994/03/11 21:01:35 syd + * detect whether atol() is a macro + * From: Mitch DSouza + * * Revision 5.11 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) *************** *** 274,280 **** #define MAPOUT(o) ((db->dbz_bytesame) ? (o) : bytemap((o), db->dbz_mybmap, db->dbz_conf.bytemap)) /* externals used */ ! #if !ANSI_C /* avoid problems with systems that declare atol as a macro */ extern long atol(); #endif --- 278,284 ---- #define MAPOUT(o) ((db->dbz_bytesame) ? (o) : bytemap((o), db->dbz_mybmap, db->dbz_conf.bytemap)) /* externals used */ ! #if !defined(atol) /* avoid problems with systems that declare atol as a macro */ extern long atol(); #endif Index: lib/opt_utils.c Prereq: 5.8 *** ../elm2.4/lib/opt_utils.c Sun Sep 26 22:14:52 1993 --- lib/opt_utils.c Mon May 30 12:31:56 1994 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: opt_utils.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: opt_utils.c,v 5.9 1994/05/30 16:31:40 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,23 ---- * ******************************************************************************* * $Log: opt_utils.c,v $ + * Revision 5.9 1994/05/30 16:31:40 syd + * make getpwuid dependent on ANSI_C not posix flag + * From: Syd + * * 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 *************** *** 185,191 **** **/ struct passwd *password_entry; ! #ifndef _POSIX_SOURCE struct passwd *getpwuid(); #endif char *name, *getlogin(); --- 189,195 ---- **/ struct passwd *password_entry; ! #ifndef ANSI_C struct passwd *getpwuid(); #endif char *name, *getlogin(); Index: lib/realfrom.c Prereq: 5.4 *** ../elm2.4/lib/realfrom.c Sun Sep 26 22:14:52 1993 --- lib/realfrom.c Tue Aug 30 11:11:20 1994 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: realfrom.c,v 5.4 1993/08/03 19:28:39 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.4 $ $State: Exp $ * * Copyright (c) 1993 USENET Community Trust ******************************************************************************* --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: realfrom.c,v 5.5 1994/08/30 15:11:20 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.5 $ $State: Exp $ * * Copyright (c) 1993 USENET Community Trust ******************************************************************************* *************** *** 13,18 **** --- 13,24 ---- * ******************************************************************************* * $Log: realfrom.c,v $ + * Revision 5.5 1994/08/30 15:11:20 syd + * 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) + * * 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 *************** *** 72,77 **** --- 78,85 ---- */ char field[STRING]; /* buffer for current field of line */ + char field2[STRING]; /* buffer for current field of line */ + char field3[STRING]; /* buffer for current field of line */ char save_tz[STRING]; /* extracted time zone field */ int len; /* length of current field */ int month, day, year, hours, mins, secs, tz, i; *************** *** 93,122 **** buffer += 5; dprint(7, (debugfile, "real_from parsing %s", buffer)); ! /* */ if ((len = get_word(buffer, 0, field, sizeof(field))) < 0) goto failed; buffer += len; - if (entry != NULL) - strfcpy(entry->from, field, sizeof(entry->from)); - dprint(7, (debugfile, " user=%s\n", field)); ! /* */ ! if ((len = get_word(buffer, 0, field, sizeof(field))) < 0) goto failed; buffer += len; ! /* */ ! if ((len = get_word(buffer, 0, field, sizeof(field))) < 0 || ! !cvt_monthname_to_monthnum(field, &month)) goto failed; buffer += len; ! /* */ ! if ((len = get_word(buffer, 0, field, sizeof(field))) < 0 || ! (day = atonum(field)) < 0 || day < 1 || day > 31) goto failed; ! buffer += len; /* */ if ((len = get_word(buffer, 0, field, sizeof(field))) < 0 || --- 101,150 ---- buffer += 5; dprint(7, (debugfile, "real_from parsing %s", buffer)); ! /* or */ if ((len = get_word(buffer, 0, field, sizeof(field))) < 0) goto failed; buffer += len; ! /* or */ ! if ((len = get_word(buffer, 0, field2, sizeof(field2))) < 0) goto failed; buffer += len; ! /* or */ ! if ((len = get_word(buffer, 0, field3, sizeof(field3))) < 0 ) goto failed; buffer += len; ! /* is in field2 or field3? */ ! if (!cvt_monthname_to_monthnum(field3, &month)) ! if (!cvt_monthname_to_monthnum(field2, &month)) goto failed; ! else ! { ! /* field2 is month, field3 is day */ ! /* */ ! if (entry != NULL) ! *( entry->from ) = '\0'; ! dprint(7, (debugfile, " user=\n")); ! ! /* */ ! if ((day = atonum(field3)) < 0 || day < 1 || day > 31) ! goto failed; ! } ! else ! { ! /* */ ! if (entry != NULL) ! strfcpy(entry->from, field, sizeof(field)); ! dprint(7, (debugfile, " user=%s\n", field)); ! ! /* */ ! if ((len = get_word(buffer, 0, field, sizeof(field))) < 0 || ! (day = atonum(field)) < 0 || day < 1 || day > 31) ! goto failed; ! buffer += len; ! } /* */ if ((len = get_word(buffer, 0, field, sizeof(field))) < 0 || Index: lib/shiftlower.c Prereq: 5.2 *** ../elm2.4/lib/shiftlower.c Sun Sep 26 22:14:53 1993 --- lib/shiftlower.c Fri Mar 11 17:11:09 1994 *************** *** 1,7 **** ! static char rcsid[] = "@(#)$Id: shiftlower.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 --- 1,7 ---- ! static char rcsid[] = "@(#)$Id: shiftlower.c,v 5.3 1994/03/11 22:11:09 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,26 ---- * ******************************************************************************* * $Log: shiftlower.c,v $ + * Revision 5.3 1994/03/11 22:11:09 syd + * 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 + * * 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 *************** *** 46,51 **** --- 54,63 ---- static char buffer[VERY_LONG_STRING]; register char *bufptr = buffer; + if (string == NULL) { + buffer[0] = 0; + return( (char *) buffer); + } for (; *string; string++, bufptr++) *bufptr = tolower(*string); Index: lib/strftime.c Prereq: 5.8 *** ../elm2.4/lib/strftime.c Sun Sep 26 22:14:53 1993 --- lib/strftime.c Sun May 15 20:05:33 1994 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: strftime.c,v 5.8 1993/08/23 02:46:51 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.8 $ $State: Exp $ * * Public-domain relatively quick-and-dirty implemenation of * ANSI library routine for System V Unix systems. --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: strftime.c,v 5.11 1994/05/16 00:05:27 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.11 $ $State: Exp $ * * Public-domain relatively quick-and-dirty implemenation of * ANSI library routine for System V Unix systems. *************** *** 19,24 **** --- 19,46 ---- * ******************************************************************************* * $Log: strftime.c,v $ + * Revision 5.11 1994/05/16 00:05:27 syd + * Update to strftime-6.1 + * From: Syd + * + * 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 1994/03/11 20:43:42 syd + * Fix ANSI prototype stripping macro + * From: "Tom Moore" + * * Revision 5.8 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) *************** *** 91,102 **** * Arnold Robbins * January, February, March, 1991 * Updated March, April 1992 ! * Updated May, 1993 * * Fixes from ado@elsie.nci.nih.gov * February 1991, May 1992 ! * Fixes from Tor Lillqvist tor@tik.vtt.fi * May, 1993 */ #include "headers.h" --- 113,128 ---- * Arnold Robbins * January, February, March, 1991 * Updated March, April 1992 ! * Updated April, 1993 ! * Updated February, 1994 ! * Updated May, 1994 * * Fixes from ado@elsie.nci.nih.gov * February 1991, May 1992 ! * Fixes from Tor Lillqvist tml@tik.vtt.fi * May, 1993 + * Further fixes from ado@elsie.nci.nih.gov + * February 1994 */ #include "headers.h" *************** *** 111,122 **** #if ANSI_C # define P_(x) x #else ! # define P_(x) /**/ # define const /**/ #endif - extern char *get_tz_name(); - #ifndef BSD extern void tzset P_((void)); #endif --- 137,146 ---- #if ANSI_C # define P_(x) x #else ! # define P_(x) () /**/ # define const /**/ #endif #ifndef BSD extern void tzset P_((void)); #endif *************** *** 146,152 **** #undef strchr /* avoid AIX weirdness */ ! adddecl(static int iso8601wknum();) #ifdef __GNUC__ #define inline __inline__ --- 170,176 ---- #undef strchr /* avoid AIX weirdness */ ! adddecl(static int iso8601wknum P_((const struct tm *timeptr));) #ifdef __GNUC__ #define inline __inline__ *************** *** 156,161 **** --- 180,190 ---- #define range(low, item, hi) maximum(low, minimum(item, hi)) + #if !defined(OS2) && !defined(MSDOS) && defined(TZNAME_USE_TZNAME) + extern char *tzname[2]; + extern int daylight; + #endif + /* minimum --- return minimum of two numbers */ #if !ANSI_C *************** *** 208,237 **** static int savetzlen = 0; char *tz; #endif /* POSIX_SEMANTICS */ /* various tables, useful in North America */ ! static char *days_a[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", }; ! static char *days_l[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", }; ! static char *months_a[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", }; ! static char *months_l[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", }; ! static char *ampm[] = { "AM", "PM", }; if (s == NULL || format == NULL || timeptr == NULL || maxsize == 0) return 0; if (strchr(format, '%') == NULL && strlen(format) + 1 >= maxsize) return 0; --- 237,272 ---- static int savetzlen = 0; char *tz; #endif /* POSIX_SEMANTICS */ + #ifdef TZNAME_USE_TIMEZONE + extern char *timezone(); + struct timeval tv; + struct timezone zone; + #endif /* TZNAME_USE_TIMEZONE */ /* various tables, useful in North America */ ! static const char *days_a[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", }; ! static const char *days_l[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", }; ! static const char *months_a[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", }; ! static const char *months_l[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", }; ! static const char *ampm[] = { "AM", "PM", }; if (s == NULL || format == NULL || timeptr == NULL || maxsize == 0) return 0; + /* quick check if we even need to bother */ if (strchr(format, '%') == NULL && strlen(format) + 1 >= maxsize) return 0; *************** *** 375,381 **** break; case 'U': /* week of year, Sunday is first day of week */ ! sprintf(tbuf, "%d", weeknumber(timeptr, 0)); break; case 'w': /* weekday, Sunday == 0, 0 - 6 */ --- 410,416 ---- break; case 'U': /* week of year, Sunday is first day of week */ ! sprintf(tbuf, "%02d", weeknumber(timeptr, 0)); break; case 'w': /* weekday, Sunday == 0, 0 - 6 */ *************** *** 384,390 **** break; case 'W': /* week of year, Monday is first day of week */ ! sprintf(tbuf, "%d", weeknumber(timeptr, 1)); break; case 'x': /* appropriate date representation */ --- 419,425 ---- break; case 'W': /* week of year, Monday is first day of week */ ! sprintf(tbuf, "%02d", weeknumber(timeptr, 1)); break; case 'x': /* appropriate date representation */ *************** *** 404,410 **** case 'y': /* year without a century, 00 - 99 */ i = timeptr->tm_year % 100; ! sprintf(tbuf, "%d", i); break; case 'Y': /* year with century */ --- 439,445 ---- case 'y': /* year without a century, 00 - 99 */ i = timeptr->tm_year % 100; ! sprintf(tbuf, "%02d", i); break; case 'Y': /* year with century */ *************** *** 412,418 **** break; case 'Z': /* time zone name or abbrevation */ ! strcpy(tbuf, get_tz_name(timeptr)); break; #ifdef SYSV_EXT --- 447,464 ---- break; case 'Z': /* time zone name or abbrevation */ ! #ifdef TZNAME_USE_TZNAME ! i = (daylight && timeptr->tm_isdst); /* 0 or 1 */ ! strcpy(tbuf, tzname[i]); ! #else ! #ifdef TZNAME_USE_TM_ZONE ! strcpy(tbuf, timeptr->tm_zone); ! #else ! gettimeofday(& tv, & zone); ! strcpy(tbuf, timezone(zone.tz_minuteswest, ! timeptr->tm_isdst)); ! #endif ! #endif break; #ifdef SYSV_EXT *************** *** 465,471 **** #ifdef VMS_EXT case 'v': /* date as dd-bbb-YYYY */ ! sprintf(tbuf, "%2d-%3.3s-%4d", range(1, timeptr->tm_mday, 31), months_a[range(0, timeptr->tm_mon, 11)], timeptr->tm_year + 1900); --- 511,517 ---- #ifdef VMS_EXT case 'v': /* date as dd-bbb-YYYY */ ! sprintf(tbuf, "%02d-%3.3s-%4d", range(1, timeptr->tm_mday, 31), months_a[range(0, timeptr->tm_mon, 11)], timeptr->tm_year + 1900); *************** *** 497,507 **** if (! warned && do_lint) { warned = 1; warning( ! "conversion %%V added in P1003.2/11.3; for VMS style date, use %%v"); } } #endif ! sprintf(tbuf, "%d", iso8601wknum(timeptr)); break; case 'u': --- 543,553 ---- if (! warned && do_lint) { warned = 1; warning( ! "conversion %%V added in P1003.2; for VMS style date, use %%v"); } } #endif ! sprintf(tbuf, "%02d", iso8601wknum(timeptr)); break; case 'u': *************** *** 517,528 **** break; } i = strlen(tbuf); ! if (i) if (s + i < endp - 1) { strcpy(s, tbuf); s += i; } else return 0; } out: if (s < endp && *format == '\0') { --- 563,575 ---- break; } i = strlen(tbuf); ! if (i) { if (s + i < endp - 1) { strcpy(s, tbuf); s += i; } else return 0; + } } out: if (s < endp && *format == '\0') { *************** *** 532,537 **** --- 579,599 ---- return 0; } + /* isleap --- is a year a leap year? */ + + #if !ANSI_C + static int + isleap(year) + int year; + #else + static int + isleap(int year) + #endif + { + return ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0); + } + + #ifdef POSIX2_DATE /* iso8601wknum --- compute week number according to ISO 8601 */ *************** *** 545,564 **** #endif { /* ! * From 1003.2 D11.3: * If the week (Monday to Sunday) containing January 1 * has four or more days in the new year, then it is week 1; ! * otherwise it is week 53 of the previous year, and the ! * next week is week 1. * * ADR: This means if Jan 1 was Monday through Thursday, ! * it was week 1, otherwise week 53. */ ! int simple_wknum, jan1day, diff, ret; /* get week number, Monday as first day of the week */ ! simple_wknum = weeknumber(timeptr, 1) + 1; /* * With thanks and tip of the hatlo to tml@tik.vtt.fi --- 607,629 ---- #endif { /* ! * From 1003.2: * If the week (Monday to Sunday) containing January 1 * has four or more days in the new year, then it is week 1; ! * otherwise it is the highest numbered week of the previous ! * (52 or 53) year, and the next week is week 1. * * ADR: This means if Jan 1 was Monday through Thursday, ! * it was week 1, otherwise week 52 or 53. ! * ! * XPG4 erroneously included POSIX.2 rationale text in the ! * main body of the standard. Thus it requires week 53. */ ! int weeknum, jan1day, diff; /* get week number, Monday as first day of the week */ ! weeknum = weeknumber(timeptr, 1); /* * With thanks and tip of the hatlo to tml@tik.vtt.fi *************** *** 579,595 **** /* * If Jan 1 was a Monday through Thursday, it was in ! * week 1. Otherwise it was last year's week 53, which is * this year's week 0. */ ! if (jan1day >= 1 && jan1day <= 4) ! diff = 0; ! else ! diff = 1; ! ret = simple_wknum - diff; ! if (ret == 0) /* we're in the first week of the year */ ! ret = 53; ! return ret; } #endif --- 644,690 ---- /* * If Jan 1 was a Monday through Thursday, it was in ! * week 1. Otherwise it was last year's highest week, which is * this year's week 0. + * + * What does that mean? + * If Jan 1 was Monday, the week number is exactly right, it can + * never be 0. + * If it was Tuesday through Thursday, the weeknumber is one + * less than it should be, so we add one. + * Otherwise, Friday, Saturday or Sunday, the week number is + * OK, but if it is 0, it needs to be 52 or 53. */ ! switch (jan1day) { ! case 1: /* Monday */ ! break; ! case 2: /* Tuesday */ ! case 3: /* Wednedsday */ ! case 4: /* Thursday */ ! weeknum++; ! break; ! case 5: /* Friday */ ! case 6: /* Saturday */ ! case 0: /* Sunday */ ! if (weeknum == 0) { ! #ifdef USE_BROKEN_XPG4 ! /* XPG4 (as of March 1994) says 53 unconditionally */ ! weeknum = 53; ! #else ! /* get week number of last week of last year */ ! struct tm dec31ly; /* 12/31 last year */ ! dec31ly = *timeptr; ! dec31ly.tm_year--; ! dec31ly.tm_mon = 11; ! dec31ly.tm_mday = 31; ! dec31ly.tm_wday = (jan1day == 0) ? 6 : jan1day - 1; ! dec31ly.tm_yday = 364 + isleap(dec31ly.tm_year + 1900); ! weeknum = iso8601wknum(& dec31ly); ! #endif ! } ! break; ! } ! return weeknum; } #endif *************** *** 607,615 **** weeknumber(const struct tm *timeptr, int firstweekday) #endif { ! if (firstweekday == 0) ! return (timeptr->tm_yday + 7 - timeptr->tm_wday) / 7; ! else ! return (timeptr->tm_yday + 7 - ! (timeptr->tm_wday ? (timeptr->tm_wday - 1) : 6)) / 7; } --- 702,858 ---- weeknumber(const struct tm *timeptr, int firstweekday) #endif { ! int wday = timeptr->tm_wday; ! int ret; ! ! if (firstweekday == 1) { ! if (wday == 0) /* sunday */ ! wday = 6; ! else ! wday--; ! } ! ret = ((timeptr->tm_yday + 7 - wday) / 7); ! if (ret < 0) ! ret = 0; ! return ret; ! } ! ! #if 0 ! /* ADR --- I'm loathe to mess with ado's code ... */ ! ! Date: Wed, 24 Apr 91 20:54:08 MDT ! From: Michal Jaegermann ! To: arnold@audiofax.com ! ! Hi Arnold, ! in a process of fixing of strftime() in libraries on Atari ST I grabbed ! some pieces of code from your own strftime. When doing that it came ! to mind that your weeknumber() function compiles a little bit nicer ! in the following form: ! /* ! * firstweekday is 0 if starting in Sunday, non-zero if in Monday ! */ ! { ! return (timeptr->tm_yday - timeptr->tm_wday + ! (firstweekday ? (timeptr->tm_wday ? 8 : 1) : 7)) / 7; ! } ! How nicer it depends on a compiler, of course, but always a tiny bit. ! ! Cheers, ! Michal ! ntomczak@vm.ucs.ualberta.ca ! #endif ! ! #ifdef TEST_STRFTIME ! ! /* ! * NAME: ! * tst ! * ! * SYNOPSIS: ! * tst ! * ! * DESCRIPTION: ! * "tst" is a test driver for the function "strftime". ! * ! * OPTIONS: ! * None. ! * ! * AUTHOR: ! * Karl Vogel ! * Control Data Systems, Inc. ! * vogelke@c-17igp.wpafb.af.mil ! * ! * BUGS: ! * None noticed yet. ! * ! * COMPILE: ! * cc -o tst -DTEST_STRFTIME strftime.c ! */ ! ! /* ADR: I reformatted this to my liking, and deleted some unneeded code. */ ! ! #ifndef NULL ! #include ! #endif ! #include ! #include ! ! #define MAXTIME 132 ! ! /* ! * Array of time formats. ! */ ! ! static char *array[] = ! { ! "(%%A) full weekday name, var length (Sunday..Saturday) %A", ! "(%%B) full month name, var length (January..December) %B", ! "(%%C) Century %C", ! "(%%D) date (%%m/%%d/%%y) %D", ! "(%%E) Locale extensions (ignored) %E", ! "(%%H) hour (24-hour clock, 00..23) %H", ! "(%%I) hour (12-hour clock, 01..12) %I", ! "(%%M) minute (00..59) %M", ! "(%%O) Locale extensions (ignored) %O", ! "(%%R) time, 24-hour (%%H:%%M) %R", ! "(%%S) second (00..61) %S", ! "(%%T) time, 24-hour (%%H:%%M:%%S) %T", ! "(%%U) week of year, Sunday as first day of week (00..53) %U", ! "(%%V) week of year according to ISO 8601 %V", ! "(%%W) week of year, Monday as first day of week (00..53) %W", ! "(%%X) appropriate locale time representation (%H:%M:%S) %X", ! "(%%Y) year with century (1970...) %Y", ! "(%%Z) timezone (EDT), or blank if timezone not determinable %Z", ! "(%%a) locale's abbreviated weekday name (Sun..Sat) %a", ! "(%%b) locale's abbreviated month name (Jan..Dec) %b", ! "(%%c) full date (Sat Nov 4 12:02:33 1989)%n%t%t%t %c", ! "(%%d) day of the month (01..31) %d", ! "(%%e) day of the month, blank-padded ( 1..31) %e", ! "(%%h) should be same as (%%b) %h", ! "(%%j) day of the year (001..366) %j", ! "(%%k) hour, 24-hour clock, blank pad ( 0..23) %k", ! "(%%l) hour, 12-hour clock, blank pad ( 0..12) %l", ! "(%%m) month (01..12) %m", ! "(%%p) locale's AM or PM based on 12-hour clock %p", ! "(%%r) time, 12-hour (same as %%I:%%M:%%S %%p) %r", ! "(%%u) ISO 8601: Weekday as decimal number [1 (Monday) - 7] %u", ! "(%%v) VAX date (dd-bbb-YYYY) %v", ! "(%%w) day of week (0..6, Sunday == 0) %w", ! "(%%x) appropriate locale date representation %x", ! "(%%y) last two digits of year (00..99) %y", ! (char *) NULL ! }; ! ! /* main routine. */ ! ! int ! main(argc, argv) ! int argc; ! char **argv; ! { ! long time(); ! ! char *next; ! char string[MAXTIME]; ! ! int k; ! int length; ! ! struct tm *tm; ! ! long clock; ! ! /* Call the function. */ ! ! clock = time((long *) 0); ! tm = localtime(&clock); ! ! for (k = 0; next = array[k]; k++) { ! length = strftime(string, MAXTIME, next, tm); ! printf("%s\n", string); ! } ! ! exit(0); } + #endif /* TEST_STRFTIME */ Index: nls/C/C/C/s_elmrc.m *** ../elm2.4/nls/C/C/C/s_elmrc.m Sat Oct 24 10:21:10 1992 --- nls/C/C/C/s_elmrc.m Fri Mar 11 16:18:40 1994 *************** *** 18,22 **** $ #SavedAuto 9 # Saved automatically by ELM %s\n#\n\n $ Do not change the strings ON and OFF in the following message, leave them in English as shown - $ #YesNoMeans - 10 # For yes/no settings with ?, ON means yes, OFF means no\n\n --- 18,20 ---- Index: nls/Makefile *** ../elm2.4/nls/Makefile Wed Nov 25 15:55:34 1992 --- nls/Makefile Thu Mar 10 12:21:47 1994 *************** *** 7,14 **** MSGCAT= elm2.4.cat HFILES= $(HDIR)/s_aliases.h \ $(HDIR)/s_answer.h \ - $(HDIR)/s_arepdaem.h \ - $(HDIR)/s_autoreply.h \ $(HDIR)/s_elm.h \ $(HDIR)/s_elmrc.h \ $(HDIR)/s_error.h \ --- 7,12 ---- *************** *** 21,28 **** MFILES= $(SDIR)/s_aliases.m \ $(SDIR)/s_answer.m \ - $(SDIR)/s_arepdaem.m \ - $(SDIR)/s_autoreply.m \ $(SDIR)/s_elm.m \ $(SDIR)/s_elmrc.m \ $(SDIR)/s_error.m \ --- 19,24 ---- Index: src/a_sort.c Prereq: 5.5 *** ../elm2.4/src/a_sort.c Sun Sep 26 22:14:56 1993 --- src/a_sort.c Sat Mar 12 10:32:55 1994 *************** *** 1,5 **** ! static char rcsid[] = "@(#)$Id: a_sort.c,v 5.5 1993/06/12 05:27:44 syd Exp $"; /******************************************************************************* * The Elm Mail System - $Revision: 5.5 $ $State: Exp $ --- 1,5 ---- ! static char rcsid[] = "@(#)$Id: a_sort.c,v 5.5 1993/06/12 05:27:44 syd Exp syd $"; /******************************************************************************* * The Elm Mail System - $Revision: 5.5 $ $State: Exp $ *************** *** 140,146 **** break; case TEXT_SORT: ! diff = (first->length - second->length); if ( diff < 0 ) ret = -1; else if ( diff > 0 ) ret = 1; else ret = 0; --- 140,146 ---- break; case TEXT_SORT: ! diff = (first - second); if ( diff < 0 ) ret = -1; else if ( diff > 0 ) ret = 1; else ret = 0; Index: src/alias.c Prereq: 5.37 *** ../elm2.4/src/alias.c Sun Sep 26 22:14:56 1993 --- src/alias.c Mon May 30 12:42:49 1994 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: alias.c,v 5.37 1993/08/03 19:28:39 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.37 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: alias.c,v 5.40 1994/05/30 16:42:48 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.40 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,32 ---- * ******************************************************************************* * $Log: alias.c,v $ + * Revision 5.40 1994/05/30 16:42:48 syd + * Just a minor fix to an impossible character comparison. + * From: Jukka Ukkonen + * + * Revision 5.39 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.38 1994/03/11 21:25:24 syd + * Fix Elm looping if an EOF is received. + * From: Gregory Neil Shapiro + * * Revision 5.37 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 *************** *** 1017,1022 **** --- 1030,1036 ---- resize_screen = 0; if (newLINES != LINES || newCOLUMNS != COLUMNS) { LINES = newLINES, COLUMNS = newCOLUMNS; + #undef max #define max(a,b) ((a) < (b) ? (b) : (a)) if (mini_menu) headers_per_page = max (LINES - 13, 1); *************** *** 1337,1343 **** * Return non-0 if main part of screen overwritten, else 0 */ ! char ch; int redraw=0; char *alias_prompt; --- 1351,1357 ---- * Return non-0 if main part of screen overwritten, else 0 */ ! int ch; int redraw=0; char *alias_prompt; *************** *** 1360,1365 **** --- 1374,1381 ---- while ((ch = ReadCh()) != '.') { switch(ch) { + case EOF : leave(0); + break; case '?' : display_helpfile(ALIAS_HELP); redraw++; return(redraw); *************** *** 1855,1868 **** else { sprintf(buffer, "%s %s", firstname, lastname); } ! PutLine3(LINES-1,0, catgets(elm_msg_cat, AliasesSet, AliasesAddressAs, "Messages addressed as: %s (%s)"), address, buffer); if (strlen(comment) != 0) { strcat(buffer, ", "); strcat(buffer, comment); } ! PutLine3(LINES-2,0, catgets(elm_msg_cat, AliasesSet, AliasesAddressTo, "New alias: %s is '%s'."), aliasname, buffer); CleartoEOLN(); /* --- 1871,1884 ---- else { sprintf(buffer, "%s %s", firstname, lastname); } ! PutLine2(LINES-1,0, catgets(elm_msg_cat, AliasesSet, AliasesAddressAs, "Messages addressed as: %s (%s)"), address, buffer); if (strlen(comment) != 0) { strcat(buffer, ", "); strcat(buffer, comment); } ! PutLine2(LINES-2,0, catgets(elm_msg_cat, AliasesSet, AliasesAddressTo, "New alias: %s is '%s'."), aliasname, buffer); CleartoEOLN(); /* Index: src/builtin.c Prereq: 5.2 *** ../elm2.4/src/builtin.c Sun Sep 26 22:14:57 1993 --- src/builtin.c Mon May 30 12:42:49 1994 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: builtin.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 --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: builtin.c,v 5.4 1994/05/30 16:42:48 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,30 ---- * ******************************************************************************* * $Log: builtin.c,v $ + * Revision 5.4 1994/05/30 16:42:48 syd + * Just a minor fix to an impossible character comparison. + * From: Jukka Ukkonen + * + * Revision 5.3 1994/05/15 22:55:25 syd + * 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 + * * 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 *************** *** 139,157 **** iptr++; --ilen; } ! } else if(isprint(*iptr & 0xff)) { /* isprint requires int, mask to 8 bits to prevent sign ext. */ ! *optr++ = *iptr++; /* printing character */ chars_output++; --ilen; - } else { /* non-white space control character */ - if(chars_output + 2 <= width) { - *optr++ = '^'; - *optr++ = (*iptr == '\177' ? '?' : (*iptr&0177) + 'A' - 1); - iptr++; --ilen; - chars_output += 2; - } else { /* no space on line for both chars */ - break; - } } } *optr = '\0'; --- 150,168 ---- iptr++; --ilen; } ! } else if(iscntrl(*iptr & 0xff)) { /* Non-white ctrl char */ ! if (chars_output + 2 <= width) { ! *optr++ = '^'; ! *optr++ = ctrl(*iptr); ! iptr++; --ilen; ! chars_output += 2; ! } else { ! break; ! } ! } else { /* Assume a printing char in case isprint */ ! *optr++ = *iptr++; /* macro fails on true 8-bit characters. */ chars_output++; --ilen; } } *optr = '\0'; *************** *** 178,185 **** it at this point) **/ ! char *pending, footer[SLEN], display_buffer[SLEN], ch; ! int formfeed, lines_more; int pending_len = input_size, display_len = 0; #ifdef MMDF --- 189,196 ---- it at this point) **/ ! char *pending, footer[SLEN], display_buffer[SLEN]; ! int ch, formfeed, lines_more; int pending_len = input_size, display_len = 0; #ifdef MMDF Index: src/curses.c Prereq: 5.13 *** ../elm2.4/src/curses.c Sun Sep 26 22:15:12 1993 --- src/curses.c Mon May 30 12:27:44 1994 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: curses.c,v 5.13 1993/08/23 02:56:35 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.13 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: curses.c,v 5.18 1994/05/30 16:27:44 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.18 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,46 ---- * ******************************************************************************* * $Log: curses.c,v $ + * Revision 5.18 1994/05/30 16:27:44 syd + * 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 + * + * Revision 5.17 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.16 1994/05/15 22:58:36 syd + * Tune the Ultrix fix for ispell + * From: Bill Gianopoulos + * + * Revision 5.15 1994/05/15 22:55:25 syd + * 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 + * + * Revision 5.14 1994/03/11 20:45:03 syd + * fixed ReadCh() to recover from EINTR and EAGAIN instead + * of just returning an unexpected EOF. + * From: Jukka Ukkonen + * * Revision 5.13 1993/08/23 02:56:35 syd * have Writechar() backspace over the left edge of the screen to the end * of the previous line if the current line is not the first line on the *************** *** 100,105 **** --- 127,137 ---- #include "headers.h" + #ifdef I_STDARG + # include + #else + # include + #endif #ifdef TERMIOS # include # ifndef sun *************** *** 113,118 **** --- 145,152 ---- # endif #endif + #include + #ifdef PTEM # include # include *************** *** 754,760 **** #ifdef ASCII_CTYPE if(!isascii(ch) || !isprint(ch)) #else ! if(!isprint(ch)) #endif ch = '?'; --- 788,794 ---- #ifdef ASCII_CTYPE if(!isascii(ch) || !isprint(ch)) #else ! if(!isprint(ch) && !(ch & ~0x7f)) #endif ch = '?'; *************** *** 788,798 **** /*VARARGS2*/ ! Write_to_screen(line, argcount, arg1, arg2, arg3) char *line; int argcount; ! char *arg1, *arg2, *arg3; { /** This routine writes to the screen at the current location. when done, it increments lines & columns accordingly by looking for "\n" sequences... **/ --- 822,844 ---- /*VARARGS2*/ ! #ifdef I_STDARG ! Write_to_screen(char *line, int argcount, ...) ! { ! char *arg1, *arg2, *arg3; ! va_list vl; ! va_start(vl, argcount); ! #else ! Write_to_screen(line, argcount, va_alist) char *line; int argcount; ! va_dcl { + char *arg1, *arg2, *arg3; + va_list vl; + va_start(vl); + #endif + /** This routine writes to the screen at the current location. when done, it increments lines & columns accordingly by looking for "\n" sequences... **/ *************** *** 802,813 **** --- 848,865 ---- PutLine0(_line, _col, line); break; case 1 : + arg1 = va_arg(vl, char *); PutLine1(_line, _col, line, arg1); break; case 2 : + arg1 = va_arg(vl, char *); + arg2 = va_arg(vl, char *); PutLine2(_line, _col, line, arg1, arg2); break; case 3 : + arg1 = va_arg(vl, char *); + arg2 = va_arg(vl, char *); + arg3 = va_arg(vl, char *); PutLine3(_line, _col, line, arg1, arg2, arg3); break; } *************** *** 908,913 **** --- 960,966 ---- #ifdef ultrix force_raw() { + (void) ttsetattr(TTYIN,&_original_tty); _inraw = 0; Raw(ON); } *************** *** 955,966 **** int ReadCh() { ! /** read a character with Raw mode set! **/ ! register int result; ! char ch; ! result = read(0, &ch, 1); ! return((result <= 0 ) ? EOF : ch); } outchar(c) --- 1008,1034 ---- int ReadCh() { ! /* ! * read a character with Raw mode set! ! * ! * EAGAIN & EWOULDBLOCK are recognized just in case ! * O_NONBLOCK happens to be in effect. ! */ ! ! register int result; ! unsigned char ch; ! ! while (((result = read(0, &ch, 1)) < 0) ! && ((errno == EINTR) ! #ifdef EAGAIN ! || (errno == EAGAIN) ! #endif ! #ifdef EWOULDBLOCK ! || (errno == EWOULDBLOCK) ! #endif ! )); ! return((result <= 0 ) ? EOF : ch); } outchar(c) Index: src/edit.c Prereq: 5.7 *** ../elm2.4/src/edit.c Sat May 8 16:25:36 1993 --- src/edit.c Tue Aug 30 11:07:04 1994 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: edit.c,v 5.7 1993/05/08 20:25:33 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.7 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: edit.c,v 5.10 1994/08/30 15:07:03 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,31 ---- * ******************************************************************************* * $Log: edit.c,v $ + * Revision 5.10 1994/08/30 15:07:03 syd + * Extra } in edit_mailbox removed. + * From: Jan.Djarv@sa.erisoft.se (Jan Djarv) + * + * Revision 5.9 1994/06/03 17:05:17 syd + * try and prevent copy from calling elm_chown unless needed + * From: Syd + * + * Revision 5.8 1994/05/14 18:42:57 syd + * Here are some more of fixes to correctly call fflush() and unlock() in sequence. + * From: Jukka Ukkonen + * * Revision 5.7 1993/05/08 20:25:33 syd * Add sleepmsg to control transient message delays * From: Syd *************** *** 66,93 **** #ifdef ALLOW_MAILBOX_EDITING ! static void copy_failed_emergency_exit(cur_folder, edited_file, linked) char *cur_folder, *edited_file; - int linked; { int err = errno; MoveCursor(LINES, 0); Raw(OFF); ! if (linked) ! MCprintf(catgets(elm_msg_cat, ElmSet, ElmCouldntLinkMailfile, ! "\nCouldn't link %s to mail file %s!\n"), ! edited_file, cur_folder); ! else ! MCprintf(catgets(elm_msg_cat, ElmSet, ElmCouldntCopyMailfile, ! "\nCouldn't copy %s to mail file %s!\n"), ! cur_folder, edited_file); printf(catgets(elm_msg_cat, ElmSet, ElmCheckOutMail, "\nYou'll need to check out %s for your mail.\n"), edited_file); printf("** %s. **\n", error_description(err)); unlock(); /* ciao!*/ emergency_exit(); } --- 78,102 ---- #ifdef ALLOW_MAILBOX_EDITING ! static void copy_failed_emergency_exit(cur_folder, edited_file) char *cur_folder, *edited_file; { int err = errno; MoveCursor(LINES, 0); Raw(OFF); ! MCprintf(catgets(elm_msg_cat, ElmSet, ElmCouldntCopyMailfile, ! "\nCouldn't copy %s to mail file %s!\n"), ! cur_folder, edited_file); printf(catgets(elm_msg_cat, ElmSet, ElmCheckOutMail, "\nYou'll need to check out %s for your mail.\n"), edited_file); printf("** %s. **\n", error_description(err)); + + if (mailfile) + fflush (mailfile); unlock(); /* ciao!*/ emergency_exit(); } *************** *** 130,135 **** --- 139,146 ---- if (folder_type == SPOOL) { /* uh oh... now the toughie... */ + fflush (mailfile); + if (bytes(cur_folder) != mailfile_size) { /* SIGH. We've received mail since we invoked the editor *************** *** 159,164 **** --- 170,177 ---- sprintf(buffer, catgets(elm_msg_cat, ElmSet, ElmCouldntOpenFolder, "Couldn't open %s for reading! Edit LOST!"), cur_folder); set_error(buffer); + + fflush (mailfile); unlock(); return(1); } *************** *** 168,173 **** --- 181,188 ---- mailfile_size, "edit_mailbox")); set_error(catgets(elm_msg_cat, ElmSet, ElmCouldntSeekEnd, "Couldn't seek to end of folder. Edit LOST!")); + + fflush (mailfile); unlock(); return(1); } *************** *** 176,187 **** while ((len = mail_gets(buffer, SLEN, real_folder)) != 0) if (fwrite(buffer, 1, len, temp_folder) != len) { ! copy_failed_emergency_exit(cur_folder, edited_file, FALSE); } fclose(real_folder); if (fclose(temp_folder)) { ! copy_failed_emergency_exit(cur_folder, edited_file, FALSE); } } else lock(OUTGOING); --- 191,202 ---- while ((len = mail_gets(buffer, SLEN, real_folder)) != 0) if (fwrite(buffer, 1, len, temp_folder) != len) { ! copy_failed_emergency_exit(cur_folder, edited_file); } fclose(real_folder); if (fclose(temp_folder)) { ! copy_failed_emergency_exit(cur_folder, edited_file); } } else lock(OUTGOING); *************** *** 193,209 **** /* remove real mail_file and then * link or copy the edited mailfile to real mail_file */ ! (void)unlink(cur_folder); ! ! if (link(edited_file, cur_folder) != 0) { ! if (errno == EXDEV || errno == EEXIST) { ! /* attempt to link across file systems */ ! if (copy(edited_file, cur_folder) != 0) { ! copy_failed_emergency_exit(cur_folder, edited_file, FALSE); ! } ! } else { ! copy_failed_emergency_exit(cur_folder, edited_file, TRUE); ! } } /* restore file permissions before removing lock */ --- 208,215 ---- /* remove real mail_file and then * link or copy the edited mailfile to real mail_file */ ! if (copy(edited_file, cur_folder, TRUE) != 0) { ! copy_failed_emergency_exit(cur_folder, edited_file); } /* restore file permissions before removing lock */ *************** *** 220,225 **** --- 226,232 ---- setgid(groupid); #endif + fflush (mailfile); unlock(); unlink(edited_file); /* remove the edited mailfile */ error(catgets(elm_msg_cat, ElmSet, ElmChangesIncorporated, Index: src/editmsg.c Prereq: 5.19 *** ../elm2.4/src/editmsg.c Sun Sep 26 22:15:13 1993 --- src/editmsg.c Thu Sep 1 15:42:40 1994 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: editmsg.c,v 5.19 1993/09/27 01:51:38 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.19 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: editmsg.c,v 5.21 1994/09/01 19:42:39 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.21 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,30 ---- * ******************************************************************************* * $Log: editmsg.c,v $ + * Revision 5.21 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.20 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.19 1993/09/27 01:51:38 syd * Add elm_chown to consolidate for Xenix not allowing -1 * From: Syd *************** *** 144,163 **** #include "headers.h" #include "s_elm.h" #include - #ifndef BSD - /* BSD has already included setjmp.h in headers.h */ - #include - #endif /* BSD */ - - #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 char *error_description(), *format_long(), *strip_commas(); long fsize(); --- 155,160 ---- *************** *** 823,829 **** case '<' : NewLine(); if (strlen(buffer) < 3) Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmUseSpecificCommand, ! "(You need to use a specific command here. Continue.)\n\r")); else { sprintf(buf, " > %s%s.%d 2>&1", temp_dir, temp_edit, getpid()); strcat(buffer, buf); --- 820,826 ---- case '<' : NewLine(); if (strlen(buffer) < 3) Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmUseSpecificCommand, ! "(You need to use a specific command here. Continue.)\n\r"), 0); else { sprintf(buf, " > %s%s.%d 2>&1", temp_dir, temp_edit, getpid()); strcat(buffer, buf); Index: src/elm.c Prereq: 5.16 *** ../elm2.4/src/elm.c Sun Sep 26 22:14:58 1993 --- src/elm.c Mon May 30 12:26:14 1994 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: elm.c,v 5.16 1993/09/19 23:46:00 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.16 $ $State: Exp $ * * This file and all associated files and documentation: * Copyright (c) 1988-1992 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: elm.c,v 5.21 1994/05/30 16:26:03 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.21 $ $State: Exp $ * * This file and all associated files and documentation: * Copyright (c) 1988-1992 USENET Community Trust *************** *** 15,20 **** --- 15,41 ---- * ******************************************************************************* * $Log: elm.c,v $ + * Revision 5.21 1994/05/30 16:26:03 syd + * Add protection to fflush on mailfile + * From: Syd + * + * Revision 5.20 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.19 1994/05/14 18:42:57 syd + * Here are some more of fixes to correctly call fflush() and unlock() in sequence. + * From: Jukka Ukkonen + * + * Revision 5.18 1994/03/12 15:22:43 syd + * Fix a line of debug output that is too long + * From: "C.R. Ritson" + * + * Revision 5.17 1994/03/11 21:25:24 syd + * Fix Elm looping if an EOF is received. + * From: Gregory Neil Shapiro + * * Revision 5.16 1993/09/19 23:46:00 syd * Although it doesnt solve the limit/resync problem of new * messages, allow them to be accessed anyway. *************** *** 174,179 **** --- 195,201 ---- resize_screen = 0; if (newLINES != LINES || newCOLUMNS != COLUMNS) { LINES = newLINES, COLUMNS = newCOLUMNS; + #undef max #define max(a,b) ((a) < (b) ? (b) : (a)) if (mini_menu) headers_per_page = max (LINES - 13, 1); *************** *** 189,194 **** --- 211,220 ---- #endif nufoot = 0; nucurr = 0; + + if (mailfile) + fflush (mailfile); + if ((num = bytes(cur_folder)) != mailfile_size) { dprint(2, (debugfile, "Just received %d bytes more mail (elm)\n", num - mailfile_size)); *************** *** 514,520 **** error(catgets(elm_msg_cat, ElmSet, ElmNewMailQuitCancelled, "New Mail! Quit canceled...")); fflush(stdin); ! if (folder_type == SPOOL) unlock(); } else quit(TRUE); --- 540,550 ---- error(catgets(elm_msg_cat, ElmSet, ElmNewMailQuitCancelled, "New Mail! Quit canceled...")); fflush(stdin); ! ! if (folder_type == SPOOL) { ! fflush (mailfile); ! unlock(); ! } } else quit(TRUE); *************** *** 528,534 **** if (mailfile_size != bytes(cur_folder)) { error(catgets(elm_msg_cat, ElmSet, ElmNewMailQuickQuitCancelled, "New Mail! Quick Quit canceled...")); ! if (folder_type == SPOOL) unlock(); } else quit(FALSE); --- 558,567 ---- if (mailfile_size != bytes(cur_folder)) { error(catgets(elm_msg_cat, ElmSet, ElmNewMailQuickQuitCancelled, "New Mail! Quick Quit canceled...")); ! if (folder_type == SPOOL) { ! fflush (mailfile); ! unlock(); ! } } else quit(FALSE); *************** *** 748,754 **** current_header->from, current_header->subject); ! Write_to_screen("\n\rPrimary Recipient: %s\nInternal Index Reference Number = %d\n\r", 2, current_header->to, current_header->index_number); --- 781,787 ---- current_header->from, current_header->subject); ! Write_to_screen("\n\rPrimary Recipient: %s\n\rInternal Index Reference Number = %d\n\r", 2, current_header->to, current_header->index_number); *************** *** 905,910 **** --- 938,946 ---- current = message_count; nucurr = get_page(current); break; + + case EOF : leave(0); + break; case ctrl('D') : case '^' : Index: src/file_util.c Prereq: 5.10 *** ../elm2.4/src/file_util.c Sun Sep 26 22:14:58 1993 --- src/file_util.c Fri Jun 3 13:05:32 1994 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: file_util.c,v 5.10 1993/09/27 01:51:38 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 ---- ! static char rcsid[] = "@(#)$Id: file_util.c,v 5.12 1994/06/03 17:05:17 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,27 ---- * ******************************************************************************* * $Log: file_util.c,v $ + * Revision 5.12 1994/06/03 17:05:17 syd + * try and prevent copy from calling elm_chown unless needed + * From: Syd + * + * Revision 5.11 1994/05/14 18:42:57 syd + * Here are some more of fixes to correctly call fflush() and unlock() in sequence. + * From: Jukka Ukkonen + * * Revision 5.10 1993/09/27 01:51:38 syd * Add elm_chown to consolidate for Xenix not allowing -1 * From: Syd *************** *** 122,129 **** } int ! copy(from, to) char *from, *to; { /** this routine copies a specified file to the destination specified. Non-zero return code indicates that something --- 130,138 ---- } int ! copy(from, to, isspool) char *from, *to; + int isspool; { /** this routine copies a specified file to the destination specified. Non-zero return code indicates that something *************** *** 177,183 **** perror(to); return(1); } ! (void) elm_chown( to, userid, groupid); return(0); } --- 186,193 ---- perror(to); return(1); } ! if (!isspool) ! (void) elm_chown( to, userid, groupid); return(0); } *************** *** 309,314 **** --- 319,331 ---- **/ struct stat buffer; + + /* + * Make sure there is nothing in the stdio buffer + * that is not also on the disk!!!! + */ + + fflush (fd); (void) fstat(fileno(fd), &buffer); Index: src/fileio.c Prereq: 5.14 *** ../elm2.4/src/fileio.c Sun Sep 26 22:14:58 1993 --- src/fileio.c Tue Aug 30 11:08:09 1994 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: fileio.c,v 5.14 1993/09/27 01:51:38 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.14 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: fileio.c,v 5.16 1994/08/30 15:08:09 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 5.16 $ $State: Exp $ * * Copyright (c) 1988-1992 USENET Community Trust * Copyright (c) 1986,1987 Dave Taylor *************** *** 14,19 **** --- 14,30 ---- * ******************************************************************************* * $Log: fileio.c,v $ + * Revision 5.16 1994/08/30 15:08:09 syd + * Add an fflush to detect over quota on file saves. + * From: Larry Schwimmer + * + * Revision 5.15 1994/08/30 15:06:37 syd + * 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 + * * Revision 5.14 1993/09/27 01:51:38 syd * Add elm_chown to consolidate for Xenix not allowing -1 * From: Syd *************** *** 215,220 **** --- 226,232 ---- if (in_header && front_line) { if (buf_len < 2) { in_header = 0; + bytes_seen = 0; end_header = -1; if (remail && !sender_added) { if (fprintf(dest_file, "%sSender: %s\n", prefix, username) == EOF) { *************** *** 229,234 **** --- 241,247 ---- #endif /* MMDF */ ) { in_header = 0; + bytes_seen = 0; end_header = 1; if (remail && !sender_added) { if (fprintf(dest_file, "%sSender: %s\n", prefix, username) == EOF) { *************** *** 394,399 **** --- 407,420 ---- copy_write_error_exit(); } #endif /* MMDF */ + + /* Since fprintf is buffered, its return value is only useful for + * writes which exceed the blocksize. Do a fflush to ensure that + * the message has, in fact, been written. + */ + if (fflush(dest_file) == EOF) { + copy_write_error_exit(); + } } static struct stat saved_buf;