Module Name: src
Committed By: christos
Date: Wed Dec 22 16:59:10 UTC 2010
Modified Files:
src/lib/libc/stdio: Makefile.inc printf.3
Log Message:
document vsnprintf_ss
To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/lib/libc/stdio/Makefile.inc
cvs rdiff -u -r1.55 -r1.56 src/lib/libc/stdio/printf.3
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/stdio/Makefile.inc
diff -u src/lib/libc/stdio/Makefile.inc:1.39 src/lib/libc/stdio/Makefile.inc:1.40
--- src/lib/libc/stdio/Makefile.inc:1.39 Fri Sep 24 17:50:56 2010
+++ src/lib/libc/stdio/Makefile.inc Wed Dec 22 11:59:10 2010
@@ -1,5 +1,5 @@
# from: @(#)Makefile.inc 5.7 (Berkeley) 6/27/91
-# $NetBSD: Makefile.inc,v 1.39 2010/09/24 21:50:56 christos Exp $
+# $NetBSD: Makefile.inc,v 1.40 2010/12/22 16:59:10 christos Exp $
# stdio sources
.PATH: ${.CURDIR}/stdio
@@ -52,7 +52,7 @@
MLINKS+=printf.3 asprintf.3 printf.3 fprintf.3 printf.3 snprintf.3 \
printf.3 sprintf.3 printf.3 vasprintf.3 printf.3 vfprintf.3 \
printf.3 vprintf.3 printf.3 vsnprintf.3 printf.3 vsprintf.3 \
- printf.3 dprintf.3 printf.3 vdprintf.3
+ printf.3 dprintf.3 printf.3 vdprintf.3 printf.3 vsnprintf_ss.3
MLINKS+=putc.3 fputc.3 putc.3 putc_unlocked.3 putc.3 putchar.3 \
putc.3 putchar_unlocked.3 putc.3 putw.3
MLINKS+=scanf.3 fscanf.3 scanf.3 sscanf.3 scanf.3 vfscanf.3 scanf.3 vscanf.3 \
Index: src/lib/libc/stdio/printf.3
diff -u src/lib/libc/stdio/printf.3:1.55 src/lib/libc/stdio/printf.3:1.56
--- src/lib/libc/stdio/printf.3:1.55 Thu Dec 16 12:42:27 2010
+++ src/lib/libc/stdio/printf.3 Wed Dec 22 11:59:10 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: printf.3,v 1.55 2010/12/16 17:42:27 wiz Exp $
+.\" $NetBSD: printf.3,v 1.56 2010/12/22 16:59:10 christos Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" @(#)printf.3 8.1 (Berkeley) 6/4/93
.\"
-.Dd August 28, 2010
+.Dd December 22, 2010
.Dt PRINTF 3
.Os
.Sh NAME
@@ -48,6 +48,7 @@
.Nm vsprintf ,
.Nm vdprintf ,
.Nm vsnprintf ,
+.Nm vsnprintf_ss ,
.Nm vasprintf
.Nd formatted output conversion
.Sh LIBRARY
@@ -78,6 +79,8 @@
.Ft int
.Fn vsnprintf "char * restrict str" "size_t size" "const char * restrict format" "va_list ap"
.Ft int
+.Fn vsnprintf_ss "char * restrict str" "size_t size" "const char * restrict format" "va_list ap"
+.Ft int
.Fn vasprintf "char ** restrict ret" "const char * restrict format" "va_list ap"
.Sh DESCRIPTION
The
@@ -106,8 +109,9 @@
.Fn sprintf ,
.Fn snprintf ,
.Fn vsprintf ,
+.Fn vsnprintf ,
and
-.Fn vsnprintf
+.Fn vsnprintf_ss
write to the character string
.Fa str ;
and
@@ -124,6 +128,9 @@
.Xr stdarg 3 )
are converted for output.
.Pp
+.Fn vsnprintf_ss
+is a signal-safe standalone version that does handle floating point formats.
+.Pp
.Fn asprintf
and
.Fn vasprintf
@@ -148,9 +155,10 @@
on error.
It is more portable to check for a return value of \-1 instead.
.Pp
-.Fn snprintf
-and
+.Fn snprintf ,
.Fn vsnprintf
+and
+.Fn vsnprintf_ss
will write at most
.Fa size Ns \-1
of the characters printed into the output string
@@ -725,9 +733,10 @@
These functions return
the number of characters printed, or that would be printed if there
was adequate space in case of
-.Fn snprintf
-and
+.Fn snprintf ,
.Fn vsnprintf ,
+and
+.Fn vsnprintf_ss
(not including the trailing
.Ql \e0
used to end output to strings).
@@ -825,6 +834,10 @@
and
.Fn vasprintf
are modeled on the ones that first appeared in the GNU C library.
+The function
+.Fn vsnprintf_ss
+is non standard and appeared in
+.Nx 4.0 .
The functions
.Fn dprintf
and