Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Sep 2012 20:28:01 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r240675 - in projects/mtree: include lib/libc/gen
Message-ID:  <201209182028.q8IKS1lK056820@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Tue Sep 18 20:28:01 2012
New Revision: 240675
URL: http://svn.freebsd.org/changeset/base/240675

Log:
  Implement VIS_GLOB support including compatibilty symbols required by
  overlapping flags between FreeBSD and NetBSD.
  
  Add a compatibility symbol for unvis() due to NetBSD's allocation of
  a flag value for UNVIS_END rather than just using 1.
  
  Add symbol version entries for new vis and unvis functions.

Added:
  projects/mtree/lib/libc/gen/unvis-compat.c
  projects/mtree/lib/libc/gen/vis-compat.c
Modified:
  projects/mtree/include/vis.h
  projects/mtree/lib/libc/gen/Makefile.inc
  projects/mtree/lib/libc/gen/Symbol.map
  projects/mtree/lib/libc/gen/vis.c

Modified: projects/mtree/include/vis.h
==============================================================================
--- projects/mtree/include/vis.h	Tue Sep 18 20:20:29 2012	(r240674)
+++ projects/mtree/include/vis.h	Tue Sep 18 20:28:01 2012	(r240675)
@@ -62,6 +62,7 @@
 #define	VIS_HTTP1866	0x200	/* http-style &#num; or &string; */
 #define	VIS_NOESCAPE	0x400	/* don't decode `\' */
 #define	_VIS_END	0x800	/* for unvis */
+#define	VIS_GLOB	0x1000	/* encode glob(3) magics */
 
 /*
  * unvis return codes

Modified: projects/mtree/lib/libc/gen/Makefile.inc
==============================================================================
--- projects/mtree/lib/libc/gen/Makefile.inc	Tue Sep 18 20:20:29 2012	(r240674)
+++ projects/mtree/lib/libc/gen/Makefile.inc	Tue Sep 18 20:28:01 2012	(r240675)
@@ -32,8 +32,9 @@ SRCS+=  __getosreldate.c __xuname.c \
 	sigsetops.c sleep.c srand48.c statvfs.c stringlist.c strtofflags.c \
 	sysconf.c sysctl.c sysctlbyname.c sysctlnametomib.c \
 	syslog.c telldir.c termios.c time.c times.c timezone.c tls.c \
-	ttyname.c ttyslot.c ualarm.c ulimit.c uname.c unvis.c \
-	usleep.c utime.c utxdb.c valloc.c vis.c wait.c wait3.c waitpid.c \
+	ttyname.c ttyslot.c ualarm.c ulimit.c uname.c unvis.c unvis-compat.c \
+	usleep.c utime.c utxdb.c valloc.c vis.c vis-compat.c \
+	wait.c wait3.c waitpid.c \
 	wordexp.c
 
 MISRCS+=modf.c

Modified: projects/mtree/lib/libc/gen/Symbol.map
==============================================================================
--- projects/mtree/lib/libc/gen/Symbol.map	Tue Sep 18 20:20:29 2012	(r240674)
+++ projects/mtree/lib/libc/gen/Symbol.map	Tue Sep 18 20:28:01 2012	(r240675)
@@ -298,15 +298,9 @@ FBSD_1.0 {
 	ualarm;
 	ulimit;
 	uname;
-	unvis;
-	strunvis;
-	strunvisx;
 	usleep;
 	utime;
 	valloc;
-	vis;
-	strvis;
-	strvisx;
 	wait;
 	wait3;
 	waitpid;
@@ -387,6 +381,23 @@ FBSD_1.3 {
 	 fdlopen;
 	__FreeBSD_libc_enter_restricted_mode;
 	getcontextx;
+	nvis;
+	snvis;
+	strnunvis;
+	strnunvisx;
+	strunvis;
+	strunvisx;
+	strnvis;
+	strnvisx;
+	strsnvis;
+	strsnvisx;
+	strsvis;
+	strsvisx;
+	strvis;
+	strvisx;
+	svis;
+	unvis;
+	vis;
 };
 
 FBSDprivate_1.0 {

Added: projects/mtree/lib/libc/gen/unvis-compat.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/mtree/lib/libc/gen/unvis-compat.c	Tue Sep 18 20:28:01 2012	(r240675)
@@ -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);

Added: projects/mtree/lib/libc/gen/vis-compat.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/mtree/lib/libc/gen/vis-compat.c	Tue Sep 18 20:28:01 2012	(r240675)
@@ -0,0 +1,66 @@
+/*-
+ * 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	_VIS_OGLOB	0x100
+
+char *
+__vis_oglob(char *dst, int c, int flag, int nextc)
+{
+
+	if (flag & _VIS_OGLOB)
+		flag = (flag & ~_VIS_OGLOB) ^ VIS_GLOB;
+	return vis(dst, c, flag, nextc);
+}
+
+int
+__strvis_oglob(char *dst, const char *src, int flag)
+{
+
+	if (flag & _VIS_OGLOB)
+		flag = (flag & ~_VIS_OGLOB) ^ VIS_GLOB;
+	return strvis(dst, src, flag);
+}
+
+int
+__strvisx_oglob(char *dst, const char *src, size_t len, int flag)
+{
+
+	if (flag & _VIS_OGLOB)
+		flag = (flag & ~_VIS_OGLOB) ^ VIS_GLOB;
+	return strvisx(dst, src, len, flag);
+}
+
+__sym_compat(vis, __vis_oglob, FBSD_1.0);
+__sym_compat(strvis, __strvis_oglob, FBSD_1.0);
+__sym_compat(strvisx, __strvisx_oglob, FBSD_1.0);

Modified: projects/mtree/lib/libc/gen/vis.c
==============================================================================
--- projects/mtree/lib/libc/gen/vis.c	Tue Sep 18 20:20:29 2012	(r240674)
+++ projects/mtree/lib/libc/gen/vis.c	Tue Sep 18 20:28:01 2012	(r240675)
@@ -91,7 +91,7 @@ static char *do_svis(char *, size_t *, i
 #define xtoa(c)		"0123456789abcdef"[c]
 #define XTOA(c)		"0123456789ABCDEF"[c]
 
-#define MAXEXTRAS	5
+#define MAXEXTRAS	9
 
 #define MAKEEXTRALIST(flag, extra, orig_str)				      \
 do {									      \
@@ -105,6 +105,12 @@ do {									      \
 	for (o = orig, e = extra; (*e++ = *o++) != '\0';)		      \
 		continue;						      \
 	e--;								      \
+	if (flag & VIS_GLOB) {						      \
+		*e++ = '*';						      \
+		*e++ = '?';						      \
+		*e++ = '[';						      \
+		*e++ = '#';						      \
+	}								      \
 	if (flag & VIS_SP) *e++ = ' ';					      \
 	if (flag & VIS_TAB) *e++ = '\t';				      \
 	if (flag & VIS_NL) *e++ = '\n';					      \



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