diff options
author | Bruce Evans <bde@FreeBSD.org> | 1998-12-07 12:14:04 +0000 |
---|---|---|
committer | Bruce Evans <bde@FreeBSD.org> | 1998-12-07 12:14:04 +0000 |
commit | 3b53d3803e4824def99638e370f15ecbb8b2dde1 (patch) | |
tree | f1cbf1e20ffa3ec72c1554ae5e39597adc473708 /usr.bin | |
parent | 0fe8d9f3dd171c9b8184bb4c42c18cb1252d227c (diff) | |
download | src-3b53d3803e4824def99638e370f15ecbb8b2dde1.tar.gz src-3b53d3803e4824def99638e370f15ecbb8b2dde1.zip |
Fixed warnx format errors in printf and csh, and snprintf format errors
in sh, by using separate macros for the 1, 2 and 3-arg calls to warnx.
(The 3-arg warnx macro in sh/bltin/bltin.h used to require bogus dummy
args.)
Notes
Notes:
svn path=/head/; revision=41582
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/printf/printf.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c index 25acd157bacb..4c787834f636 100644 --- a/usr.bin/printf/printf.c +++ b/usr.bin/printf/printf.c @@ -56,6 +56,10 @@ static char const sccsid[] = "@(#)printf.c 8.1 (Berkeley) 7/20/93"; #ifdef SHELL #define main printfcmd #include "bltin/bltin.h" +#else +#define warnx1(a, b, c) warnx(a) +#define warnx2(a, b, c) warnx(a, b) +#define warnx3(a, b, c) warnx(a, b, c) #endif #define PF(f, func) { \ @@ -136,7 +140,7 @@ next: for (start = fmt;; ++fmt) { if (!*fmt) { /* avoid infinite loop */ if (end == 1) { - warnx("missing format character", + warnx1("missing format character", NULL, NULL); return (1); } @@ -186,7 +190,7 @@ next: for (start = fmt;; ++fmt) { } else precision = 0; if (!*fmt) { - warnx("missing format character", NULL, NULL); + warnx1("missing format character", NULL, NULL); return (1); } @@ -227,7 +231,7 @@ next: for (start = fmt;; ++fmt) { break; } default: - warnx("illegal format character %c", convch, NULL); + warnx2("illegal format character %c", convch, NULL); return (1); } *fmt = nextch; @@ -338,7 +342,7 @@ getint(ip) if (getlong(&val)) return (1); if (val > INT_MAX) { - warnx("%s: %s", *gargv, strerror(ERANGE)); + warnx3("%s: %s", *gargv, strerror(ERANGE)); return (1); } *ip = val; @@ -360,16 +364,16 @@ getlong(lp) errno = 0; val = strtol(*gargv, &ep, 0); if (*ep != '\0') { - warnx("%s: illegal number", *gargv, NULL); + warnx2("%s: illegal number", *gargv, NULL); return (1); } if (errno == ERANGE) if (val == LONG_MAX) { - warnx("%s: %s", *gargv, strerror(ERANGE)); + warnx3("%s: %s", *gargv, strerror(ERANGE)); return (1); } if (val == LONG_MIN) { - warnx("%s: %s", *gargv, strerror(ERANGE)); + warnx3("%s: %s", *gargv, strerror(ERANGE)); return (1); } |