* libamu/util.c, amd/autil.c (strsplit): moved strsplit() function
authorErez Zadok <ezk@cs.sunysb.edu>
Sun, 7 Aug 2005 03:43:19 +0000 (03:43 +0000)
committerErez Zadok <ezk@cs.sunysb.edu>
Sun, 7 Aug 2005 03:43:19 +0000 (03:43 +0000)
from Amd code to to libamu, so sun2amd could use it.

* amd/Makefile.am (sbin_PROGRAMS): build sun2amd binary and man
page.
(EXTRA_sun2amd_OBJECTS): sun2amd needs to link with all info_*.c files

* amd/sun2amd.8: placeholder for man page.

* amd/sun2amd.c: placeholder for C version of translator from Sun
syntax maps to Amd maps.

* */*.[0-9]: include file name in nroff source comment.

16 files changed:
ChangeLog
amd/Makefile.am
amd/amd.8
amd/autil.c
amd/sun2amd.8 [new file with mode: 0644]
amd/sun2amd.c [new file with mode: 0644]
amq/amq.8
amq/pawd.1
fixmount/fixmount.8
fsinfo/fsinfo.8
hlfsd/hlfsd.8
libamu/strutil.c
mk-amd-map/mk-amd-map.8
scripts/amd.conf.5
scripts/automount2amd.8
wire-test/wire-test.8

index dc1fdbc4cedf84061ac319bd4d8a3f6abdff6f9a..4f83dea0039cdb1a4ca348a13bfc663aaa450bc2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2005-08-06  Erez Zadok  <ezk@cs.sunysb.edu>
 
+       * libamu/util.c, amd/autil.c (strsplit): moved strsplit() function
+       from Amd code to to libamu, so sun2amd could use it.
+
+       * amd/Makefile.am (sbin_PROGRAMS): build sun2amd binary and man
+       page.
+       (EXTRA_sun2amd_OBJECTS): sun2amd needs to link with all info_*.c files
+
+       * amd/sun2amd.8: placeholder for man page.
+
+       * amd/sun2amd.c: placeholder for C version of translator from Sun
+       syntax maps to Amd maps.
+
+       * */*.[0-9]: include file name in nroff source comment.
+
        * ALL: use '0' properly when assigning or passing it to functions.
        If in the context pointer, use NULL.  If in the context of a
        single char (say within a string), the use '\0'.  This is just to
@@ -45,7 +59,6 @@
        in the distro (IMHO), and should be cleaned upon "make clean".
        (amd_SOURCES): include new sun_map_parse.y and sun_map_tok.l files.
 
-
        * ylwrap: new file needed because we have two parsers now.
 
        * amd/sun_map_{parse.y,tok.l}: cleanup and formatting.
index 4780f959760413e57157947326ec7d255c023da6..a8b0fb8ce737353d0044c01a004c1144b3cf9e44 100644 (file)
@@ -4,10 +4,10 @@
 # Level: Makefile for amd/ directory
 # Author: Erez Zadok
 
-sbin_PROGRAMS = amd
+sbin_PROGRAMS = amd sun2amd
 
 # man pages
-man_MANS = amd.8
+man_MANS = amd.8 sun2amd.8
 
 # test scripts
 TESTS = test1.sh
@@ -100,12 +100,34 @@ EXTRA_amd_SOURCES =       \
        \
        get_args.c
 
+sun2amd_SOURCES =              \
+       sun_map_parse.y         \
+       sun_map_tok.l           \
+       \
+       sun2amd.c               \
+       sun_map.c
+
+EXTRA_sun2amd_SOURCES =        \
+       info_file.c     \
+       info_exec.c     \
+       info_hesiod.c   \
+       info_ldap.c     \
+       info_ndbm.c     \
+       info_nis.c      \
+       info_nisplus.c  \
+       info_passwd.c   \
+       info_sun.c      \
+       info_union.c
+
 # AMD_FS_OBJS: a list of ops_*.o objects added, depending on which
 # filesystem types this system supports.
 # AMD_INFO_OBJS: a list of info_*.o objects added, depending on which map
 # types this system supports.
 EXTRA_amd_OBJECTS = @AMD_FS_OBJS@ @AMD_INFO_OBJS@
