aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/include
diff options
context:
space:
mode:
authorDaniel Kurtz <djkurtz@chromium.org>2017-12-07 12:11:53 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-12-10 12:17:10 +0100
commita6e632aac9a013fbae6e8b6a17688e8b1a81e12d (patch)
treef8e2d29d74d45e5cc2bad958d223feb45d16f292 /nx-X11/programs/Xserver/include
parentc281c6e06a1c9ff65e5ea00d172ea42806fb677f (diff)
downloadnx-libs-a6e632aac9a013fbae6e8b6a17688e8b1a81e12d.tar.gz
nx-libs-a6e632aac9a013fbae6e8b6a17688e8b1a81e12d.tar.bz2
nx-libs-a6e632aac9a013fbae6e8b6a17688e8b1a81e12d.zip
os/xprintf: add Xvscnprintf and Xscnprintf
Backported from X.org: commit 5c2e2a164d615ab06be28a663734e782614b5cc7 Author: Daniel Kurtz <djkurtz@chromium.org> Date: Wed Apr 18 09:51:51 2012 +0000 os/xprintf: add Xvscnprintf and Xscnprintf Normal snprintf() usually returns the number of bytes that would have been written into a buffer had the buffer been long enough. The scnprintf() variants return the actual number of bytes written, excluding the trailing '\0'. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Backported-to-NX-by: Mihai Moldovan <ionic@ionic.de>
Diffstat (limited to 'nx-X11/programs/Xserver/include')
-rw-r--r--nx-X11/programs/Xserver/include/Xprintf.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/include/Xprintf.h b/nx-X11/programs/Xserver/include/Xprintf.h
index 7f7366d33..e9ee79d22 100644
--- a/nx-X11/programs/Xserver/include/Xprintf.h
+++ b/nx-X11/programs/Xserver/include/Xprintf.h
@@ -66,4 +66,16 @@ _X_ATTRIBUTE_PRINTF(2, 0);
#define vasprintf Xvasprintf
#endif
+/*
+ * These functions provide a portable implementation of the linux kernel
+ * scnprintf & vscnprintf routines that return the number of bytes actually
+ * copied during a snprintf, (excluding the final '\0').
+ */
+extern _X_EXPORT int
+Xscnprintf(char *s, int n, const char * _X_RESTRICT_KYWD fmt, ...)
+_X_ATTRIBUTE_PRINTF(3,4);
+extern _X_EXPORT int
+Xvscnprintf(char *s, int n, const char * _X_RESTRICT_KYWD fmt, va_list va)
+_X_ATTRIBUTE_PRINTF(3,0);
+
#endif /* XPRINTF_H */