Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Jun 2018 14:47:13 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334656 - head/stand/libsa
Message-ID:  <201806051447.w55ElDIt013519@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Tue Jun  5 14:47:13 2018
New Revision: 334656
URL: https://svnweb.freebsd.org/changeset/base/334656

Log:
  Add vsnprintf() to libsa.  Alpha-sort the printf prototypes in stand.h.
  
  I'm not sure why the v*printf() functions in libsa return void instead of
  int, but this maintains that convention for the new function.

Modified:
  head/stand/libsa/printf.c
  head/stand/libsa/stand.h

Modified: head/stand/libsa/printf.c
==============================================================================
--- head/stand/libsa/printf.c	Tue Jun  5 13:53:37 2018	(r334655)
+++ head/stand/libsa/printf.c	Tue Jun  5 14:47:13 2018	(r334656)
@@ -141,6 +141,20 @@ snprintf(char *buf, size_t size, const char *cfmt, ...
 }
 
 void
+vsnprintf(char *buf, size_t size, const char *cfmt, va_list ap)
+{
+	struct print_buf arg;
+
+	arg.buf = buf;
+	arg.size = size;
+
+	kvprintf(cfmt, &snprint_func, &arg, 10, ap);
+
+	if (arg.size >= 1)
+		*(arg.buf)++ = 0;
+}
+
+void
 vsprintf(char *buf, const char *cfmt, va_list ap)
 {
 	int	retval;

Modified: head/stand/libsa/stand.h
==============================================================================
--- head/stand/libsa/stand.h	Tue Jun  5 13:53:37 2018	(r334655)
+++ head/stand/libsa/stand.h	Tue Jun  5 14:47:13 2018	(r334656)
@@ -268,10 +268,11 @@ extern void	*reallocf(void *ptr, size_t size);
 extern void	mallocstats(void);
 
 extern int	printf(const char *fmt, ...) __printflike(1, 2);
-extern void	vprintf(const char *fmt, __va_list);
 extern int	sprintf(char *buf, const char *cfmt, ...) __printflike(2, 3);
 extern int	snprintf(char *buf, size_t size, const char *cfmt, ...) __printflike(3, 4);
+extern void	vprintf(const char *fmt, __va_list);
 extern void	vsprintf(char *buf, const char *cfmt, __va_list);
+extern void	vsnprintf(char *buf, size_t size, const char *cfmt, __va_list);
 
 extern void	twiddle(u_int callerdiv);
 extern void	twiddle_divisor(u_int globaldiv);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806051447.w55ElDIt013519>