Diff for /src/usr.sbin/zic/zic.c between versions 1.3 and 1.4

version 1.3, 2004/02/29 16:55:28 version 1.4, 2004/04/23 17:39:53
Line 1093  inleap(char ** const fields, const int n Line 1093  inleap(char ** const fields, const int n
         tod = gethms(fields[LP_TIME], _("invalid time of day"), FALSE);          tod = gethms(fields[LP_TIME], _("invalid time of day"), FALSE);
         cp = fields[LP_CORR];          cp = fields[LP_CORR];
         {          {
                 register int    positive;                  int positive;
                 int             count;                  int count;
   
                 if (strcmp(cp, "") == 0) { /* infile() turns "-" into "" */                  if (strcmp(cp, "") == 0) { /* infile() turns "-" into "" */
                         positive = FALSE;                          positive = FALSE;
Line 1562  outzone(const struct zone * const zpfirs Line 1562  outzone(const struct zone * const zpfirs
                                         rp->r_temp = rpytime(rp, year);                                          rp->r_temp = rpytime(rp, year);
                         }                          }
                         for ( ; ; ) {                          for ( ; ; ) {
                                 register int    k;                                  int k;
                                 register time_t jtime, ktime;                                  time_t jtime, ktime;
                                 register long   offset;                                  long offset;
                                 char            buf[BUFSIZ];                                  char buf[BUFSIZ];
   
                                 INITIALIZE(ktime);                                  INITIALIZE(ktime);
                                 if (useuntil) {                                  if (useuntil) {
Line 1825  lowerit(int a) Line 1825  lowerit(int a)
 }  }
   
 static int  static int
 ciequal(ap, bp)         /* case-insensitive equality */  ciequal(const char *ap, const char *bp) /* case-insensitive equality */
 register const char *   ap;  
 register const char *   bp;  
 {  {
         while (lowerit(*ap) == lowerit(*bp++))          while (lowerit(*ap) == lowerit(*bp++))
                 if (*ap++ == '\0')                  if (*ap++ == '\0')
Line 1836  register const char * bp; Line 1834  register const char * bp;
 }  }
   
 static int  static int
 itsabbr(abbr, word)  itsabbr(const char *abbr, const char *word)
 register const char *   abbr;  
 register const char *   word;  
 {  {
         if (lowerit(*abbr) != lowerit(*word))          if (lowerit(*abbr) != lowerit(*word))
                 return FALSE;                  return FALSE;
Line 1852  register const char * word; Line 1848  register const char * word;
 }  }
   
 static const struct lookup *  static const struct lookup *
 byword(word, table)  byword(const char * const word, const struct lookup * const table)
 register const char * const             word;  
 register const struct lookup * const    table;  
 {  {
         register const struct lookup *  foundlp;          const struct lookup *foundlp;
         register const struct lookup *  lp;          const struct lookup *lp;
   
         if (word == NULL || table == NULL)          if (word == NULL || table == NULL)
                 return NULL;                  return NULL;
Line 1881  register const struct lookup * const tab Line 1875  register const struct lookup * const tab
 }  }
   
 static char **  static char **
 getfields(cp)  getfields(char *cp)
 register char * cp;  
 {  {
         register char *         dp;          char *dp;
         register char **        array;          char **array;
         register int            nsubs;          int nsubs;
   
         if (cp == NULL)          if (cp == NULL)
                 return NULL;                  return NULL;
Line 1917  register char * cp; Line 1910  register char * cp;
 }  }
   
 static long  static long
 oadd(t1, t2)  oadd(const long t1, const long t2)
 const long      t1;  
 const long      t2;  
 {  {
         register long   t;          long t;
   
         t = t1 + t2;          t = t1 + t2;
         if ((t2 > 0 && t <= t1) || (t2 < 0 && t >= t1)) {          if ((t2 > 0 && t <= t1) || (t2 < 0 && t >= t1)) {
Line 1932  const long t2; Line 1923  const long t2;
 }  }
   
 static time_t  static time_t
 tadd(t1, t2)  tadd(const time_t t1, const long t2)
 const time_t    t1;  
 const long      t2;  
 {  {
         register time_t t;          time_t t;
   
         if (t1 == max_time && t2 > 0)          if (t1 == max_time && t2 > 0)
                 return max_time;                  return max_time;
Line 1956  const long t2; Line 1945  const long t2;
 */  */
   
 static time_t  static time_t
 rpytime(rp, wantedy)  rpytime(const struct rule * const rp, const int wantedy)
 register const struct rule * const      rp;  {
 register const int                      wantedy;          int y, m, i;
 {          long dayoff;                    /* with a nod to Margaret O. */
         register int    y, m, i;          time_t t;
         register long   dayoff;                 /* with a nod to Margaret O. */  
         register time_t t;  
   
         if (wantedy == INT_MIN)          if (wantedy == INT_MIN)
                 return min_time;                  return min_time;
Line 1998  register const int   wantedy; Line 1985  register const int   wantedy;
         --i;          --i;
         dayoff = oadd(dayoff, eitol(i));          dayoff = oadd(dayoff, eitol(i));
         if (rp->r_dycode == DC_DOWGEQ || rp->r_dycode == DC_DOWLEQ) {          if (rp->r_dycode == DC_DOWGEQ || rp->r_dycode == DC_DOWLEQ) {
                 register long   wday;                  long wday;
   
 #define LDAYSPERWEEK    ((long) DAYSPERWEEK)  #define LDAYSPERWEEK    ((long) DAYSPERWEEK)
                 wday = eitol(EPOCH_WDAY);                  wday = eitol(EPOCH_WDAY);
Line 2041  register const int   wantedy; Line 2028  register const int   wantedy;
 }  }
   
 static void  static void
 newabbr(string)  newabbr(const char * const string)
 const char * const      string;  
 {  {
         register int    i;          int i;
   
         i = strlen(string) + 1;          i = strlen(string) + 1;
         if (charcnt + i > TZ_MAX_CHARS) {          if (charcnt + i > TZ_MAX_CHARS) {
Line 2056  const char * const string; Line 2042  const char * const string;
 }  }
   
 static int  static int
 mkdirs(argname)  mkdirs(char * const argname)
 char * const    argname;  
 {  {
         register char * name;          char *name;
         register char * cp;          char *cp;
   
         if (argname == NULL || *argname == '\0' || Dflag)          if (argname == NULL || *argname == '\0' || Dflag)
                 return 0;                  return 0;
Line 2100  char * const argname; Line 2085  char * const argname;
 }  }
   
 static long  static long
 eitol(i)  eitol(const int i)
 const int       i;  
 {  {
         long    l;          long    l;
   
Line 2115  const int i; Line 2099  const int i;
 #include <pwd.h>  #include <pwd.h>
   
 static void  static void
 setgroup(flag, name)  setgroup(gid_t *flag, const char *name)
         gid_t *flag;  
         const char *name;  
 {  {
         struct group *gr;          struct group *gr;
   
Line 2140  setgroup(flag, name) Line 2122  setgroup(flag, name)
 }  }
   
 static void  static void
 setuser(flag, name)  setuser(uid_t *flag, const char *name)
         uid_t *flag;  
         const char *name;  
 {  {
         struct passwd *pw;          struct passwd *pw;
   

Removed from v.1.3  
changed lines
  Added in v.1.4