aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/printf/printf.c
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2018-08-07 23:03:50 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2018-08-07 23:03:50 +0000
commite21ce9d742cd5ba8441f80463b850d3196a986a1 (patch)
tree2d4b5f503ac0e70e1ffa695f0410b33251680116 /usr.bin/printf/printf.c
parent09a7189fb7236d0b9008427aae6a2f19c6259cac (diff)
Notes
Diffstat (limited to 'usr.bin/printf/printf.c')
-rw-r--r--usr.bin/printf/printf.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c
index 8482bb391b87..024c3f0df0be 100644
--- a/usr.bin/printf/printf.c
+++ b/usr.bin/printf/printf.c
@@ -1,6 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
+ * Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
* Copyright 2014 Garrett D'Amore <garrett@damore.org>
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 1989, 1993
@@ -375,16 +376,19 @@ printf_doformat(char *fmt, int *rval)
char *p;
int getout;
- p = strdup(getstr());
- if (p == NULL) {
+ /* Convert "b" to "s" for output. */
+ start[strlen(start) - 1] = 's';
+ if ((p = strdup(getstr())) == NULL) {
warnx("%s", strerror(ENOMEM));
return (NULL);
}
getout = escape(p, 0, &len);
- fputs(p, stdout);
+ PF(start, p);
+ /* Restore format for next loop. */
+
free(p);
if (getout)
- return (end_fmt);
+ exit(*rval);
break;
}
case 'c': {