about summary refs log tree commit diff
path: root/timezone/zic.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-04-04 20:47:29 +0000
committerUlrich Drepper <drepper@redhat.com>2005-04-04 20:47:29 +0000
commit7a50b1f6d1bd959ae5dfb5539d9cd8935eb8d926 (patch)
tree9b8a04127df288b73c3cec99474832a286acd96c /timezone/zic.c
parent91682d7038c0247ba1a52925b284fcb59756546e (diff)
downloadglibc-7a50b1f6d1bd959ae5dfb5539d9cd8935eb8d926.tar.gz
glibc-7a50b1f6d1bd959ae5dfb5539d9cd8935eb8d926.tar.xz
glibc-7a50b1f6d1bd959ae5dfb5539d9cd8935eb8d926.zip
* sunrpc/pmap_rmt.c (xdr_rmtcall_args): Use a dummy arglen instead
	of trying to encode uninitialized arglen.

2005-04-04  Ulrich Drepper  <drepper@redhat.com>

	* timezone/scheck.c: Update from tzcode2005h.
	* timezone/tzfile.h: Likewise.
	* timezone/zdump.c: Likewise.
	* timezone/zic.c: Likewise.

	* timezone/antarctica: Update from tzdata2005h.
	* timezone/asia: Likewise.
	* timezone/australasia: Likewise.
	* timezone/etcetera: Likewise.
	* timezone/europe: Likewise.
	* timezone/northamerica: Likewise.
	* timezone/southamerica: Likewise.
	* timezone/leapseconds: Likewise.
	* timezone/iso3166.tab: Likewise.
Diffstat (limited to 'timezone/zic.c')
-rw-r--r--timezone/zic.c124
1 files changed, 67 insertions, 57 deletions
diff --git a/timezone/zic.c b/timezone/zic.c
index d855475f9f..fb86fc69d2 100644
--- a/timezone/zic.c
+++ b/timezone/zic.c
@@ -1,4 +1,4 @@
-static char	elsieid[] = "@(#)zic.c	7.118";
+static char	elsieid[] = "@(#)zic.c	7.122";
 
 /*
 ** Regardless of the type of time_t, we do our work using this type.
@@ -21,7 +21,7 @@ typedef int	zic_t;
 
 /*
 ** On some ancient hosts, predicates like `isspace(C)' are defined
-** only if isascii(C) || C == EOF.  Modern hosts obey the C Standard,
+** only if isascii(C) || C == EOF. Modern hosts obey the C Standard,
 ** which says they are defined only if C == ((unsigned char) C) || C == EOF.
 ** Neither the C Standard nor Posix require that `isascii' exist.
 ** For portability, we check both ancient and modern requirements.
@@ -138,9 +138,9 @@ static void	usage P((void));
 static void	writezone P((const char * name));
 static int	yearistype P((int year, const char * type));
 
-#if !(HAVE_STRERROR - 0)
+#if !HAVE_STRERROR
 static char *	strerror P((int));
-#endif /* !(HAVE_STRERROR - 0) */
+#endif /* !HAVE_STRERROR */
 
 static int		charcnt;
 static int		errors;
@@ -380,7 +380,7 @@ char * const	ptr;
 ** Error handling.
 */
 
-#if !(HAVE_STRERROR - 0)
+#if !HAVE_STRERROR
 static char *
 strerror(errnum)
 int	errnum;
@@ -391,7 +391,7 @@ int	errnum;
 	return (errnum > 0 && errnum <= sys_nerr) ?
 		sys_errlist[errnum] : _("Unknown system error");
 }
-#endif /* !(HAVE_STRERROR - 0) */
+#endif /* !HAVE_STRERROR */
 
 static void
 eats(name, num, rname, rnum)
@@ -448,7 +448,9 @@ const char * const	string;
 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"),
+	(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,14 +474,14 @@ char *	argv[];
 #ifdef unix
 	(void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH));
 #endif /* defined unix */
-#if HAVE_GETTEXT - 0
+#if HAVE_GETTEXT
 	(void) setlocale(LC_CTYPE, "");
 	(void) setlocale(LC_MESSAGES, "");
 #ifdef TZ_DOMAINDIR
 	(void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR);
 #endif /* defined TEXTDOMAINDIR */
 	(void) textdomain(TZ_DOMAIN);