-LDADD = $(EXTRA_amd_OBJECTS) get_args.o ../libamu/libamu.la
+amd_LDADD = $(EXTRA_amd_OBJECTS) get_args.o ../libamu/libamu.la
+
+EXTRA_sun2amd_OBJECTS = @AMD_INFO_OBJS@
+sun2amd_LDADD = $(EXTRA_sun2amd_OBJECTS) ../libamu/libamu.la
 # must manually add f/lex library to LIBS, and not to LDADD.
 LIBS = @LIBS@ @LEXLIB@ @WRAPLIB@
 
index cf943e1efb962eb86baf85eac145f40fe601177a..765a8bb8c42db4fe1d4ad490436a7ee922bdfa65 100644 (file)
--- a/amd/amd.8
+++ b/amd/amd.8
@@ -36,9 +36,8 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"    %W% (Berkeley) %G%
 .\"
-.\" $Id: amd.8,v 1.14 2005/01/03 20:56:45 ezk Exp $
+.\" File: am-utils/amd/amd.8
 .\"
 .TH AMD 8 "3 November 1989"
 .SH NAME
index e439c2700acf046ff6bd89749106c8222072e538..fc67117ade1d2e31c6ed6bc0220ad93fd8fb5695 100644 (file)
@@ -94,76 +94,6 @@ strealloc(char *p, char *s)
 }
 
 
-/*
- * Split s using ch as delimiter and qc as quote character
- */
-char **
-strsplit(char *s, int ch, int qc)
-{
-  char **ivec;
-  int ic = 0;
-  int done = 0;
-
-  ivec = (char **) xmalloc((ic + 1) * sizeof(char *));
-
-  while (!done) {
-    char *v;
-
-    /*
-     * skip to split char
-     */
-    while (*s && (ch == ' ' ? (isascii(*s) && isspace((int)*s)) : *s == ch))
-      *s++ = '\0';
-
-    /*
-     * End of string?
-     */
-    if (!*s)
-      break;
-
-    /*
-     * remember start of string
-     */
-    v = s;
-
-    /*
-     * skip to split char
-     */
-    while (*s && !(ch == ' ' ? (isascii(*s) && isspace((int)*s)) : *s == ch)) {
-      if (*s++ == qc) {
-       /*
-        * Skip past string.
-        */
-       s++;
-       while (*s && *s != qc)
-         s++;
-       if (*s == qc)
-         s++;
-      }
-    }
-
-    if (!*s)
-      done = 1;
-    *s++ = '\0';
-
-    /*
-     * save string in new ivec slot
-     */
-    ivec[ic++] = v;
-    ivec = (char **) xrealloc((voidp) ivec, (ic + 1) * sizeof(char *));
-    if (amuDebug(D_STR))
-      plog(XLOG_DEBUG, "strsplit saved \"%s\"", v);
-  }
-
-  if (amuDebug(D_STR))
-    plog(XLOG_DEBUG, "strsplit saved a total of %d strings", ic);
-
-  ivec[ic] = NULL;
-
-  return ivec;
-}
-
-
 /*
  * Strip off the trailing part of a domain
  * to produce a short-form domain relative
diff --git a/amd/sun2amd.8 b/amd/sun2amd.8
new file mode 100644 (file)
index 0000000..6352589
--- /dev/null
@@ -0,0 +1,44 @@
+.\"
+.\" Copyright (c) 1997-2005 Erez Zadok
+.\" Copyright (c) 1990 Jan-Simon Pendry
+.\" Copyright (c) 1990 Imperial College of Science, Technology & Medicine
+.\" Copyright (c) 1990 The Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Jan-Simon Pendry at Imperial College, London.
+.\"
+.\" 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 acknowledgment:
+.\"      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.
+.\"
+.\"
+.\" File: am-utils/amd/sun2amd.8
+.\"
+.TH SUN2AMD 8L "8 August 2005"
+.SH NAME
+sun2amd \- converts Sun automount maps to Amd maps
diff --git a/amd/sun2amd.c b/amd/sun2amd.c
new file mode 100644 (file)
index 0000000..647fa9b
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1997-2005 Erez Zadok
+ * Copyright (c) 1989 Jan-Simon Pendry
+ * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jan-Simon Pendry at Imperial College, London.
+ *
+ * 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 acknowledgment:
+ *      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.
+ *
+ *
+ * File: am-utils/amd/sun2amd.c
+ *
+ */
+
+/*
+ * Translate Sun-syntax maps to Amd maps
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+#include <am_defs.h>
+#include <amd.h>
+
+/* XXX: empty placeholder.  Fill in */
+
+
+/* dummies to make the program compile and link */
+struct amu_global_options gopt; /* may not be needed for sun2amd */
+
+
+int
+main()
+{
+  exit(1);
+}
index ee62df8edeba1a7d7f9e1b7bd6f397210d14077e..e296e0f464e11675f4917c1c0ffa0ea687f5e1b1 100644 (file)
--- a/amq/amq.8
+++ b/amq/amq.8
@@ -36,9 +36,8 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"    %W% (Berkeley) %G%
 .\"
