Re: proposed minor changes

Ken Pizzini reviewed the proposed changes sent out last week and pointed out a change I failed to note in the summary: the setlocale calls in zic.c and zdump.c have been changed to use the LC_ALL parameter rather than the LC_MESSAGES parameter. (This based on earlier electronic mail claiming that setting only LC_MESSAGES rather than LC_ALL can lead to problems.) As suggested by Paul Eggert, the "diff -b" output appears below. --ado diff -b -c old/date.c new/date.c *** old/date.c Mon Jan 31 09:20:47 2005 --- new/date.c Mon Jan 31 14:06:49 2005 *************** *** 1,6 **** #ifndef lint #ifndef NOID ! static char elsieid[] = "@(#)date.c 7.40"; /* ** Modified from the UCB version with the SCCS ID appearing below. */ --- 1,6 ---- #ifndef lint #ifndef NOID ! static char elsieid[] = "@(#)date.c 7.41"; /* ** Modified from the UCB version with the SCCS ID appearing below. */ *************** *** 664,670 **** cp = value; switch (dotp - cp) { default: ! wildinput(_("time"), value, _("main part is wrong length")); case 12: if (!dousg) { cent = ATOI2(cp); --- 664,671 ---- cp = value; switch (dotp - cp) { default: ! wildinput(_("time"), value, ! _("main part is wrong length")); case 12: if (!dousg) { cent = ATOI2(cp); diff -b -c old/private.h new/private.h *** old/private.h Mon Jan 31 09:19:08 2005 --- new/private.h Mon Jan 31 14:06:49 2005 *************** *** 91,103 **** #include "time.h" #include "stdlib.h" ! #if HAVE_GETTEXT - 0 #include "libintl.h" ! #endif /* HAVE_GETTEXT - 0 */ ! #if HAVE_SYS_WAIT_H - 0 #include <sys/wait.h> /* for WIFEXITED and WEXITSTATUS */ ! #endif /* HAVE_SYS_WAIT_H - 0 */ #ifndef WIFEXITED #define WIFEXITED(status) (((status) & 0xff) == 0) --- 91,103 ---- #include "time.h" #include "stdlib.h" ! #if HAVE_GETTEXT #include "libintl.h" ! #endif /* HAVE_GETTEXT */ ! #if HAVE_SYS_WAIT_H #include <sys/wait.h> /* for WIFEXITED and WEXITSTATUS */ ! #endif /* HAVE_SYS_WAIT_H */ #ifndef WIFEXITED #define WIFEXITED(status) (((status) & 0xff) == 0) *************** *** 106,116 **** #define WEXITSTATUS(status) (((status) >> 8) & 0xff) #endif /* !defined WEXITSTATUS */ ! #if HAVE_UNISTD_H - 0 #include "unistd.h" /* for F_OK and R_OK */ ! #endif /* HAVE_UNISTD_H - 0 */ ! #if !(HAVE_UNISTD_H - 0) #ifndef F_OK #define F_OK 0 #endif /* !defined F_OK */ --- 106,116 ---- #define WEXITSTATUS(status) (((status) >> 8) & 0xff) #endif /* !defined WEXITSTATUS */ ! #if HAVE_UNISTD_H #include "unistd.h" /* for F_OK and R_OK */ ! #endif /* HAVE_UNISTD_H */ ! #if !HAVE_UNISTD_H #ifndef F_OK #define F_OK 0 #endif /* !defined F_OK */ *************** *** 117,123 **** #ifndef R_OK #define R_OK 4 #endif /* !defined R_OK */ ! #endif /* !(HAVE_UNISTD_H - 0) */ /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */ #define is_digit(c) ((unsigned)(c) - '0' <= 9) --- 117,123 ---- #ifndef R_OK #define R_OK 4 #endif /* !defined R_OK */ ! #endif /* !HAVE_UNISTD_H */ /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */ #define is_digit(c) ((unsigned)(c) - '0' <= 9) *************** *** 216,222 **** void * irealloc P((void * pointer, int size)); void icfree P((char * pointer)); void ifree P((char * pointer)); ! char * scheck P((const char *string, const char *format)); /* ** Finally, some convenience items. --- 216,222 ---- void * irealloc P((void * pointer, int size)); void icfree P((char * pointer)); void ifree P((char * pointer)); ! char * scheck P((const char *string, char *format)); /* ** Finally, some convenience items. *************** *** 255,261 **** ** add one more for a minus sign if the type is signed. */ #define INT_STRLEN_MAXIMUM(type) \ ! ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type)) #endif /* !defined INT_STRLEN_MAXIMUM */ /* --- 255,262 ---- ** add one more for a minus sign if the type is signed. */ #define INT_STRLEN_MAXIMUM(type) \ ! ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \ ! 1 + TYPE_SIGNED(type)) #endif /* !defined INT_STRLEN_MAXIMUM */ /* *************** *** 289,299 **** */ #ifndef _ ! #if HAVE_GETTEXT - 0 #define _(msgid) gettext(msgid) ! #else /* !(HAVE_GETTEXT - 0) */ #define _(msgid) msgid ! #endif /* !(HAVE_GETTEXT - 0) */ #endif /* !defined _ */ #ifndef TZ_DOMAIN --- 290,300 ---- */ #ifndef _ ! #if HAVE_GETTEXT #define _(msgid) gettext(msgid) ! #else /* !HAVE_GETTEXT */ #define _(msgid) msgid ! #endif /* !HAVE_GETTEXT */ #endif /* !defined _ */ #ifndef TZ_DOMAIN diff -b -c old/scheck.c new/scheck.c *** old/scheck.c Mon Jan 31 09:20:47 2005 --- new/scheck.c Mon Jan 31 14:06:49 2005 *************** *** 1,6 **** #ifndef lint #ifndef NOID ! static char elsieid[] = "@(#)scheck.c 8.15"; #endif /* !defined lint */ #endif /* !defined NOID */ --- 1,6 ---- #ifndef lint #ifndef NOID ! static char elsieid[] = "@(#)scheck.c 8.16"; #endif /* !defined lint */ #endif /* !defined NOID */ *************** *** 11,17 **** char * scheck(string, format) const char * const string; ! const char * const format; { register char * fbuf; register const char * fp; --- 11,17 ---- char * scheck(string, format) const char * const string; ! char * const format; { register char * fbuf; register const char * fp; diff -b -c old/strftime.c new/strftime.c *** old/strftime.c Mon Jan 31 09:20:47 2005 --- new/strftime.c Mon Jan 31 14:06:50 2005 *************** *** 1,6 **** #ifndef lint #ifndef NOID ! static char elsieid[] = "@(#)strftime.c 7.74"; /* ** Based on the UCB version with the ID appearing below. ** This is ANSIish only when "multibyte character == plain character". --- 1,6 ---- #ifndef lint #ifndef NOID ! static char elsieid[] = "@(#)strftime.c 7.75"; /* ** Based on the UCB version with the ID appearing below. ** This is ANSIish only when "multibyte character == plain character". *************** *** 108,114 **** static char * _add P((const char *, char *, const char *)); static char * _conv P((int, const char *, char *, const char *)); ! static char * _fmt P((const char *, const struct tm *, char *, const char *, int *)); static char * _yconv P((int, int, int, int, char *, const char *)); extern char * tzname[]; --- 108,115 ---- static char * _add P((const char *, char *, const char *)); static char * _conv P((int, const char *, char *, const char *)); ! static char * _fmt P((const char *, const struct tm *, char *, const char *, ! int *)); static char * _yconv P((int, int, int, int, char *, const char *)); extern char * tzname[]; diff -b -c old/tzfile.h new/tzfile.h *** old/tzfile.h Mon Jan 31 09:19:08 2005 --- new/tzfile.h Mon Jan 31 14:06:49 2005 *************** *** 21,27 **** #ifndef lint #ifndef NOID ! static char tzfilehid[] = "@(#)tzfile.h 7.16"; #endif /* !defined NOID */ #endif /* !defined lint */ --- 21,27 ---- #ifndef lint #ifndef NOID ! static char tzfilehid[] = "@(#)tzfile.h 7.17"; #endif /* !defined NOID */ #endif /* !defined lint */ *************** *** 172,197 **** #define isleap_sum(a, b) isleap((a) % 400 + (b) % 400) - #ifndef USG - - /* - ** Use of the underscored variants may cause problems if you move your code to - ** certain System-V-based systems; for maximum portability, use the - ** underscore-free variants. The underscored variants are provided for - ** backward compatibility only; they may disappear from future versions of - ** this file. - */ - - #define SECS_PER_MIN SECSPERMIN - #define MINS_PER_HOUR MINSPERHOUR - #define HOURS_PER_DAY HOURSPERDAY - #define DAYS_PER_WEEK DAYSPERWEEK - #define DAYS_PER_NYEAR DAYSPERNYEAR - #define DAYS_PER_LYEAR DAYSPERLYEAR - #define SECS_PER_HOUR SECSPERHOUR - #define SECS_PER_DAY SECSPERDAY - #define MONS_PER_YEAR MONSPERYEAR - - #endif /* !defined USG */ - #endif /* !defined TZFILE_H */ --- 172,175 ---- diff -b -c old/zdump.c new/zdump.c *** old/zdump.c Mon Jan 31 09:20:47 2005 --- new/zdump.c Mon Jan 31 14:20:42 2005 *************** *** 1,4 **** ! static char elsieid[] = "@(#)zdump.c 7.61"; /* ** This code has been made independent of the rest of the time --- 1,4 ---- ! static char elsieid[] = "@(#)zdump.c 7.63"; /* ** This code has been made independent of the rest of the time *************** *** 215,221 **** INITIALIZE(cutlotime); INITIALIZE(cuthitime); #if HAVE_GETTEXT ! (void) setlocale(LC_MESSAGES, ""); #ifdef TZ_DOMAINDIR (void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR); #endif /* defined TEXTDOMAINDIR */ --- 215,221 ---- INITIALIZE(cutlotime); INITIALIZE(cuthitime); #if HAVE_GETTEXT ! (void) setlocale(LC_ALL, ""); #ifdef TZ_DOMAINDIR (void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR); #endif /* defined TEXTDOMAINDIR */ diff -b -c old/zic.c new/zic.c *** old/zic.c Mon Jan 31 09:20:47 2005 --- new/zic.c Mon Jan 31 14:20:42 2005 *************** *** 1,4 **** ! static char elsieid[] = "@(#)zic.c 7.120"; /* ** Regardless of the type of time_t, we do our work using this type. --- 1,4 ---- ! static char elsieid[] = "@(#)zic.c 7.122"; /* ** Regardless of the type of time_t, we do our work using this type. *************** *** 138,146 **** static void writezone P((const char * name)); static int yearistype P((int year, const char * type)); ! #if !(HAVE_STRERROR - 0) static char * strerror P((int)); ! #endif /* !(HAVE_STRERROR - 0) */ static int charcnt; static int errors; --- 138,146 ---- static void writezone P((const char * name)); static int yearistype P((int year, const char * type)); ! #if !HAVE_STRERROR static char * strerror P((int)); ! #endif /* !HAVE_STRERROR */ static int charcnt; static int errors; *************** *** 380,386 **** ** Error handling. */ ! #if !(HAVE_STRERROR - 0) static char * strerror(errnum) int errnum; --- 380,386 ---- ** Error handling. */ ! #if !HAVE_STRERROR static char * strerror(errnum) int errnum; *************** *** 391,397 **** return (errnum > 0 && errnum <= sys_nerr) ? sys_errlist[errnum] : _("Unknown system error"); } ! #endif /* !(HAVE_STRERROR - 0) */ static void eats(name, num, rname, rnum) --- 391,397 ---- return (errnum > 0 && errnum <= sys_nerr) ? sys_errlist[errnum] : _("Unknown system error"); } ! #endif /* !HAVE_STRERROR */ static void eats(name, num, rname, rnum) *************** *** 448,454 **** static void usage P((void)) { ! (void) fprintf(stderr, _("%s: usage is %s [ --version ] [ -s ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n"), progname, progname); (void) exit(EXIT_FAILURE); } --- 448,456 ---- static void usage P((void)) { ! (void) fprintf(stderr, _("%s: usage is %s \ ! [ --version ] [ -s ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\ ! \t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n"), progname, progname); (void) exit(EXIT_FAILURE); } *************** *** 472,484 **** #ifdef unix (void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH)); #endif /* defined unix */ ! #if HAVE_GETTEXT - 0 ! (void) setlocale(LC_MESSAGES, ""); #ifdef TZ_DOMAINDIR (void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR); #endif /* defined TEXTDOMAINDIR */ (void) textdomain(TZ_DOMAIN); ! #endif /* HAVE_GETTEXT - 0 */ progname = argv[0]; for (i = 1; i < argc; ++i) if (strcmp(argv[i], "--version") == 0) { --- 474,486 ---- #ifdef unix (void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH)); #endif /* defined unix */ ! #if HAVE_GETTEXT ! (void) setlocale(LC_ALL, ""); #ifdef TZ_DOMAINDIR (void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR); #endif /* defined TEXTDOMAINDIR */ (void) textdomain(TZ_DOMAIN); ! #endif /* HAVE_GETTEXT */ progname = argv[0]; for (i = 1; i < argc; ++i) if (strcmp(argv[i], "--version") == 0) { *************** *** 631,652 **** (void) exit(EXIT_FAILURE); result = link(fromname, toname); ! #if (HAVE_SYMLINK - 0) if (result != 0 && access(fromname, F_OK) == 0 && !itsdir(fromname)) { const char *s = tofile; register char * symlinkcontents = NULL; - while ((s = strchr(s+1, '/')) != NULL) - symlinkcontents = ecatalloc(symlinkcontents, "../"); - symlinkcontents = ecatalloc(symlinkcontents, fromfile); ! result = symlink(symlinkcontents, toname); if (result == 0) warning(_("hard link failed, symbolic link used")); ifree(symlinkcontents); } ! #endif if (result != 0) { const char *e = strerror(errno); --- 633,659 ---- (void) exit(EXIT_FAILURE); result = link(fromname, toname); ! #if HAVE_SYMLINK if (result != 0 && access(fromname, F_OK) == 0 && !itsdir(fromname)) { const char *s = tofile; register char * symlinkcontents = NULL; ! while ((s = strchr(s+1, '/')) != NULL) ! symlinkcontents = ! ecatalloc(symlinkcontents, ! "../"); ! symlinkcontents = ! ecatalloc(symlinkcontents, ! fromfile); ! result = symlink(symlinkcontents, ! toname); if (result == 0) warning(_("hard link failed, symbolic link used")); ifree(symlinkcontents); } ! #endif /* HAVE_SYMLINK */ if (result != 0) { const char *e = strerror(errno); *************** *** 1107,1113 **** zones[nzones - 1].z_untiltime > min_time && zones[nzones - 1].z_untiltime < max_time && zones[nzones - 1].z_untiltime >= z.z_untiltime) { ! error(_("Zone continuation line end time is not after end time of previous line")); return FALSE; } } --- 1114,1122 ---- zones[nzones - 1].z_untiltime > min_time && zones[nzones - 1].z_untiltime < max_time && zones[nzones - 1].z_untiltime >= z.z_untiltime) { ! error(_( ! "Zone continuation line end time is not after end time of previous line" ! )); return FALSE; } } *************** *** 1141,1147 **** cp = fields[LP_YEAR]; if (sscanf(cp, scheck(cp, "%d"), &year) != 1) { /* ! * Leapin' Lizards! */ error(_("invalid leaping year")); return; --- 1150,1156 ---- cp = fields[LP_YEAR]; if (sscanf(cp, scheck(cp, "%d"), &year) != 1) { /* ! ** Leapin' Lizards! */ error(_("invalid leaping year")); return; *************** *** 1211,1217 **** return; } if ((lp = byword(fields[LP_ROLL], leap_types)) == NULL) { ! error(_("illegal Rolling/Stationary field on Leap line")); return; } leapadd(tadd(t, tod), positive, lp->l_value, count); --- 1220,1228 ---- return; } if ((lp = byword(fields[LP_ROLL], leap_types)) == NULL) { ! error(_( ! "illegal Rolling/Stationary field on Leap line" ! )); return; } leapadd(tadd(t, tod), positive, lp->l_value, count); *************** *** 1473,1485 **** while (fromi < timecnt && attypes[fromi].type == 0) ++fromi; /* handled by default rule */ for ( ; fromi < timecnt; ++fromi) { ! if (toi != 0 ! && ((attypes[fromi].at ! + gmtoffs[attypes[toi - 1].type]) ! <= (attypes[toi - 1].at ! + gmtoffs[toi == 1 ? 0 : attypes[toi - 2].type]))) { ! attypes[toi - 1].type = attypes[fromi].type; continue; } if (toi == 0 || --- 1484,1495 ---- while (fromi < timecnt && attypes[fromi].type == 0) ++fromi; /* handled by default rule */ for ( ; fromi < timecnt; ++fromi) { ! if (toi != 0 && ((attypes[fromi].at + ! gmtoffs[attypes[toi - 1].type]) <= ! (attypes[toi - 1].at + gmtoffs[toi == 1 ? 0 : attypes[toi - 2].type]))) { ! attypes[toi - 1].type = ! attypes[fromi].type; continue; } if (toi == 0 || *************** *** 1526,1532 **** convert(eitol(typecnt), tzh.tzh_typecnt); convert(eitol(charcnt), tzh.tzh_charcnt); (void) strncpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic); ! #define DO(field) (void) fwrite((void *) tzh.field, (size_t) sizeof tzh.field, (size_t) 1, fp) DO(tzh_magic); DO(tzh_reserved); DO(tzh_ttisgmtcnt); --- 1536,1543 ---- convert(eitol(typecnt), tzh.tzh_typecnt); convert(eitol(charcnt), tzh.tzh_charcnt); (void) strncpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic); ! #define DO(field) (void) fwrite((void *) tzh.field, \ ! (size_t) sizeof tzh.field, (size_t) 1, fp) DO(tzh_magic); DO(tzh_reserved); DO(tzh_ttisgmtcnt); *************** *** 1746,1757 **** } if (*startbuf == '\0' && startoff == oadd(zp->z_gmtoff, ! stdoff)) { ! doabbr(startbuf, zp->z_format, rp->r_abbrvar, ! rp->r_stdoff != 0); } - } eats(zp->z_filename, zp->z_linenum, rp->r_filename, rp->r_linenum); doabbr(buf, zp->z_format, rp->r_abbrvar, --- 1757,1769 ---- } if (*startbuf == '\0' && startoff == oadd(zp->z_gmtoff, ! stdoff)) ! doabbr(startbuf, ! zp->z_format, rp->r_abbrvar, ! rp->r_stdoff != ! 0); } eats(zp->z_filename, zp->z_linenum, rp->r_filename, rp->r_linenum); doabbr(buf, zp->z_format, rp->r_abbrvar, *************** *** 2041,2047 **** else while ((*dp = *cp++) != '"') if (*dp != '\0') ++dp; ! else error(_("Odd number of quotation marks")); } while (*cp != '\0' && *cp != '#' && (!isascii(*cp) || !isspace((unsigned char) *cp))); if (isascii(*cp) && isspace((unsigned char) *cp)) --- 2053,2061 ---- else while ((*dp = *cp++) != '"') if (*dp != '\0') ++dp; ! else error(_( ! "Odd number of quotation marks" ! )); } while (*cp != '\0' && *cp != '#' && (!isascii(*cp) || !isspace((unsigned char) *cp))); if (isascii(*cp) && isspace((unsigned char) *cp)) *************** *** 2162,2168 **** } if (i < 0 || i >= len_months[isleap(y)][m]) { if (noise) ! warning(_("rule goes past start/end of month--will not work with pre-2004 versions of zic")); } } if (dayoff < 0 && !TYPE_SIGNED(zic_t)) --- 2176,2183 ---- } if (i < 0 || i >= len_months[isleap(y)][m]) { if (noise) ! warning(_("rule goes past start/end of month--\ ! will not work with pre-2004 versions of zic")); } } if (dayoff < 0 && !TYPE_SIGNED(zic_t))
participants (1)
-
Olson, Arthur David (NIH/NCI)