]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Make 2nd para for scheck const. Update zic.c.
authorUlrich Drepper <drepper@redhat.com>
Sun, 25 May 1997 15:50:36 +0000 (15:50 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sun, 25 May 1997 15:50:36 +0000 (15:50 +0000)
time/private.h
time/scheck.c
time/zic.c

index 5a5b516d0fd473a6223fe853d3bdea0dc788fda3..e32653b76d2cda5c00efab20c300754e6eb70294 100644 (file)
@@ -182,7 +182,7 @@ char *      imalloc P((int n));
 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));
+char *  scheck P((const char *string, const char *format));
 
 
 /*
index b51f58d042742799b0fddb27e09e2f859aa4e948..52b4ff51fd9dc29207f5188afd3dee92f5291ef8 100644 (file)
@@ -11,7 +11,7 @@ static char   elsieid[] = "@(#)scheck.c       8.14";
 char *
 scheck(string, format)
 const char * const     string;
-char * const           format;
+const char * const     format;
 {
        register char *         fbuf;
        register const char *   fp;
index b9518c4649d52b3b019d82ba88f942b6fe3b5a94..c95887c9b4b945beee37829b929730b83e12aea0 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef lint
 #ifndef NOID
-static char    elsieid[] = "@(#)zic.c  7.83";
+static char    elsieid[] = "@(#)zic.c  7.87";
 #endif /* !defined NOID */
 #endif /* !defined lint */
 
@@ -141,8 +141,10 @@ static int         leapcnt;
 static int             linenum;
 static time_t          max_time;
 static int             max_year;
+static int             max_year_representable;
 static time_t          min_time;
 static int             min_year;
+static int             min_year_representable;
 static int             noise;
 static const char *    rfilename;
 static int             rlinenum;
@@ -430,7 +432,7 @@ const char * const  string;
 
        cp = ecpyalloc("warning: ");
        cp = ecatalloc(cp, string);
-       error(string);
+       error(cp);
        ifree(cp);
        --errors;
 }
@@ -649,6 +651,8 @@ setboundaries P((void))
        }
        min_year = TM_YEAR_BASE + gmtime(&min_time)->tm_year;
        max_year = TM_YEAR_BASE + gmtime(&max_time)->tm_year;
+       min_year_representable = min_year;
+       max_year_representable = max_year;
 }
 
 static int
@@ -1218,6 +1222,7 @@ const char * const                timep;
                                rp->r_todisstd = FALSE;
                                rp->r_todisgmt = FALSE;
                                *ep = '\0';
+                               break;
                        case 'g':       /* Greenwich */
                        case 'u':       /* Universal */
                        case 'z':       /* Zulu */
@@ -1249,7 +1254,11 @@ const char * const               timep;
        } else if (sscanf(cp, scheck(cp, "%d"), &rp->r_loyear) != 1) {
                error(_("invalid starting year"));
                return;
-       }
+       } else if (noise)
+               if (rp->r_loyear < min_year_representable)
+                       warning(_("starting year too low to be represented"));
+               else if (rp->r_loyear > max_year_representable)
+                       warning(_("starting year too high to be represented"));
        cp = hiyearp;
        if ((lp = byword(cp, end_years)) != NULL) switch ((int) lp->l_value) {
                case YR_MINIMUM:
@@ -1269,7 +1278,11 @@ const char * const               timep;
        } else if (sscanf(cp, scheck(cp, "%d"), &rp->r_hiyear) != 1) {
                error(_("invalid ending year"));
                return;
-       }
+       } else if (noise)
+               if (rp->r_loyear < min_year_representable)
+                       warning(_("starting year too low to be represented"));
+               else if (rp->r_loyear > max_year_representable)
+                       warning(_("starting year too high to be represented"));
        if (rp->r_loyear > rp->r_hiyear) {
                error(_("starting year greater than ending year"));
                return;