summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/vfprintf.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2005-12-19 19:39:25 +0000
committermillert <millert@openbsd.org>2005-12-19 19:39:25 +0000
commitce2cbcd92a85adaeae5ffca2a22b5b8292b224b5 (patch)
tree18f6a65b72c54efff147f73400202a378acfbbb4 /lib/libc/stdio/vfprintf.c
parentFirst attempt to have a table of known I2C slave devices that we (diff)
downloadwireguard-openbsd-ce2cbcd92a85adaeae5ffca2a22b5b8292b224b5.tar.xz
wireguard-openbsd-ce2cbcd92a85adaeae5ffca2a22b5b8292b224b5.zip
Add %hhd to *printf and *scanf as well as %z to *scanf. This was
sent out and approved about 6 months ago and has been rotting in my tree ever since.
Diffstat (limited to 'lib/libc/stdio/vfprintf.c')
-rw-r--r--lib/libc/stdio/vfprintf.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c
index 2b5314856db..b22dea8f0e7 100644
--- a/lib/libc/stdio/vfprintf.c
+++ b/lib/libc/stdio/vfprintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfprintf.c,v 1.33 2005/09/23 02:33:34 tedu Exp $ */
+/* $OpenBSD: vfprintf.c,v 1.34 2005/12/19 19:39:25 millert Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -246,6 +246,7 @@ vfprintf(FILE *fp, const char *fmt0, _BSD_VA_LIST_ ap)
flags&PTRINT ? GETARG(ptrdiff_t) : \
flags&SIZEINT ? GETARG(ssize_t) : \
flags&SHORTINT ? (long)(short)GETARG(int) : \
+ flags&CHARINT ? (long)(__signed char)GETARG(int) : \
(long)GETARG(int))
#define UARG() \
(flags&QUADINT ? GETARG(u_quad_t) : \
@@ -253,6 +254,7 @@ vfprintf(FILE *fp, const char *fmt0, _BSD_VA_LIST_ ap)
flags&PTRINT ? GETARG(ptrdiff_t) : /* XXX */ \
flags&SIZEINT ? GETARG(size_t) : \
flags&SHORTINT ? (u_long)(u_short)GETARG(int) : \
+ flags&CHARINT ? (u_long)(u_char)GETARG(int) : \
(u_long)GETARG(u_int))
/*
@@ -934,7 +936,12 @@ reswitch: switch (ch) {
goto rflag;
#endif
case 'h':
- flags |= SHORTINT;
+ if (*fmt == 'h') {
+ fmt++;
+ flags |= CHARINT;
+ } else {
+ flags |= SHORTINT;
+ }
goto rflag;
case 'l':
if (*fmt == 'l') {