From e74bf75f1c5e3e175b267220dd49a488202c13d3 Mon Sep 17 00:00:00 2001 From: Mark Murray Date: Wed, 12 Dec 2001 23:20:16 +0000 Subject: [PATCH] WARNS=2 partial fix; use NO_WERROR to protect against some hard-to-fix warnings. Use __FBSDID(), kill register keyword. --- usr.bin/sed/Makefile | 4 +++- usr.bin/sed/compile.c | 36 ++++++++++++++++++------------------ usr.bin/sed/extern.h | 2 +- usr.bin/sed/main.c | 13 ++++++------- usr.bin/sed/misc.c | 9 ++++----- usr.bin/sed/process.c | 21 ++++++++++----------- 6 files changed, 42 insertions(+), 43 deletions(-) diff --git a/usr.bin/sed/Makefile b/usr.bin/sed/Makefile index d6b13a26e44f..8dc1e0c25e06 100644 --- a/usr.bin/sed/Makefile +++ b/usr.bin/sed/Makefile @@ -1,7 +1,9 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 +# $FreeBSD$ PROG= sed -CFLAGS+=-Wall SRCS= compile.c main.c misc.c process.c +NO_WERROR=yes + .include diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c index af281ae3ca7d..f88e2b41d6f3 100644 --- a/usr.bin/sed/compile.c +++ b/usr.bin/sed/compile.c @@ -35,13 +35,12 @@ * SUCH DAMAGE. */ +#include +__FBSDID("$FreeBSD$"); + #ifndef lint -#if 0 -static char sccsid[] = "@(#)compile.c 8.1 (Berkeley) 6/6/93"; +static const char sccsid[] = "@(#)compile.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ #include #include @@ -77,7 +76,7 @@ static char *compile_text __P((void)); static char *compile_tr __P((char *, char **)); static struct s_command **compile_stream __P((struct s_command **)); -static char *duptoeol __P((char *, char *)); +static char *duptoeol __P((char *, const char *)); static void enterlabel __P((struct s_command *)); static struct s_command *findlabel __P((char *)); @@ -157,7 +156,7 @@ static struct s_command ** compile_stream(link) struct s_command **link; { - register char *p; + char *p; static char lbuf[_POSIX2_LINE_MAX + 1]; /* To save stack */ struct s_command *cmd, *cmd2, *stack; struct s_format *fp; @@ -465,7 +464,8 @@ compile_subst(p, s) struct s_subst *s; { static char lbuf[_POSIX2_LINE_MAX + 1]; - int asize, ref, size; + int asize, size; + u_char ref; char c, *text, *op, *sp; int more = 0; @@ -722,8 +722,8 @@ compile_addr(p, a) */ static char * duptoeol(s, ctype) - register char *s; - char *ctype; + char *s; + const char *ctype; { size_t len; int ws; @@ -784,9 +784,9 @@ static void enterlabel(cp) struct s_command *cp; { - register struct labhash **lhp, *lh; - register u_char *p; - register u_int h, c; + struct labhash **lhp, *lh; + u_char *p; + u_int h, c; for (h = 0, p = (u_char *)cp->t; (c = *p) != 0; p++) h = (h << 5) + h + c; @@ -811,9 +811,9 @@ static struct s_command * findlabel(name) char *name; { - register struct labhash *lh; - register u_char *p; - register u_int h, c; + struct labhash *lh; + u_char *p; + u_int h, c; for (h = 0, p = (u_char *)name; (c = *p) != 0; p++) h = (h << 5) + h + c; @@ -833,8 +833,8 @@ findlabel(name) static void uselabel() { - register struct labhash *lh, *next; - register int i; + struct labhash *lh, *next; + int i; for (i = 0; i < LHSZ; i++) { for (lh = labels[i]; lh != NULL; lh = next) { diff --git a/usr.bin/sed/extern.h b/usr.bin/sed/extern.h index 0a88e97ec45a..0d13631ff755 100644 --- a/usr.bin/sed/extern.h +++ b/usr.bin/sed/extern.h @@ -46,7 +46,7 @@ extern u_long linenum; extern int appendnum; extern int lastline; extern int aflag, eflag, nflag; -extern char *fname; +extern const char *fname; extern int rflags; /* regex flags to use */ void cfclose __P((struct s_command *, struct s_command *)); diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c index 2811ca641f80..5ba910c1f0cf 100644 --- a/usr.bin/sed/main.c +++ b/usr.bin/sed/main.c @@ -35,19 +35,18 @@ * SUCH DAMAGE. */ +#include +__FBSDID("$FreeBSD$"); + #ifndef lint static const char copyright[] = "@(#) Copyright (c) 1992, 1993\n\ The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ +#endif #ifndef lint -#if 0 -static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/3/94"; +static const char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/3/94"; #endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ #include @@ -101,7 +100,7 @@ int rflags = 0; * Current file and line number; line numbers restart across compilation * units, but span across input files. */ -char *fname; /* File name. */ +const char *fname; /* File name. */ u_long linenum; int lastline; /* TRUE on the last line of the last file */ diff --git a/usr.bin/sed/misc.c b/usr.bin/sed/misc.c index d5ad374e7618..dbe7b5d68e0e 100644 --- a/usr.bin/sed/misc.c +++ b/usr.bin/sed/misc.c @@ -35,13 +35,12 @@ * SUCH DAMAGE. */ +#include +__FBSDID("$FreeBSD$"); + #ifndef lint -#if 0 -static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93"; +static const char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ #include diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c index baad0f1b705f..dd8646fce439 100644 --- a/usr.bin/sed/process.c +++ b/usr.bin/sed/process.c @@ -35,13 +35,12 @@ * SUCH DAMAGE. */ +#include +__FBSDID("$FreeBSD$"); + #ifndef lint -#if 0 -static char sccsid[] = "@(#)process.c 8.6 (Berkeley) 4/20/94"; +static const char sccsid[] = "@(#)process.c 8.6 (Berkeley) 4/20/94"; #endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ #include #include @@ -459,10 +458,10 @@ flush_appends() static void lputs(s) - register char *s; + char *s; { - register int count; - register char *escapes, *p; + int count; + char *escapes, *p; struct winsize win; static int termwidth = -1; @@ -544,8 +543,8 @@ regsub(sp, string, src) SPACE *sp; char *string, *src; { - register int len, no; - register char c, *dst; + int len, no; + char c, *dst; #define NEEDSP(reqlen) \ if (sp->len >= sp->blen - (reqlen) - 1) { \ @@ -618,7 +617,7 @@ cspace(sp, p, len, spflag) */ void cfclose(cp, end) - register struct s_command *cp, *end; + struct s_command *cp, *end; { for (; cp != end; cp = cp->next)