Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/usr.sbin/mtree Add __RCSID()
details: https://anonhg.NetBSD.org/src/rev/4f26a25cc183
branches: netbsd-1-4
changeset: 469708:4f26a25cc183
user: wennmach <wennmach%NetBSD.org@localhost>
date: Fri Nov 12 14:42:36 1999 +0000
description:
Add __RCSID()
diffstat:
usr.sbin/mtree/code.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 81 insertions(+), 0 deletions(-)
diffs (85 lines):
diff -r 0722424c31d6 -r 4f26a25cc183 usr.sbin/mtree/code.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/mtree/code.c Fri Nov 12 14:42:36 1999 +0000
@@ -0,0 +1,81 @@
+/* $NetBSD: code.c,v 1.4.2.2 1999/11/12 14:42:36 wennmach Exp $ */
+
+/*-
+ * Copyright (c) 1999
+ * Contributed to NetBSD by Alexandre Wennmacher
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ */
+
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: code.c,v 1.4.2.2 1999/11/12 14:42:36 wennmach Exp $");
+#endif /* not lint */
+
+#include <sys/param.h>
+#include <vis.h>
+#include <fts.h> /* XXX needed for extern.h" */
+#include "extern.h"
+
+#define STRVISFLAG (VIS_CSTYLE | VIS_WHITE)
+
+static char visbuf[4*MAXPATHLEN + 1];
+
+char *
+encode(dst, src)
+ char *dst;
+ const char *src;
+{
+ char *pv, *pd;
+
+ (void)strvis(visbuf, src, STRVISFLAG);
+ for (pv = visbuf, pd = dst; *pv != '\0';) {
+ if (*pv == '\\') *pd++ = *pv++; /* already encoded, skip */
+ if (*pv == '#') *pd++ = '\\'; /* encode '#' */
+ *pd++ = *pv++;
+ }
+ *pd = '\0';
+ return dst;
+}
+
+char *
+decode(dst, src)
+ char *dst;
+ const char *src;
+{
+ char *pv, *ps;
+
+ for (ps = (char *)src, pv = visbuf; *ps != '\0';) {
+ if (*ps == '\\' && *(ps + 1) == '#') ps++; /* encoded '#' */
+ *pv++ = *ps++;
+ }
+ *pv = '\0';
+ (void)strunvis(dst, visbuf);
+ return dst;
+}
Home |
Main Index |
Thread Index |
Old Index