summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2011-03-12 19:52:45 +0000
committerchristos <christos@NetBSD.org>2011-03-12 19:52:45 +0000
commita7c6e7bec6a27d8d3e95917f7981b397bea48005 (patch)
treee323bd52fb208549074c6df4a31f67f53be52e0a /include
parentf419d48826cbb9e15f6d1c3ca454372889bec322 (diff)
Fix various vis/unvis issues:
- no need for all the weak symbols - define a new _VIS_END flag for UNVIS_END so that there are no collisions between and vis and unvis flags. - add bound versions of the vis and unvis functions that take the length of the destination buffer. Unlike the OpenBSD ones they return -1 or NULL if the buffer is not large enough, instead of silently truncating.
Diffstat (limited to 'include')
-rw-r--r--include/vis.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/include/vis.h b/include/vis.h
index 7c06b040f89..5e8d1d31e85 100644
--- a/include/vis.h
+++ b/include/vis.h
@@ -1,4 +1,4 @@
-/* $NetBSD: vis.h,v 1.18 2010/11/27 19:44:54 christos Exp $ */
+/* $NetBSD: vis.h,v 1.19 2011/03/12 19:52:45 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -61,6 +61,7 @@
#define VIS_MIMESTYLE 0x100 /* mime-style escape = HEX HEX */
#define VIS_HTTP1866 0x200 /* http-style &#num; or &string; */
#define VIS_NOESCAPE 0x400 /* don't decode `\' */
+#define _VIS_END 0x800 /* for unvis */
/*
* unvis return codes
@@ -74,21 +75,37 @@
/*
* unvis flags
*/
-#define UNVIS_END 1 /* no more characters */
+#define UNVIS_END _VIS_END /* no more characters */
#include <sys/cdefs.h>
__BEGIN_DECLS
char *vis(char *, int, int, int);
+char *nvis(char *, size_t, int, int, int);
+
char *svis(char *, int, int, int, const char *);
+char *snvis(char *, size_t, int, int, int, const char *);
+
int strvis(char *, const char *, int);
+int strnvis(char *, size_t, const char *, int);
+
int strsvis(char *, const char *, int, const char *);
+int strsnvis(char *, size_t, const char *, int, const char *);
+
int strvisx(char *, const char *, size_t, int);
+int strnvisx(char *, size_t, const char *, size_t, int);
+
int strsvisx(char *, const char *, size_t, int, const char *);
+int strsnvisx(char *, size_t, const char *, size_t, int, const char *);
+
int strunvis(char *, const char *);
+int strnunvis(char *, size_t, const char *);
+
int strunvisx(char *, const char *, int);
+int strnunvisx(char *, size_t, const char *, int);
+
#ifndef __LIBC12_SOURCE__
-int unvis(char *, int, int *, int) __RENAME(__unvis13);
+int unvis(char *, int, int *, int) __RENAME(__unvis50);
#endif
__END_DECLS