-#endif /* HAVE_GETTEXT - 0 */
+#endif /* HAVE_GETTEXT */
 	progname = argv[0];
 	for (i = 1; i < argc; ++i)
 		if (strcmp(argv[i], "--version") == 0) {
@@ -580,6 +582,11 @@ _("%s: More than one -L option specified\n"),
 	for (i = 0; i < nlinks; ++i) {
 		eat(links[i].l_filename, links[i].l_linenum);
 		dolink(links[i].l_from, links[i].l_to);
+		if (noise)
+			for (j = 0; j < nlinks; ++j)
+				if (strcmp(links[i].l_to,
+					links[j].l_from) == 0)
+						warning(_("link to link"));
 	}
 	if (lcltime != NULL) {
 		eat("command line", 1);
@@ -627,32 +634,27 @@ const char * const	tofile;
 			(void) exit(EXIT_FAILURE);
 
 		result = link(fromname, toname);
-#if (HAVE_SYMLINK - 0)
+#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 = unlink(toname);
-			if (result != 0 && errno != ENOENT) {
-				const char *e = strerror(errno);
-
-				(void) fprintf(stderr,
-					       _("%s: Can't unlink  %s: %s\n"),
-					       progname, toname, e);
-				(void) exit(EXIT_FAILURE);
-			}
-
-			result = symlink(symlinkcontents, toname);
-			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);
+					ifree(symlinkcontents);
 		}
-#endif
+#endif /* HAVE_SYMLINK */
 		if (result != 0) {
 			const char *e = strerror(errno);
 
@@ -810,7 +812,7 @@ associate P((void))
 			*/
 			eat(zp->z_filename, zp->z_linenum);
 			zp->z_stdoff = gethms(zp->z_rule, _("unruly zone"),
-					      TRUE);
+				TRUE);
 			/*
 			** Note, though, that if there's no rule,
 			** a '%s' in the format is a bad thing.
@@ -1113,7 +1115,9 @@ const int		iscont;
 			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"));
+				error(_(
+"Zone continuation line end time is not after end time of previous line"
+					));
 				return FALSE;
 		}
 	}
@@ -1146,11 +1150,11 @@ const int		nfields;
 	dayoff = 0;
 	cp = fields[LP_YEAR];
 	if (sscanf(cp, scheck(cp, "%d"), &year) != 1) {
-			/*
-			 * Leapin' Lizards!
-			 */
-			error(_("invalid leaping year"));
-			return;
+		/*
+		** Leapin' Lizards!
+		*/
+		error(_("invalid leaping year"));
+		return;
 	}
 	j = EPOCH_YEAR;
 	while (j != year) {
@@ -1217,7 +1221,9 @@ const int		nfields;
 			return;
 		}
 		if ((lp = byword(fields[LP_ROLL], leap_types)) == NULL) {
-			error(_("illegal Rolling/Stationary field on Leap line"));
+			error(_(
+				"illegal Rolling/Stationary field on Leap line"
+				));
 			return;
 		}
 		leapadd(tadd(t, tod), positive, lp->l_value, count);
@@ -1479,14 +1485,13 @@ const char * const	name;
 			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 && ((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 ||
 				attypes[toi - 1].type != attypes[fromi].type)
@@ -1532,7 +1537,8 @@ const char * const	name;
 	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)
+#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);
@@ -1751,12 +1757,13 @@ const int			zonecount;
 						continue;
 					}
 					if (*startbuf == '\0' &&
-					    startoff == oadd(zp->z_gmtoff,
-					    stdoff)) {
-						doabbr(startbuf, zp->z_format,
-							rp->r_abbrvar,
-							rp->r_stdoff != 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);
@@ -2047,7 +2054,9 @@ register char *	cp;
 			else while ((*dp = *cp++) != '"')
 				if (*dp != '\0')
 					++dp;
-				else	error(_("Odd number of quotation marks"));
+				else	error(_(
+						"Odd number of quotation marks"
+						));
 		} while (*cp != '\0' && *cp != '#' &&
 			(!isascii(*cp) || !isspace((unsigned char) *cp)));
 		if (isascii(*cp) && isspace((unsigned char) *cp))
@@ -2168,7 +2177,8 @@ register const int			wantedy;
 			}
 		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"));
+				warning(_("rule goes past start/end of month--\
+will not work with pre-2004 versions of zic"));
 		}
 	}
 	if (dayoff < 0 && !TYPE_SIGNED(zic_t))