-.\" $Id: amq.8,v 1.15 2005/01/03 20:56:45 ezk Exp $
+.\" File: am-utils/amq/amq.8
 .\"
 .TH AMQ 8 "25 April 1989"
 .SH NAME
index ac98d2eda3058dfc484ba8337039c50c69f39ff0..e4d47452ca2fbe8758b59aec40eaba8fcb4c5df3 100644 (file)
@@ -36,9 +36,8 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"    %W% (Berkeley) %G%
 .\"
-.\" $Id: pawd.1,v 1.9 2005/01/03 20:56:45 ezk Exp $
+.\" File: am-utils/amq/pawd.1
 .\"
 .TH PAWD 1 "6 Jan 1998"
 .SH NAME
index 9dfdfe802afea600b13c5bf6bb9f145a10b3330e..663741df67fcb341ade7d6f3618dcbf4d5f17f31 100644 (file)
@@ -36,9 +36,8 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"    %W% (Berkeley) %G%
 .\"
-.\" $Id: fixmount.8,v 1.12 2005/01/03 20:56:46 ezk Exp $
+.\" File: am-utils/fixmount/fixmount.8
 .\"
 .TH FIXMOUNT 8 "26 Feb 1993"
 .SH NAME
index 0f0f79e153f846b3c2268ac689e375fe20c5195f..04fe3f008401e3af5d4ab0e2544d1ecb08ef2c62 100644 (file)
@@ -32,8 +32,8 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"     from: @(#)fsinfo.8     8.1 (Berkeley) 6/28/93
-.\"    $Id: fsinfo.8,v 1.13 2005/01/03 20:56:46 ezk Exp $
+.\"
+.\" File: am-utils/fsinfo/fsinfo.8
 .\"
 .TH FSINFO 8 "June 28, 1993"
 .SH NAME
index 56e56526166f4da77f4e25ad208f66c1177c7257..75311117c7277b03b24742f1d5fb1836907af3d0 100644 (file)
@@ -36,7 +36,8 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: hlfsd.8,v 1.11 2005/01/03 20:56:46 ezk Exp $
+.\"
+.\" File: am-utils/hlfsd/hlfsd.8
 .\"
 .\" HLFSD was written at Columbia University Computer Science Department, by
 .\" Erez Zadok <ezk@cs.columbia.edu> and Alexander Dupuy <dupuy@smarts.com>
index d11d318e114fed09c8a085ff7d1842cb03cfbe0b..556fb07aadf56c78fea651f7d711d23d50d839e0 100644 (file)
@@ -121,6 +121,76 @@ xstrlcat(char *dst, const char *src, size_t len)
 }
 
 
