diff options
author | Mark Murray <markm@FreeBSD.org> | 2002-06-21 10:14:57 +0000 |
---|---|---|
committer | Mark Murray <markm@FreeBSD.org> | 2002-06-21 10:14:57 +0000 |
commit | e0761ab1e68a5305a2ad50532d7a90b9e92d7447 (patch) | |
tree | 342df25149a7f051a1f6c39089bc49f8be0ff27d /usr.bin/pr/egetopt.c | |
parent | 36ffadc954d82f847b9ef610317d80ed20a8eb6b (diff) | |
download | src-e0761ab1e68a5305a2ad50532d7a90b9e92d7447.tar.gz src-e0761ab1e68a5305a2ad50532d7a90b9e92d7447.zip |
Modernise this code by rounding up the usual suspects: register keyword,
consts, ANSIfication of functions, proper use of __FBSDID() and so on.
This commit is non-functional from a code-execution perspective, but
pr(1) now compiles WARNS=6 clean.
Notes
Notes:
svn path=/head/; revision=98552
Diffstat (limited to 'usr.bin/pr/egetopt.c')
-rw-r--r-- | usr.bin/pr/egetopt.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/usr.bin/pr/egetopt.c b/usr.bin/pr/egetopt.c index dd5bbbd7c905..47dd8a1c47c6 100644 --- a/usr.bin/pr/egetopt.c +++ b/usr.bin/pr/egetopt.c @@ -35,9 +35,14 @@ * SUCH DAMAGE. */ +#if 0 #ifndef lint static char sccsid[] = "@(#)egetopt.c 8.1 (Berkeley) 6/6/93"; #endif /* not lint */ +#endif + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); #include <ctype.h> #include <stdio.h> @@ -64,18 +69,16 @@ int eoptopt; /* character checked for validity */ char *eoptarg; /* argument associated with option */ #define BADCH (int)'?' -#define EMSG "" + +static char emsg[] = ""; int -egetopt(nargc, nargv, ostr) - int nargc; - char * const *nargv; - const char *ostr; +egetopt(int nargc, char * const *nargv, const char *ostr) { - static char *place = EMSG; /* option letter processing */ - register char *oli; /* option letter list index */ + static char *place = emsg; /* option letter processing */ + char *oli; /* option letter list index */ static int delim; /* which option delimeter */ - register char *p; + char *p; static char savec = '\0'; if (savec != '\0') { @@ -89,7 +92,7 @@ egetopt(nargc, nargv, ostr) */ if ((eoptind >= nargc) || ((*(place = nargv[eoptind]) != '-') && (*place != '+'))) { - place = EMSG; + place = emsg; return (EOF); } @@ -99,7 +102,7 @@ egetopt(nargc, nargv, ostr) * found "--" */ ++eoptind; - place = EMSG; + place = emsg; return (EOF); } } @@ -128,7 +131,7 @@ egetopt(nargc, nargv, ostr) eoptarg = place-1; if (*p == '\0') { - place = EMSG; + place = emsg; ++eoptind; } else { place = p; @@ -192,7 +195,7 @@ egetopt(nargc, nargv, ostr) /* * no arg, but IS required */ - place = EMSG; + place = emsg; if (eopterr) { if (!(p = strrchr(*nargv, '/'))) p = *nargv; @@ -209,7 +212,7 @@ egetopt(nargc, nargv, ostr) */ eoptarg = nargv[eoptind]; } - place = EMSG; + place = emsg; ++eoptind; return (eoptopt); } |