diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-01-12 06:14:33 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-01-12 06:14:33 +0000 |
commit | cf7ccc9cb187d0627ce9f7a884e9de25b123975e (patch) | |
tree | 67db59d2fcf1a3ffefdfa49f40c1a931b6137823 /lib/libc/stdio/sprintf.c | |
parent | bec95d96c1daca750433ebfaa73a057be3022cf6 (diff) |
Based on some FreeBSD changes:
For *s*printf, set f._file to -1 like the comments in stdio.h say.
Use '\0', not 0, where appropriate.
Don't error out on size of '0' for v?snprintf().
Diffstat (limited to 'lib/libc/stdio/sprintf.c')
-rw-r--r-- | lib/libc/stdio/sprintf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/stdio/sprintf.c b/lib/libc/stdio/sprintf.c index 16b99a27f97..994192f04bc 100644 --- a/lib/libc/stdio/sprintf.c +++ b/lib/libc/stdio/sprintf.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: sprintf.c,v 1.3 1997/07/25 20:30:11 mickey Exp $"; +static char rcsid[] = "$OpenBSD: sprintf.c,v 1.4 1998/01/12 06:14:31 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> @@ -61,6 +61,7 @@ sprintf(str, fmt, va_alist) va_list ap; FILE f; + f._file = -1; f._flags = __SWR | __SSTR; f._bf._base = f._p = (unsigned char *)str; f._bf._size = f._w = INT_MAX; @@ -71,6 +72,6 @@ sprintf(str, fmt, va_alist) #endif ret = vfprintf(&f, fmt, ap); va_end(ap); - *f._p = 0; + *f._p = '\0'; return (ret); } |