diff options
author | markm <markm@FreeBSD.org> | 2001-12-11 23:36:25 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2001-12-11 23:36:25 +0000 |
commit | eddee66a58abde0bc8655fd69a6f00b04fda7026 (patch) | |
tree | 9d4a6d84074eedf54f20971b2fc567bd8d151ccb | |
parent | 87c4eaeeed39514ac24329e5481562c3f2725f87 (diff) | |
download | FreeBSD-src-eddee66a58abde0bc8655fd69a6f00b04fda7026.zip FreeBSD-src-eddee66a58abde0bc8655fd69a6f00b04fda7026.tar.gz |
WARNS=2 fixes, use __FBSDID(), kill register keyword.
-rw-r--r-- | usr.bin/tr/str.c | 54 | ||||
-rw-r--r-- | usr.bin/tr/tr.c | 18 |
2 files changed, 37 insertions, 35 deletions
diff --git a/usr.bin/tr/str.c b/usr.bin/tr/str.c index ff27e4a..92ced8b 100644 --- a/usr.bin/tr/str.c +++ b/usr.bin/tr/str.c @@ -31,13 +31,13 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> + +__FBSDID("$FreeBSD$"); + #ifndef lint -#if 0 -static char sccsid[] = "@(#)str.c 8.2 (Berkeley) 4/28/95"; +static const char sccsid[] = "@(#)str.c 8.2 (Berkeley) 4/28/95"; #endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ #include <sys/cdefs.h> #include <sys/types.h> @@ -61,9 +61,9 @@ static void genseq __P((STR *)); int next(s) - register STR *s; + STR *s; { - register int ch; + int ch; switch (s->state) { case EOS: @@ -111,15 +111,17 @@ next(s) return (next(s)); } return (1); + default: + return (0); } /* NOTREACHED */ } static int bracket(s) - register STR *s; + STR *s; { - register char *p; + char *p; switch (s->str[1]) { case ':': /* "[:class:]" */ @@ -149,43 +151,43 @@ bracket(s) } typedef struct { - char *name; + const char *name; int (*func) __P((int)); int *set; } CLASS; static CLASS classes[] = { #undef isalnum - { "alnum", isalnum, }, + { "alnum", isalnum, NULL }, #undef isalpha - { "alpha", isalpha, }, + { "alpha", isalpha, NULL }, #undef isblank - { "blank", isblank, }, + { "blank", isblank, NULL }, #undef iscntrl - { "cntrl", iscntrl, }, + { "cntrl", iscntrl, NULL }, #undef isdigit - { "digit", isdigit, }, + { "digit", isdigit, NULL }, #undef isgraph - { "graph", isgraph, }, + { "graph", isgraph, NULL }, #undef islower - { "lower", islower, }, + { "lower", islower, NULL }, #undef isprint - { "print", isprint, }, + { "print", isprint, NULL }, #undef ispunct - { "punct", ispunct, }, + { "punct", ispunct, NULL }, #undef isspace - { "space", isspace, }, + { "space", isspace, NULL }, #undef isupper - { "upper", isupper, }, + { "upper", isupper, NULL }, #undef isxdigit - { "xdigit", isxdigit, }, + { "xdigit", isxdigit, NULL }, }; static void genclass(s) STR *s; { - register int cnt, (*func) __P((int)); + int cnt, (*func) __P((int)); CLASS *cp, tmp; int *p; @@ -211,7 +213,7 @@ static int c_class(a, b) const void *a, *b; { - return (strcmp(((CLASS *)a)->name, ((CLASS *)b)->name)); + return (strcmp(((const CLASS *)a)->name, ((const CLASS *)b)->name)); } /* @@ -301,9 +303,9 @@ genseq(s) */ static int backslash(s) - register STR *s; + STR *s; { - register int ch, cnt, val; + int ch, cnt, val; for (cnt = val = 0;;) { ch = (u_char)*++s->str; diff --git a/usr.bin/tr/tr.c b/usr.bin/tr/tr.c index b842e6d..a7ed0c9 100644 --- a/usr.bin/tr/tr.c +++ b/usr.bin/tr/tr.c @@ -31,24 +31,24 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> + +__FBSDID("$FreeBSD$"); + #ifndef lint static const char copyright[] = "@(#) Copyright (c) 1988, 1993\n\ The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ +#endif #ifndef lint -#if 0 -static char sccsid[] = "@(#)tr.c 8.2 (Berkeley) 5/4/95"; +static const char sccsid[] = "@(#)tr.c 8.2 (Berkeley) 5/4/95"; #endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ -#include <locale.h> #include <sys/types.h> #include <err.h> +#include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -102,7 +102,7 @@ main(argc, argv) int argc; char **argv; { - register int ch, cnt, lastch, *p; + int ch, cnt, lastch, *p; int cflag, dflag, sflag, isstring2; (void) setlocale(LC_CTYPE, ""); @@ -250,7 +250,7 @@ setup(string, arg, str, cflag) STR *str; int cflag; { - register int cnt, *p; + int cnt, *p; str->str = arg; bzero(string, NCHARS * sizeof(int)); |