- Remove (void) casts - ANSIfy - Remove register keyword - Fix parameters of comparison function Obtained from: DragonFlyBSD Index: zdump.c =================================================================== --- src/usr.sbin/zic/zdump.c (revision 100) +++ src/usr.sbin/zic/zdump.c (revision 110) @@ -134,16 +134,14 @@ static void usage(void); int -main(argc, argv) -int argc; -char * argv[]; +main(int argc, char **argv) { - register int i; - register int c; - register int vflag; - register char * cutoff; - register int cutyear; - register long cuttime; + int i; + int c; + int vflag; + char * cutoff; + int cutyear; + long cuttime; char ** fakeenv; time_t now; time_t t; @@ -154,11 +152,11 @@ INITIALIZE(cuttime); #if HAVE_GETTEXT - 0 - (void) setlocale(LC_MESSAGES, ""); + setlocale(LC_MESSAGES, ""); #ifdef TZ_DOMAINDIR - (void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR); + bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR); #endif /* defined(TEXTDOMAINDIR) */ - (void) textdomain(TZ_DOMAIN); + textdomain(TZ_DOMAIN); #endif /* HAVE_GETTEXT - 0 */ for (i = 1; i < argc; ++i) if (strcmp(argv[i], "--version") == 0) { @@ -183,7 +181,7 @@ cuttime += DAYSPERNYEAR + isleap(y); cuttime *= SECSPERHOUR * HOURSPERDAY; } - (void) time(&now); + time(&now); longest = 0; for (i = optind; i < argc; ++i) if (strlen(argv[i]) > longest) @@ -191,8 +189,8 @@ for (hibit = 1; (hibit << 1) != 0; hibit <<= 1) continue; { - register int from; - register int to; + int from; + int to; for (i = 0; environ[i] != NULL; ++i) continue; @@ -204,7 +202,7 @@ errx(EXIT_FAILURE, _("malloc() failed")); to = 0; - (void) strcpy(fakeenv[to++], "TZ="); + strcpy(fakeenv[to++], "TZ="); for (from = 0; environ[from] != NULL; ++from) if (strncmp(environ[from], "TZ=", 3) != 0) fakeenv[to++] = environ[from]; @@ -214,7 +212,7 @@ for (i = optind; i < argc; ++i) { static char buf[MAX_STRING_LENGTH]; - (void) strcpy(&fakeenv[0][3], argv[i]); + strcpy(&fakeenv[0][3], argv[i]); if (!vflag) { show(argv[i], now, FALSE); continue; @@ -229,7 +227,7 @@ t += SECSPERHOUR * HOURSPERDAY; show(argv[i], t, TRUE); tm = *localtime(&t); - (void) strncpy(buf, abbr(&tm), (sizeof buf) - 1); + strncpy(buf, abbr(&tm), (sizeof buf) - 1); for ( ; ; ) { if (cutoff != NULL && t >= cuttime) break; @@ -244,7 +242,7 @@ strcmp(abbr(&newtm), buf) != 0) { newt = hunt(argv[i], t, newt); newtm = *localtime(&newt); - (void) strncpy(buf, abbr(&newtm), + strncpy(buf, abbr(&newtm), (sizeof buf) - 1); } t = newt; @@ -279,10 +277,7 @@ } static time_t -hunt(name, lot, hit) -char * name; -time_t lot; -time_t hit; +hunt(char *name, time_t lot, time_t hit) { time_t t; struct tm lotm; @@ -290,7 +285,7 @@ static char loab[MAX_STRING_LENGTH]; lotm = *localtime(&lot); - (void) strncpy(loab, abbr(&lotm), (sizeof loab) - 1); + strncpy(loab, abbr(&lotm), (sizeof loab) - 1); while ((hit - lot) >= 2) { t = lot / 2 + hit / 2; if (t <= lot) @@ -315,9 +310,7 @@ */ static long -delta(newp, oldp) -struct tm * newp; -struct tm * oldp; +delta(struct tm *newp, struct tm *oldp) { long result; int tmy; @@ -338,34 +331,30 @@ } static void -show(zone, t, v) -char * zone; -time_t t; -int v; +show(char *zone, time_t t, int v) { struct tm * tmp; - (void) printf("%-*s ", (int) longest, zone); + printf("%-*s ", (int) longest, zone); if (v) - (void) printf("%.24s UTC = ", asctime(gmtime(&t))); + printf("%.24s UTC = ", asctime(gmtime(&t))); tmp = localtime(&t); - (void) printf("%.24s", asctime(tmp)); + printf("%.24s", asctime(tmp)); if (*abbr(tmp) != '\0') - (void) printf(" %s", abbr(tmp)); + printf(" %s", abbr(tmp)); if (v) { - (void) printf(" isdst=%d", tmp->tm_isdst); + printf(" isdst=%d", tmp->tm_isdst); #ifdef TM_GMTOFF - (void) printf(" gmtoff=%ld", tmp->TM_GMTOFF); + printf(" gmtoff=%ld", tmp->TM_GMTOFF); #endif /* defined TM_GMTOFF */ } - (void) printf("\n"); + printf("\n"); } static char * -abbr(tmp) -struct tm * tmp; +abbr(struct tm *tmp) { - register char * result; + char * result; static char nada; if (tmp->tm_isdst != 0 && tmp->tm_isdst != 1) Index: scheck.c =================================================================== --- src/usr.sbin/zic/scheck.c (revision 100) +++ src/usr.sbin/zic/scheck.c (revision 110) @@ -14,15 +14,13 @@ #include "private.h" char * -scheck(string, format) -const char * const string; -const char * const format; +scheck(const char * const string, const char * const format) { - register char * fbuf; - register const char * fp; - register char * tp; - register int c; - register char * result; + char * fbuf; + const char * fp; + char * tp; + int c; + char * result; char dummy; static char nada; Index: ialloc.c =================================================================== --- src/usr.sbin/zic/ialloc.c (revision 100) +++ src/usr.sbin/zic/ialloc.c (revision 110) @@ -16,16 +16,13 @@ #define nonzero(n) (((n) == 0) ? 1 : (n)) char * -imalloc(n) -const int n; +imalloc(const int n) { return malloc((size_t) nonzero(n)); } char * -icalloc(nelem, elsize) -int nelem; -int elsize; +icalloc(int nelem, int elsize) { if (nelem == 0 || elsize == 0) nelem = elsize = 1; @@ -33,9 +30,7 @@ } void * -irealloc(pointer, size) -void * const pointer; -const int size; +irealloc(void * const pointer, const int size) { if (pointer == NULL) return imalloc(size); @@ -43,12 +38,10 @@ } char * -icatalloc(old, new) -char * const old; -const char * const new; +icatalloc(char * const old, const char *new) { - register char * result; - register int oldsize, newsize; + char * result; + int oldsize, newsize; newsize = (new == NULL) ? 0 : strlen(new); if (old == NULL) @@ -58,23 +51,21 @@ else oldsize = strlen(old); if ((result = irealloc(old, oldsize + newsize + 1)) != NULL) if (new != NULL) - (void) strcpy(result + oldsize, new); + strcpy(result + oldsize, new); return result; } char * -icpyalloc(string) -const char * const string; +icpyalloc(const char *string) { return icatalloc((char *) NULL, string); } void -ifree(p) -char * const p; +ifree(char * const p) { if (p != NULL) - (void) free(p); + free(p); } void @@ -82,5 +73,5 @@ char * const p; { if (p != NULL) - (void) free(p); + free(p); } Index: zic.c =================================================================== --- src/usr.sbin/zic/zic.c (revision 100) +++ src/usr.sbin/zic/zic.c (revision 110) @@ -349,8 +349,7 @@ */ static char * -memcheck(ptr) -char * const ptr; +memcheck(char * const ptr) { if (ptr == NULL) errx(EXIT_FAILURE, _("memory exhausted")); @@ -368,8 +367,7 @@ #if !(HAVE_STRERROR - 0) static char * -strerror(errnum) -int errnum; +strerror(int errnum) { extern char * sys_errlist[]; extern int sys_nerr; @@ -380,11 +378,8 @@ #endif /* !(HAVE_STRERROR - 0) */ static void -eats(name, num, rname, rnum) -const char * const name; -const int num; -const char * const rname; -const int rnum; +eats(const char * const name, const num, const char * const rname, + const int rnum) { filename = name; linenum = num; @@ -393,34 +388,30 @@ } static void -eat(name, num) -const char * const name; -const int num; +eat(const char * const name, const int num) { eats(name, num, (char *) NULL, -1); } static void -error(string) -const char * const string; +error(const char * const string) { /* ** Match the format of "cc" to allow sh users to ** zic ... 2>&1 | error -t "*" -v ** on BSD systems. */ - (void) fprintf(stderr, _("\"%s\", line %d: %s"), + fprintf(stderr, _("\"%s\", line %d: %s"), filename, linenum, string); if (rfilename != NULL) - (void) fprintf(stderr, _(" (rule from \"%s\", line %d)"), + fprintf(stderr, _(" (rule from \"%s\", line %d)"), rfilename, rlinenum); - (void) fprintf(stderr, "\n"); + fprintf(stderr, "\n"); ++errors; } static void -warning(string) -const char * const string; +warning(const char * const string) { char * cp; @@ -432,12 +423,12 @@ } static void -usage P((void)) +usage(void) { - (void) fprintf(stderr, "%s\n%s\n", + fprintf(stderr, "%s\n%s\n", _("usage: zic [--version] [-s] [-v] [-l localtime] [-p posixrules] [-d directory]"), _(" [-L leapseconds] [-y yearistype] [filename ... ]")); - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } static const char * psxrules; @@ -453,23 +444,21 @@ | S_IWUSR); int -main(argc, argv) -int argc; -char * argv[]; +main(int argc, char ** argv) { - register int i; - register int j; - register int c; + int i; + int j; + int c; #ifdef unix - (void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH)); + umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH)); #endif /* defined unix */ #if HAVE_GETTEXT - 0 - (void) setlocale(LC_MESSAGES, ""); + setlocale(LC_MESSAGES, ""); #ifdef TZ_DOMAINDIR - (void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR); + bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR); #endif /* defined TEXTDOMAINDIR */ - (void) textdomain(TZ_DOMAIN); + textdomain(TZ_DOMAIN); #endif /* HAVE_GETTEXT - 0 */ for (i = 1; i < argc; ++i) if (strcmp(argv[i], "--version") == 0) { @@ -506,7 +495,7 @@ if (set == NULL) { if(!errno) errx(EXIT_FAILURE, - _("invalid file mode")); +_("invalid file mode")); else err(EXIT_FAILURE, "setmode"); } @@ -562,7 +551,7 @@ for (i = optind; i < argc; ++i) infile(argv[i]); if (errors) - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); associate(); for (i = 0; i < nzones; i = j) { /* @@ -591,12 +580,10 @@ } static void -dolink(fromfile, tofile) -const char * const fromfile; -const char * const tofile; +dolink(const char * const fromfile, const char * const tofile) { - register char * fromname; - register char * toname; + char * fromname; + char * toname; if (fromfile[0] == '/') fromname = ecpyalloc(fromfile); @@ -617,12 +604,12 @@ ** there's a fair chance of root running us. */ if (!itsdir(toname)) - (void) remove(toname); + remove(toname); if (link(fromname, toname) != 0) { int result; if (mkdirs(toname) != 0) - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); result = link(fromname, toname); #if (HAVE_SYMLINK - 0) @@ -630,7 +617,7 @@ access(fromname, F_OK) == 0 && !itsdir(fromname)) { const char *s = tofile; - register char * symlinkcontents = NULL; + char * symlinkcontents = NULL; while ((s = strchr(s+1, '/')) != NULL) symlinkcontents = ecatalloc(symlinkcontents, "../"); symlinkcontents = ecatalloc(symlinkcontents, fromfile); @@ -669,7 +656,7 @@ #define TIME_T_BITS_IN_FILE ((TYPE_BIT(time_t) < MAX_BITS_IN_FILE) ? TYPE_BIT(time_t) : MAX_BITS_IN_FILE) static void -setboundaries P((void)) +setboundaries(void) { if (TYPE_SIGNED(time_t)) { min_time = ~ (time_t) 0; @@ -690,11 +677,10 @@ } static int -itsdir(name) -const char * const name; +itsdir(const char * const name) { - register char * myname; - register int accres; + char * myname; + int accres; myname = ecpyalloc(name); myname = ecatalloc(myname, "/."); @@ -712,24 +698,22 @@ */ static int -rcomp(cp1, cp2) -const void * cp1; -const void * cp2; +rcomp(const void *cp1, const void *cp2) { return strcmp(((const struct rule *) cp1)->r_name, ((const struct rule *) cp2)->r_name); } static void -associate P((void)) +associate(void) { - register struct zone * zp; - register struct rule * rp; - register int base, out; - register int i, j; + struct zone * zp; + struct rule * rp; + int base, out; + int i, j; if (nrules != 0) { - (void) qsort((void *) rules, (size_t) nrules, + qsort((void *) rules, (size_t) nrules, (size_t) sizeof *rules, rcomp); for (i = 0; i < nrules - 1; ++i) { if (strcmp(rules[i].r_name, @@ -793,20 +777,19 @@ } } if (errors) - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } static void -infile(name) -const char * name; +infile(const char *name) { - register FILE * fp; - register char ** fields; - register char * cp; - register const struct lookup * lp; - register int nfields; - register int wantcont; - register int num; + FILE * fp; + char ** fields; + char * cp; + const struct lookup * lp; + int nfields; + int wantcont; + int num; char buf[BUFSIZ]; if (strcmp(name, "-") == 0) { @@ -885,10 +868,7 @@ */ static long -gethms(string, errstring, signable) -const char * string; -const char * const errstring; -const int signable; +gethms(const char *string, const char *errstring, const int signable) { int hh, mm, ss, sign; @@ -924,9 +904,7 @@ } static void -inrule(fields, nfields) -register char ** const fields; -const int nfields; +inrule(char ** const fields, const nfields) { static struct rule r; @@ -951,11 +929,9 @@ } static int -inzone(fields, nfields) -register char ** const fields; -const int nfields; +inzone(char ** const fields, const int nfields) { - register int i; + int i; static char * buf; if (nfields < ZONE_MINFIELDS || nfields > ZONE_MAXFIELDS) { @@ -972,7 +948,7 @@ } if (strcmp(fields[ZF_NAME], TZDEFRULES) == 0 && psxrules != NULL) { buf = erealloc(buf, (int) (132 + strlen(TZDEFRULES))); - (void) sprintf(buf, + sprintf(buf, _("\"Zone %s\" line and -p option are mutually exclusive"), TZDEFRULES); error(buf); @@ -984,7 +960,7 @@ buf = erealloc(buf, (int) (132 + strlen(fields[ZF_NAME]) + strlen(zones[i].z_filename))); - (void) sprintf(buf, + sprintf(buf, _("duplicate zone name %s (file \"%s\", line %d)"), fields[ZF_NAME], zones[i].z_filename, @@ -996,9 +972,7 @@ } static int -inzcont(fields, nfields) -register char ** const fields; -const int nfields; +inzcont(char ** const fields, const int nfields) { if (nfields < ZONEC_MINFIELDS || nfields > ZONEC_MAXFIELDS) { error(_("wrong number of fields on Zone continuation line")); @@ -1008,17 +982,14 @@ } static int -inzsub(fields, nfields, iscont) -register char ** const fields; -const int nfields; -const int iscont; +inzsub(char ** const fields, const int nfields, const int iscont) { - register char * cp; + char * cp; static struct zone z; - register int i_gmtoff, i_rule, i_format; - register int i_untilyear, i_untilmonth; - register int i_untilday, i_untiltime; - register int hasuntil; + int i_gmtoff, i_rule, i_format; + int i_untilyear, i_untilmonth; + int i_untilday, i_untiltime; + int hasuntil; if (iscont) { i_gmtoff = ZFC_GMTOFF; @@ -1085,13 +1056,11 @@ } static void -inleap(fields, nfields) -register char ** const fields; -const int nfields; +inleap(char ** const fields, const int nfields) { - register const char * cp; - register const struct lookup * lp; - register int i, j; + const char * cp; + const struct lookup * lp; + int i, j; int year, month, day; long dayoff, tod; time_t t; @@ -1154,7 +1123,7 @@ tod = gethms(fields[LP_TIME], _("invalid time of day"), FALSE); cp = fields[LP_CORR]; { - register int positive; + int positive; int count; if (strcmp(cp, "") == 0) { /* infile() turns "-" into "" */ @@ -1182,9 +1151,7 @@ } static void -inlink(fields, nfields) -register char ** const fields; -const int nfields; +inlink(char ** const fields, int nfields) { struct link l; @@ -1210,19 +1177,15 @@ } static void -rulesub(rp, loyearp, hiyearp, typep, monthp, dayp, timep) -register struct rule * const rp; -const char * const loyearp; -const char * const hiyearp; -const char * const typep; -const char * const monthp; -const char * const dayp; -const char * const timep; +rulesub(struct rule * const rp, const char * const loyearp, + const char * const hiyearp, const char * const typep, + const char * const monthp, const char * const dayp, + const char * const timep) { - register const struct lookup * lp; - register const char * cp; - register char * dp; - register char * ep; + const struct lookup * lp; + const char * cp; + char * dp; + char * ep; if ((lp = byword(monthp, mon_names)) == NULL) { error(_("invalid month name")); @@ -1366,46 +1329,42 @@ } static void -convert(val, buf) -const long val; -char * const buf; +convert(const long val, char * const buf) { - register int i; - register long shift; + int i; + long shift; for (i = 0, shift = 24; i < 4; ++i, shift -= 8) buf[i] = val >> shift; } static void -puttzcode(val, fp) -const long val; -FILE * const fp; +puttzcode(const long val, FILE * const fp) { char buf[4]; convert(val, buf); - (void) fwrite((void *) buf, (size_t) sizeof buf, (size_t) 1, fp); + fwrite((void *) buf, (size_t) sizeof buf, (size_t) 1, fp); } static int -atcomp(avp, bvp) -void * avp; -void * bvp; +atcomp(const void *avp, const void *bvp) { - if (((struct attype *) avp)->at < ((struct attype *) bvp)->at) + const struct attype *ap = avp; + const struct attype *bp = bvp; + + if (ap->at < bp->at) return -1; - else if (((struct attype *) avp)->at > ((struct attype *) bvp)->at) + else if (ap->at > bp->at) return 1; else return 0; } static void -writezone(name) -const char * const name; +writezone(const char * const name) { - register FILE * fp; - register int i, j; + FILE * fp; + int i, j; static char * fullname; static struct tzhead tzh; time_t ats[TZ_MAX_TIMES]; @@ -1415,7 +1374,7 @@ ** Sort. */ if (timecnt > 1) - (void) qsort((void *) attypes, (size_t) timecnt, + qsort((void *) attypes, (size_t) timecnt, (size_t) sizeof *attypes, atcomp); /* ** Optimize. @@ -1456,7 +1415,7 @@ } fullname = erealloc(fullname, (int) (strlen(directory) + 1 + strlen(name) + 1)); - (void) sprintf(fullname, "%s/%s", directory, name); + sprintf(fullname, "%s/%s", directory, name); /* * Remove old file, if any, to snap links. @@ -1466,7 +1425,7 @@ if ((fp = fopen(fullname, "wb")) == NULL) { if (mkdirs(fullname) != 0) - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); if ((fp = fopen(fullname, "wb")) == NULL) err(EXIT_FAILURE, _("can't create %s"), fullname); } @@ -1476,7 +1435,7 @@ convert(eitol(timecnt), tzh.tzh_timecnt); convert(eitol(typecnt), tzh.tzh_typecnt); convert(eitol(charcnt), tzh.tzh_charcnt); - (void) strncpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic); + 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); @@ -1497,15 +1456,15 @@ puttzcode((long) ats[i], fp); } if (timecnt > 0) - (void) fwrite((void *) types, (size_t) sizeof types[0], + fwrite((void *) types, (size_t) sizeof types[0], (size_t) timecnt, fp); for (i = 0; i < typecnt; ++i) { puttzcode((long) gmtoffs[i], fp); - (void) putc(isdsts[i], fp); - (void) putc(abbrinds[i], fp); + putc(isdsts[i], fp); + putc(abbrinds[i], fp); } if (charcnt != 0) - (void) fwrite((void *) chars, (size_t) sizeof chars[0], + fwrite((void *) chars, (size_t) sizeof chars[0], (size_t) charcnt, fp); for (i = 0; i < leapcnt; ++i) { if (roll[i]) { @@ -1527,9 +1486,9 @@ puttzcode((long) corr[i], fp); } for (i = 0; i < typecnt; ++i) - (void) putc(ttisstds[i], fp); + putc(ttisstds[i], fp); for (i = 0; i < typecnt; ++i) - (void) putc(ttisgmts[i], fp); + putc(ttisgmts[i], fp); if (ferror(fp) || fclose(fp)) errx(EXIT_FAILURE, _("error writing %s"), fullname); if (chmod(fullname, mflag) < 0) @@ -1542,41 +1501,36 @@ } static void -doabbr(abbr, format, letters, isdst) -char * const abbr; -const char * const format; -const char * const letters; -const int isdst; +doabbr(char * const abbr, const char * const format, + const char * const letters, const int isdst) { if (strchr(format, '/') == NULL) { if (letters == NULL) - (void) strcpy(abbr, format); - else (void) sprintf(abbr, format, letters); + strcpy(abbr, format); + else sprintf(abbr, format, letters); } else if (isdst) - (void) strcpy(abbr, strchr(format, '/') + 1); + strcpy(abbr, strchr(format, '/') + 1); else { - (void) strcpy(abbr, format); + strcpy(abbr, format); *strchr(abbr, '/') = '\0'; } } static void -outzone(zpfirst, zonecount) -const struct zone * const zpfirst; -const int zonecount; +outzone(const struct zone * const zpfirst, const int zonecount) { - register const struct zone * zp; - register struct rule * rp; - register int i, j; - register int usestart, useuntil; - register time_t starttime, untiltime; - register long gmtoff; - register long stdoff; - register int year; - register long startoff; - register int startttisstd; - register int startttisgmt; - register int type; + const struct zone * zp; + struct rule * rp; + int i, j; + int usestart, useuntil; + time_t starttime, untiltime; + long gmtoff; + long stdoff; + int year; + long startoff; + int startttisstd; + int startttisgmt; + int type; char startbuf[BUFSIZ]; INITIALIZE(untiltime); @@ -1637,9 +1591,9 @@ rp->r_temp = rpytime(rp, year); } for ( ; ; ) { - register int k; - register time_t jtime, ktime; - register long offset; + int k; + time_t jtime, ktime; + long offset; char buf[BUFSIZ]; INITIALIZE(ktime); @@ -1749,9 +1703,7 @@ } static void -addtt(starttime, type) -const time_t starttime; -int type; +addtt(const time_t starttime, int type) { if (starttime <= min_time || (timecnt == 1 && attypes[0].at < min_time)) { @@ -1760,7 +1712,7 @@ ttisstds[0] = ttisstds[type]; ttisgmts[0] = ttisgmts[type]; if (abbrinds[type] != 0) - (void) strcpy(chars, &chars[abbrinds[type]]); + strcpy(chars, &chars[abbrinds[type]]); abbrinds[0] = 0; charcnt = strlen(chars) + 1; typecnt = 1; @@ -1769,7 +1721,7 @@ } if (timecnt >= TZ_MAX_TIMES) { error(_("too many transitions?!")); - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } attypes[timecnt].at = starttime; attypes[timecnt].type = type; @@ -1777,26 +1729,22 @@ } static int -addtype(gmtoff, abbr, isdst, ttisstd, ttisgmt) -const long gmtoff; -const char * const abbr; -const int isdst; -const int ttisstd; -const int ttisgmt; +addtype(const long gmtoff, const char * const abbr, const int isdst, + const int ttisstd, const int ttisgmt) { register int i, j; if (isdst != TRUE && isdst != FALSE) { error(_("internal error - addtype called with bad isdst")); - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } if (ttisstd != TRUE && ttisstd != FALSE) { error(_("internal error - addtype called with bad ttisstd")); - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } if (ttisgmt != TRUE && ttisgmt != FALSE) { error(_("internal error - addtype called with bad ttisgmt")); - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } /* ** See if there's already an entry for this zone type. @@ -1815,7 +1763,7 @@ */ if (typecnt >= TZ_MAX_TYPES) { error(_("too many local time types")); - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } gmtoffs[i] = gmtoff; isdsts[i] = isdst; @@ -1833,23 +1781,19 @@ } static void -leapadd(t, positive, rolling, count) -const time_t t; -const int positive; -const int rolling; -int count; +leapadd(const time_t t, const int positive, const int rolling, int count) { - register int i, j; + int i, j; if (leapcnt + (positive ? count : 1) > TZ_MAX_LEAPS) { error(_("too many leap seconds")); - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } for (i = 0; i < leapcnt; ++i) if (t <= trans[i]) { if (t == trans[i]) { error(_("repeated leap second moment")); - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } break; } @@ -1867,10 +1811,10 @@ } static void -adjleap P((void)) +adjleap(void) { - register int i; - register long last = 0; + int i; + long last = 0; /* ** propagate leap seconds forward @@ -1882,9 +1826,7 @@ } static int -yearistype(year, type) -const int year; -const char * const type; +yearistype(const int year, const char * const type) { static char * buf; int result; @@ -1892,7 +1834,7 @@ if (type == NULL || *type == '\0') return TRUE; buf = erealloc(buf, (int) (132 + strlen(yitcommand) + strlen(type))); - (void) sprintf(buf, "%s %d %s", yitcommand, year, type); + sprintf(buf, "%s %d %s", yitcommand, year, type); result = system(buf); if (WIFEXITED(result)) switch (WEXITSTATUS(result)) { case 0: @@ -1903,21 +1845,18 @@ error(_("wild result from command execution")); warnx(_("command was '%s', result was %d"), buf, result); for ( ; ; ) - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } static int -lowerit(a) -int a; +lowerit(int a) { a = (unsigned char) a; return (isascii(a) && isupper(a)) ? tolower(a) : a; } static int -ciequal(ap, bp) /* case-insensitive equality */ -register const char * ap; -register const char * bp; +ciequal(const char *ap, const char *bp) /* case-insensitive equality */ { while (lowerit(*ap) == lowerit(*bp++)) if (*ap++ == '\0') @@ -1926,9 +1865,7 @@ } static int -itsabbr(abbr, word) -register const char * abbr; -register const char * word; +itsabbr(const char *abbr, const char *word) { if (lowerit(*abbr) != lowerit(*word)) return FALSE; @@ -1942,12 +1879,10 @@ } static const struct lookup * -byword(word, table) -register const char * const word; -register const struct lookup * const table; +byword(const char * const word, const struct lookup * const table) { - register const struct lookup * foundlp; - register const struct lookup * lp; + const struct lookup * foundlp; + const struct lookup * lp; if (word == NULL || table == NULL) return NULL; @@ -1971,12 +1906,11 @@ } static char ** -getfields(cp) -register char * cp; +getfields(char *cp) { - register char * dp; - register char ** array; - register int nsubs; + char * dp; + char ** array; + int nsubs; if (cp == NULL) return NULL; @@ -2007,26 +1941,22 @@ } static long -oadd(t1, t2) -const long t1; -const long t2; +oadd(const long t1, const long t2) { - register long t; + long t; t = t1 + t2; if ((t2 > 0 && t <= t1) || (t2 < 0 && t >= t1)) { error(_("time overflow")); - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } return t; } static time_t -tadd(t1, t2) -const time_t t1; -const long t2; +tadd(const time_t t1, const long t2) { - register time_t t; + time_t t; if (t1 == max_time && t2 > 0) return max_time; @@ -2035,7 +1965,7 @@ t = t1 + t2; if ((t2 > 0 && t <= t1) || (t2 < 0 && t >= t1)) { error(_("time overflow")); - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } return t; } @@ -2046,13 +1976,11 @@ */ static time_t -rpytime(rp, wantedy) -register const struct rule * const rp; -register const int wantedy; +rpytime(const struct rule * const rp, const int wantedy) { - register int y, m, i; - register long dayoff; /* with a nod to Margaret O. */ - register time_t t; + int y, m, i; + long dayoff; /* with a nod to Margaret O. */ + time_t t; if (wantedy == INT_MIN) return min_time; @@ -2082,13 +2010,13 @@ --i; else { error(_("use of 2/29 in non leap-year")); - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } } --i; dayoff = oadd(dayoff, eitol(i)); if (rp->r_dycode == DC_DOWGEQ || rp->r_dycode == DC_DOWLEQ) { - register long wday; + long wday; #define LDAYSPERWEEK ((long) DAYSPERWEEK) wday = eitol(EPOCH_WDAY); @@ -2130,26 +2058,24 @@ } static void -newabbr(string) -const char * const string; +newabbr(const char * const string) { - register int i; + int i; i = strlen(string) + 1; if (charcnt + i > TZ_MAX_CHARS) { error(_("too many, or too long, time zone abbreviations")); - (void) exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } - (void) strcpy(&chars[charcnt], string); + strcpy(&chars[charcnt], string); charcnt += eitol(i); } static int -mkdirs(argname) -char * const argname; +mkdirs(char * const argname) { - register char * name; - register char * cp; + char * name; + char * cp; if (argname == NULL || *argname == '\0' || Dflag) return 0; @@ -2187,8 +2113,7 @@ } static long -eitol(i) -const int i; +eitol(const int i) { long l; @@ -2202,9 +2127,7 @@ #include static void -setgroup(flag, name) - gid_t *flag; - const char *name; +setgroup(gid_t *flag, const char *name) { struct group *gr; @@ -2227,9 +2150,7 @@ } static void -setuser(flag, name) - uid_t *flag; - const char *name; +setuser(uid_t *flag, const char *name) { struct passwd *pw; Index: Makefile =================================================================== --- src/usr.sbin/zic/Makefile (revision 100) +++ src/usr.sbin/zic/Makefile (revision 110) @@ -4,5 +4,6 @@ MAINTAINER= wollman@FreeBSD.org SUBDIR= zic zdump +WARNS?= 6 .include