From f4ac32def255b5968bdd8150057b9c0d14595689 Mon Sep 17 00:00:00 2001 From: David Malone Date: Wed, 4 Sep 2002 23:29:10 +0000 Subject: ANSIify function definitions. Add some constness to avoid some warnings. Remove use register keyword. Deal with missing/unneeded extern/prototypes. Some minor type changes/casts to avoid warnings. Reviewed by: md5 --- usr.bin/printf/printf.c | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) (limited to 'usr.bin/printf') diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c index a63d6cd21efe..cc32e4f7c371 100644 --- a/usr.bin/printf/printf.c +++ b/usr.bin/printf/printf.c @@ -103,12 +103,10 @@ static char **gargv; int #ifdef BUILTIN -progprintf(argc, argv) +progprintf(int argc, char *argv[]) #else -main(argc, argv) +main(int argc, char *argv[]) #endif - int argc; - char *argv[]; { static const char *skip1, *skip2; int ch, chopped, end, fieldwidth, haveprec, havewidth, precision, rval; @@ -292,9 +290,7 @@ next: for (start = fmt;; ++fmt) { } static char * -mkquad(str, ch) - char *str; - int ch; +mkquad(char *str, int ch) { static char *copy; static size_t copy_size; @@ -325,12 +321,10 @@ mkquad(str, ch) } static int -escape(fmt, percent) - register char *fmt; - int percent; +escape(char *fmt, int percent) { - register char *store; - register int value, c; + char *store; + int value, c; for (store = fmt; (c = *fmt); ++fmt, ++store) { if (c != '\\') { @@ -395,7 +389,7 @@ escape(fmt, percent) } static int -getchr() +getchr(void) { if (!*gargv) return ('\0'); @@ -403,7 +397,7 @@ getchr() } static const char * -getstr() +getstr(void) { if (!*gargv) return (""); @@ -411,8 +405,7 @@ getstr() } static int -getint(ip) - int *ip; +getint(int *ip) { quad_t val; u_quad_t uval; @@ -430,10 +423,7 @@ getint(ip) } static int -getquads(qp, uqp, signedconv) - quad_t *qp; - u_quad_t *uqp; - int signedconv; +getquads(quad_t *qp, u_quad_t *uqp, int signedconv) { char *ep; int rval; @@ -472,8 +462,7 @@ getquads(qp, uqp, signedconv) } static int -getdouble(dp) - double *dp; +getdouble(double *dp) { char *ep; int rval; @@ -503,9 +492,9 @@ getdouble(dp) } static int -asciicode() +asciicode(void) { - register int ch; + int ch; ch = **gargv; if (ch == '\'' || ch == '"') @@ -515,7 +504,7 @@ asciicode() } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: printf format [arg ...]\n"); } -- cgit v1.2.3