aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/gen/unvis-compat.c
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2012-12-18 16:37:24 +0000
committerBrooks Davis <brooks@FreeBSD.org>2012-12-18 16:37:24 +0000
commit8ccca1222d3d9e815f972a7acfc18a034ce4a4bb (patch)
treeaf2fc41b0960db64adb617ce885a81fe748f415c /lib/libc/gen/unvis-compat.c
parent398228fc82c4d7cfc49c5aff6b9c8ad15c8d8933 (diff)
parent98d3bb6efb3abbb40256406ab61f3bd2cac6c507 (diff)
Replace our implementation of the vis(3) and unvis(3) APIs with
NetBSD's. This output size limited versions of vis and unvis functions as well as a set of vis variants that allow arbitrary characters to be specified for encoding. Finally, MIME Quoted-Printable encoding as described in RFC 2045 is supported.
Notes
Notes: svn path=/head/; revision=244401
Diffstat (limited to 'lib/libc/gen/unvis-compat.c')
-rw-r--r--lib/libc/gen/unvis-compat.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/libc/gen/unvis-compat.c b/lib/libc/gen/unvis-compat.c
new file mode 100644
index 000000000000..080143e39df8
--- /dev/null
+++ b/lib/libc/gen/unvis-compat.c
@@ -0,0 +1,46 @@
+/*-
+ * Copyright (c) 2012 SRI International
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <vis.h>
+
+#define _UNVIS_END 1
+
+int
+__unvis_44bsd(char *cp, int c, int *astate, int flag)
+{
+
+ if (flag & _UNVIS_END)
+ flag = (flag & ~_UNVIS_END) ^ UNVIS_END;
+ return unvis(cp, c, astate, flag);
+}
+
+__sym_compat(unvis, __vis_44bsd, FBSD_1.0);