+/*
+ * Split s using ch as delimiter and qc as quote character
+ */
+char **
+strsplit(char *s, int ch, int qc)
+{
+  char **ivec;
+  int ic = 0;
+  int done = 0;
+
+  ivec = (char **) xmalloc((ic + 1) * sizeof(char *));
+
+  while (!done) {
+    char *v;
+
+    /*
+     * skip to split char
+     */
+    while (*s && (ch == ' ' ? (isascii(*s) && isspace((int)*s)) : *s == ch))
+      *s++ = '\0';
+
+    /*
+     * End of string?
+     */
+    if (!*s)
+      break;
+
+    /*
+     * remember start of string
+     */
+    v = s;
+
+    /*
+     * skip to split char
+     */
+    while (*s && !(ch == ' ' ? (isascii(*s) && isspace((int)*s)) : *s == ch)) {
+      if (*s++ == qc) {
+       /*
+        * Skip past string.
+        */
+       s++;
+       while (*s && *s != qc)
+         s++;
+       if (*s == qc)
+         s++;
+      }
+    }
+
+    if (!*s)
+      done = 1;
+    *s++ = '\0';
+
+    /*
+     * save string in new ivec slot
+     */
+    ivec[ic++] = v;
+    ivec = (char **) xrealloc((voidp) ivec, (ic + 1) * sizeof(char *));
+    if (amuDebug(D_STR))
+      plog(XLOG_DEBUG, "strsplit saved \"%s\"", v);
+  }
+
+  if (amuDebug(D_STR))
+    plog(XLOG_DEBUG, "strsplit saved a total of %d strings", ic);
+
+  ivec[ic] = NULL;
+
+  return ivec;
+}
+
+
 /*
  * Make all the directories in the path.
  */
index 9c9ccf70e8c9f43b3b1d5497aa1d44d0fc59b750..c3f571339770b8da1a826ebc66e0e6e2dbbfb4a5 100644 (file)
@@ -32,8 +32,8 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"     from: @(#)mk-amd-map.8 8.1 (Berkeley) 6/28/93
-.\"    $Id: mk-amd-map.8,v 1.9 2005/01/03 20:56:46 ezk Exp $
+.\"
+.\" File: am-utils/mk-amd-map/mk-amd-map.8
 .\"
 .TH MK-AMD-MAP 8 "June 28, 1993"
 .SH NAME
index d904121de8b53941a9319f122bcd45a7b4427266..feca1ee58efa5d7c0514c252ed2183310170d30a 100644 (file)
@@ -36,9 +36,8 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"    %W% (Berkeley) %G%
 .\"
-.\" $Id: amd.conf.5,v 1.40 2005/08/06 18:58:45 ezk Exp $
+.\" File: am-utils/scripts/amd.conf.5
 .\"
 .TH AMD.CONF 5 "7 August 1997"
 .SH NAME
index ad2d477029d40535d698859df12d0e44b1917f47..776213f5a9fd25e10464856cf40327e750abc538 100644 (file)
@@ -36,9 +36,8 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"    %W% (Berkeley) %G%
 .\"
-.\" $Id: automount2amd.8,v 1.8 2005/01/03 20:56:46 ezk Exp $
+.\" File: am-utils/scripts/automount2amd.8
 .\"
 .TH AUTOMOUNT2AMD 8L "24 May 1993"
 .SH NAME
index 07503cd8a1875858da73e671c52f2fa89f2dd1c7..4765c3536affa818b16db2f8ac7c81396122e0c7 100644 (file)
@@ -36,9 +36,8 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"    %W% (Berkeley) %G%
 .\"
-.\" $Id: wire-test.8,v 1.10 2005/01/03 20:56:46 ezk Exp $
+.\" File: am-utils/wire-test/wire-test.8
 .\"
 .TH WIRE-TEST 8 "26 Feb 1993"
 .SH NAME