diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2014-10-27 16:06:51 +0800 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2020-03-28 21:42:54 +0000 |
commit | e9dff9389660fcfca586051edc7aba890f74882e (patch) | |
tree | dab8308c3857c69e2c673cc36b38f0fdb8eb530f | |
parent | bdfdde71b9ec8f4678f498445d38f5361bb08138 (diff) | |
download | klibc-e9dff9389660fcfca586051edc7aba890f74882e.tar.gz |
[klibc] dash: [BUILTIN] Use error instead of warnx for fatal errors in printf
[ dash commit bc8321eabffa23293d16d6758034203a8c7bffda ]
This patch replaces uses of warnx where we abort with error since
the effect is the same. The exit status however changes from 1 to
2. Non-fatal errors where we continue are unchanged.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | usr/dash/bltin/printf.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/usr/dash/bltin/printf.c b/usr/dash/bltin/printf.c index b439a3bb26997..72f89883f8ff8 100644 --- a/usr/dash/bltin/printf.c +++ b/usr/dash/bltin/printf.c @@ -134,10 +134,8 @@ int printfcmd(int argc, char *argv[]) argv = argptr; format = *argv; - if (!format) { - warnx("usage: printf format [arg ...]"); - goto err; - } + if (!format) + error("usage: printf format [arg ...]"); gargv = ++argv; @@ -192,10 +190,8 @@ pc: fmt += strspn(fmt, SKIP2); ch = *fmt; - if (!ch) { - warnx("missing format character"); - goto err; - } + if (!ch) + error("missing format character"); /* null terminate format string to we can use it as an argument to printf. */ nextch = fmt[1]; @@ -250,8 +246,7 @@ pc: } #endif default: - warnx("%s: invalid directive", start); - goto err; + error("%s: invalid directive", start); } *++fmt = nextch; } @@ -259,8 +254,6 @@ pc: out: return rval; -err: - return 1; } |