Add argz module, which is autoupdated from libtool.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 22 Jun 2004 18:28:11 +0000 (18:28 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 22 Jun 2004 18:28:11 +0000 (18:28 +0000)
13 files changed:
ChangeLog
MODULES.html
MODULES.html.sh
config/ChangeLog
config/srclist-update
config/srclist.txt
config/srclistvars.sh
lib/ChangeLog
lib/argz.c [new file with mode: 0644]
lib/argz_.h [new file with mode: 0644]
m4/ChangeLog
m4/argz.m4 [new file with mode: 0644]
modules/argz [new file with mode: 0644]

index 80f5b6f..314d12b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * modules/argz: Omit "#include".
+
+       * MODULES.html.sh (func_all_modules): Add calloc, to match
+       2004-06-01 addition of calloc module.
+
+2004-06-22  Gary V. Vaughan  <gary@gnu.org>  
+
+       * modules/argz: New file.
+       * MODULES.html.sh (func_all_modules): Add argz.
+
 2004-06-12  Jim Meyering  <jim@meyering.net>
        and  Paul Eggert  <eggert@cs.ucla.edu>
 
index cf036fd..6ddf71f 100644 (file)
@@ -2,7 +2,7 @@
 <HTML>
   <HEAD>
     <TITLE>Gnulib Module List</TITLE>
-    <META NAME="keywords" CONTENT="acl, alloca, allocsa, argmatch, argp, assert, atexit, backupfile, bcopy, binary-io, c-bs-a, c-ctype, c-stack, calloc, canon-host, chown, cloexec, closeout, copy-file, diacrit, dirfd, dirname, dup2, eealloc, error, euidaccess, exclude, execute, exit, exitfail, extensions, fatal, fatal-signal, file-type, fileblocks, filemode, findprog, fnmatch, fnmatch-gnu, fnmatch-posix, fpending, free, fsusage, ftruncate, full-read, full-write, fwriteerror, gcd, getdate, getdomainname, getgroups, gethostname, getline, getloadavg, getndelim2, getnline, getopt, getpagesize, getpass, getpass-gnu, gettext, gettime, gettimeofday, getugroups, getusershell, group-member, hard-locale, hash, hash-pjw, human, iconv, idcache, inttostr, isdir, lchown, linebreak, linebuffer, localcharset, long-options, lstat, makepath, malloc, mathl, mbswidth, md5, memcasecmp, memchr, memcmp, memcoll, memcpy, memmove, mempcpy, memrchr, memset, minmax, mkdir, mkdtemp, mkstemp, mktime, modechange, mountlist, nanosleep, obstack, path-concat, pathmax, pathname, physmem, pipe, poll, posixtm, posixver, progname, putenv, quote, quotearg, readlink, readtokens, readutmp, realloc, regex, rename, restrict, rmdir, rpmatch, safe-read, safe-write, same, save-cwd, savedir, setenv, settime, sha, sig2str, stat, stdbool, stdio-safer, stpcpy, stpncpy, strcase, strchrnul, strcspn, strdup, strerror, strftime, strndup, strnlen, strpbrk, strstr, strtod, strtoimax, strtol, strtoll, strtoul, strtoull, strtoumax, strverscmp, sysexits, time_r, timegm, timespec, tzset, ucs4-utf16, ucs4-utf8, unicodeio, unistd-safer, unlocked-io, userspec, utf16-ucs4, utf8-ucs4, utime, vasnprintf, vasprintf, version-etc, wait-process, xalloc, xallocsa, xgetcwd, xgetdomainname, xgethostname, xmemcoll, xreadlink, xsetenv, xsize, xstrndup, xstrtod, xstrtoimax, xstrtol, xstrtoumax, yesno">
+    <META NAME="keywords" CONTENT="acl, alloca, allocsa, argmatch, argp, argz, assert, atexit, backupfile, bcopy, binary-io, calloc, canon-host, c-bs-a, c-ctype, chown, cloexec, closeout, copy-file, c-stack, diacrit, dirfd, dirname, dup2, eealloc, error, euidaccess, exclude, execute, exit, exitfail, extensions, fatal, fatal-signal, fileblocks, filemode, file-type, findprog, fnmatch, fnmatch-gnu, fnmatch-posix, fpending, free, fsusage, ftruncate, full-read, full-write, fwriteerror, gcd, getdate, getdomainname, getgroups, gethostname, getline, getloadavg, getndelim2, getnline, getopt, getpagesize, getpass, getpass-gnu, gettext, gettime, gettimeofday, getugroups, getusershell, group-member, hard-locale, hash, hash-pjw, human, iconv, idcache, inttostr, isdir, lchown, linebreak, linebuffer, localcharset, long-options, lstat, makepath, malloc, mathl, mbswidth, md5, memcasecmp, memchr, memcmp, memcoll, memcpy, memmove, mempcpy, memrchr, memset, minmax, mkdir, mkdtemp, mkstemp, mktime, modechange, mountlist, nanosleep, obstack, path-concat, pathmax, pathname, physmem, pipe, poll, posixtm, posixver, progname, putenv, quote, quotearg, readlink, readtokens, readutmp, realloc, regex, rename, restrict, rmdir, rpmatch, safe-read, safe-write, same, save-cwd, savedir, setenv, settime, sha, sig2str, stat, stdbool, stdio-safer, stpcpy, stpncpy, strcase, strchrnul, strcspn, strdup, strerror, strftime, strndup, strnlen, strpbrk, strstr, strtod, strtoimax, strtol, strtoll, strtoul, strtoull, strtoumax, strverscmp, sysexits, timegm, time_r, timespec, tzset, ucs4-utf16, ucs4-utf8, unicodeio, unistd-safer, unlocked-io, userspec, utf16-ucs4, utf8-ucs4, utime, vasnprintf, vasprintf, version-etc, wait-process, xalloc, xallocsa, xgetcwd, xgetdomainname, xgethostname, xmemcoll, xreadlink, xsetenv, xsize, xstrndup, xstrtod, xstrtoimax, xstrtol, xstrtoumax, yesno">
   </HEAD>
   <BODY>
     <H1>Gnulib Module List</H1>
     <H3><A HREF="#ansic_enh_stdlib_memory">Memory management functions &lt;stdlib.h&gt;</A></H3>
     <TABLE>
       <TR WIDTH="100%">
+        <TD ALIGN=LEFT VALIGN=TOP WIDTH="20%"><A HREF="#module=calloc">calloc</A>
+        <TD ALIGN=LEFT VALIGN=TOP WIDTH="80%"><A HREF="http://www.opengroup.org/onlinepubs/007904975/functions/calloc.html">calloc</A>() function that is glibc compatible.
+      </TR>
+      <TR WIDTH="100%">
         <TD ALIGN=LEFT VALIGN=TOP WIDTH="20%"><A HREF="#module=eealloc">eealloc</A>
         <TD ALIGN=LEFT VALIGN=TOP WIDTH="80%">Memory allocation with expensive empty allocations (glibc compatible).
       </TR>
@@ -809,6 +813,10 @@ usually the host name including FQDN.
         <TD ALIGN=LEFT VALIGN=TOP WIDTH="80%">Hierarchical processing of command line arguments.
       </TR>
       <TR WIDTH="100%">
+        <TD ALIGN=LEFT VALIGN=TOP WIDTH="20%"><A HREF="#module=argz">argz</A>
+        <TD ALIGN=LEFT VALIGN=TOP WIDTH="80%">Argv style string arrays in a single null delimited char*.
+      </TR>
+      <TR WIDTH="100%">
         <TD ALIGN=LEFT VALIGN=TOP WIDTH="20%"><A HREF="#module=exitfail">exitfail</A>
         <TD ALIGN=LEFT VALIGN=TOP WIDTH="80%">Set exit status for fatal signal.
       </TR>
@@ -1037,6 +1045,13 @@ variables.
         <TH ALIGN=LEFT>Depends on
       </TR>
       <TR>
+        <TD ALIGN=LEFT VALIGN=TOP><A NAME="module=calloc"></A><A HREF="modules/calloc">calloc</A>
+        <TD ALIGN=LEFT VALIGN=TOP>#include &lt;<A HREF="http://www.opengroup.org/onlinepubs/007904975/basedefs/stdlib.h.html">stdlib.h</A>&gt;
+        <TD ALIGN=LEFT VALIGN=TOP><A HREF="lib/calloc.c">calloc.c</A>
+        <TD ALIGN=LEFT VALIGN=TOP><A HREF="m4/calloc.m4">calloc.m4</A><BR>AC_FUNC_CALLOC
+        <TD ALIGN=LEFT VALIGN=TOP>---
+      </TR>
+      <TR>
         <TD ALIGN=LEFT VALIGN=TOP><A NAME="module=eealloc"></A><A HREF="modules/eealloc">eealloc</A>
         <TD ALIGN=LEFT VALIGN=TOP>#include &lt;eealloc.h&gt;
         <TD ALIGN=LEFT VALIGN=TOP><A HREF="lib/eealloc.h">eealloc.h</A>
@@ -2657,6 +2672,13 @@ variables.
         <TD ALIGN=LEFT VALIGN=TOP>alloca<BR>getopt<BR>strchrnul<BR>sysexits<BR>mempcpy<BR>strndup<BR>restrict<BR>strcase
       </TR>
       <TR>
+        <TD ALIGN=LEFT VALIGN=TOP><A NAME="module=argz"></A><A HREF="modules/argz">argz</A>
+        <TD ALIGN=LEFT VALIGN=TOP>#include &lt;argz.h&gt;
+        <TD ALIGN=LEFT VALIGN=TOP><A HREF="lib/argz_.h">argz_.h</A><BR><A HREF="lib/argz.c">argz.c</A>
+        <TD ALIGN=LEFT VALIGN=TOP><A HREF="m4/argz.m4">argz.m4</A><BR>gl_FUNC_ARGZ
+        <TD ALIGN=LEFT VALIGN=TOP>---
+      </TR>
+      <TR>
         <TD ALIGN=LEFT VALIGN=TOP><A NAME="module=exitfail"></A><A HREF="modules/exitfail">exitfail</A>
         <TD ALIGN=LEFT VALIGN=TOP>#include "<A HREF="lib/exitfail.h">exitfail.h</A>"
         <TD ALIGN=LEFT VALIGN=TOP><A HREF="lib/exitfail.c">exitfail.c</A>
@@ -2783,30 +2805,6 @@ variables.
         <TD ALIGN=LEFT VALIGN=TOP>---
       </TR>
     </TABLE>
-    <H2>Unclassified modules - please update MODULES.html.sh</H2>
-    <TABLE>
-      <TR>
-        <TH ALIGN=LEFT>modules/
-        <TH ALIGN=LEFT>lib/
-        <TH ALIGN=LEFT>lib/
-        <TH ALIGN=LEFT>m4/
-        <TH ALIGN=LEFT>&nbsp;
-      </TR>
-      <TR>
-        <TH ALIGN=LEFT>Module
-        <TH ALIGN=LEFT>Header
-        <TH ALIGN=LEFT>Implementation
-        <TH ALIGN=LEFT>Autoconf macro
-        <TH ALIGN=LEFT>Depends on
-      </TR>
-      <TR>
-        <TD ALIGN=LEFT VALIGN=TOP><A NAME="module=calloc"></A><A HREF="modules/calloc">calloc</A>
-        <TD ALIGN=LEFT VALIGN=TOP>#include &lt;<A HREF="http://www.opengroup.org/onlinepubs/007904975/basedefs/stdlib.h.html">stdlib.h</A>&gt;
-        <TD ALIGN=LEFT VALIGN=TOP><A HREF="lib/calloc.c">calloc.c</A>
-        <TD ALIGN=LEFT VALIGN=TOP><A HREF="m4/calloc.m4">calloc.m4</A><BR>AC_FUNC_CALLOC
-        <TD ALIGN=LEFT VALIGN=TOP>---
-      </TR>
-    </TABLE>
     <H2>Lone files - please create new modules containing them</H2>
     <PRE>
 <A HREF="lib/progreloc.c">lib/progreloc.c</A>
@@ -2842,6 +2840,6 @@ variables.
       <LI>A testsuite
     </UL>
     <HR>
-    Generated from <CODE>MODULES.html.sh</CODE> on 14 June 2004.
+    Generated from <CODE>MODULES.html.sh</CODE> on 22 June 2004.
   </BODY>
 </HTML>
index fa65b0f..cf222da 100755 (executable)
@@ -1904,6 +1904,7 @@ func_all_modules ()
 
   func_begin_table
   func_module argp
+  func_module argz
   func_module exitfail
   func_module c-stack
   func_module error
index 05bad02..915139b 100644 (file)
@@ -1,3 +1,10 @@
+2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * srclist-update: Don't insist on "USA." before the close-comment,
+       as libtool omits the period and puts the */ on a separate line.
+       * srclist.txt: Add argz.c, argz_.h, argz.m4.
+       * srclistvars.sh: Add LIBTOOL (for eggert only).
+
 2004-05-18  Karl Berry  <karl@gnu.org>
 
        * srclist.txt: break link for vasnprintf.c.
index 0ca4204..a77e0e0 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: srclist-update,v 1.14 2003-08-15 18:04:34 eggert Exp $
+# $Id: srclist-update,v 1.15 2004-06-22 18:28:25 eggert Exp $
 #
 # Check for files in directory $1 being up to date, according to the
 # list on stdin.  Don't actually make any changes, just show the diffs.
@@ -58,7 +58,7 @@ fixlicense='
 #   with this program; if not, write to the Free Software Foundation,\
 #   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-  /Th[ei][ s].* is free software/,/USA\.  *\*\//c\
+  /Th[ei][ s].* is free software/,/\*\//c\
    This program is free software; you can redistribute it and/or modify\
    it under the terms of the GNU General Public License as published by\
    the Free Software Foundation; either version 2, or (at your option)\
index 2b10c3d..26cf7a1 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: srclist.txt,v 1.39 2004-05-18 12:22:41 karl Exp $
+# $Id: srclist.txt,v 1.40 2004-06-22 18:28:25 eggert Exp $
 # Files for which we are not the source.  See ./srclistvars.sh for the
 # variable definitions.
 
@@ -173,3 +173,7 @@ $LIBCSRC/sysdeps/generic/strtoul.c  lib gpl
 #$LIBCSRC/sysdeps/unix/sysv/gethostname.c      lib gpl
 #$LIBCSRC/sysdeps/unix/mkdir.c                 lib gpl
 #$LIBCSRC/sysdeps/unix/utime.c                 lib gpl
+
+$LIBTOOL/libltdl/argz.c                                lib gpl
+$LIBTOOL/libltdl/argz_.h                       lib gpl
+$LIBTOOL/m4/argz.m4                            m4
index 489f120..d65743d 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: srclistvars.sh,v 1.15 2004-03-09 19:42:23 eggert Exp $
+# $Id: srclistvars.sh,v 1.16 2004-06-22 18:28:25 eggert Exp $
 # Variables for srclist-update and srclist.txt.
 # Will change for each user.
 
@@ -10,6 +10,7 @@ eggert)
   : ${GNUCONFIG=../config}
   : ${GNUORG=../gnuorg}
   : ${GNUWWWLICENSES=$GNUORG}
+  : ${LIBTOOL=../libtool}
   : ${LIBCSRC=../libc}
   : ${TEXINFOSRC=../texinfo}
   ;;
index 881a33b..7950340 100644 (file)
@@ -1,3 +1,7 @@
+2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * argz.c, argz_.h: New files, which are autoupdated from libtool.
+
 2004-06-01  Jim Meyering  <jim@meyering.net>
 
        * calloc.c: New file.
diff --git a/lib/argz.c b/lib/argz.c
new file mode 100644 (file)
index 0000000..cfa0829
--- /dev/null
@@ -0,0 +1,227 @@
+/* argz.c -- argz implementation for non-glibc systems
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   Originally by Gary V. Vaughan  <gary@gnu.org>
+
+   NOTE: The canonical source of this file is maintained with the
+   GNU Libtool package.  Report bugs to bug-libtool@gnu.org.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* Provide our wierdo HAVE_CONFIG_H rvalue for other clients.  */
+#if !defined(LTDL) && defined(HAVE_CONFIG_H)
+#  define HAVE_CONFIG_H <config.h>
+#endif
+
+#if defined(HAVE_CONFIG_H)
+#  include HAVE_CONFIG_H
+#endif
+
+#include <argz.h>
+
+#include <assert.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <errno.h>
+
+#if defined(HAVE_STRING_H)
+#  include <string.h>
+#elif defined(HAVE_STRINGS_H)
+#  include <strings.h>
+#endif
+#if defined(HAVE_MEMORY_H)
+#  include <memory.h>
+#endif
+
+#define EOS_CHAR '\0'
+
+error_t
+argz_append (char **pargz, size_t *pargz_len, const char *buf, size_t buf_len)
+{
+  size_t argz_len;
+  char  *argz;
+
+  assert (pargz);
+  assert (pargz_len);
+  assert ((*pargz && *pargz_len) || (!*pargz && !*pargz_len));
+
+  /* If nothing needs to be appended, no more work is required.  */
+  if (buf_len == 0)
+    return 0;
+
+  /* Ensure there is enough room to append BUF_LEN.  */
+  argz_len = *pargz_len + buf_len;
+  argz = (char *) realloc (*pargz, argz_len);
+  if (!argz)
+    return ENOMEM;
+
+  /* Copy characters from BUF after terminating '\0' in ARGZ.  */
+  memcpy (argz + *pargz_len, buf, buf_len);
+
+  /* Assign new values.  */
+  *pargz = argz;
+  *pargz_len = argz_len;
+
+  return 0;
+}
+
+
+error_t
+argz_create_sep (const char *str, int delim, char **pargz, size_t *pargz_len)
+{
+  size_t argz_len;
+  char *argz = 0;
+
+  assert (str);
+  assert (pargz);
+  assert (pargz_len);
+
+  /* Make a copy of STR, but replacing each occurence of
+     DELIM with '\0'.  */
+  argz_len = 1+ strlen (str);
+  if (argz_len)
+    {
+      const char *p;
+      char *q;
+
+      argz = (char *) malloc (argz_len);
+      if (!argz)
+       return ENOMEM;
+
+      for (p = str, q = argz; *p != EOS_CHAR; ++p)
+       {
+         if (*p == delim)
+           {
+             /* Ignore leading delimiters, and fold consecutive
+                delimiters in STR into a single '\0' in ARGZ.  */
+             if ((q > argz) && (q[-1] != EOS_CHAR))
+               *q++ = EOS_CHAR;
+             else
+               --argz_len;
+           }
+         else
+           *q++ = *p;
+       }
+      /* Copy terminating EOS_CHAR.  */
+      *q = *p;
+    }
+
+  /* If ARGZ_LEN has shrunk to nothing, release ARGZ's memory.  */
+  if (!argz_len)
+    argz = (free (argz), (char *) 0);
+
+  /* Assign new values.  */
+  *pargz = argz;
+  *pargz_len = argz_len;
+
+  return 0;
+}
+
+
+error_t
+argz_insert (char **pargz, size_t *pargz_len, char *before, const char *entry)
+{
+  assert (pargz);
+  assert (pargz_len);
+  assert (entry && *entry);
+
+  /* No BEFORE address indicates ENTRY should be inserted after the
+     current last element.  */
+  if (!before)
+    return argz_append (pargz, pargz_len, entry, 1+ strlen (entry));
+
+  /* This probably indicates a programmer error, but to preserve
+     semantics, scan back to the start of an entry if BEFORE points
+     into the middle of it.  */
+  while ((before > *pargz) && (before[-1] != EOS_CHAR))
+    --before;
+
+  {
+    size_t entry_len   = 1+ strlen (entry);
+    size_t argz_len    = *pargz_len + entry_len;
+    size_t offset      = before - *pargz;
+    char   *argz       = (char *) realloc (*pargz, argz_len);
+
+    if (!argz)
+      return ENOMEM;
+
+    /* Make BEFORE point to the equivalent offset in ARGZ that it
+       used to have in *PARGZ incase realloc() moved the block.  */
+    before = argz + offset;
+
+    /* Move the ARGZ entries starting at BEFORE up into the new
+       space at the end -- making room to copy ENTRY into the
+       resulting gap.  */
+    memmove (before + entry_len, before, *pargz_len - offset);
+    memcpy  (before, entry, entry_len);
+
+    /* Assign new values.  */
+    *pargz = argz;
+    *pargz_len = argz_len;
+  }
+
+  return 0;
+}
+
+
+char *
+argz_next (char *argz, size_t argz_len, const char *entry)
+{
+  assert ((argz && argz_len) || (!argz && !argz_len));
+
+  if (entry)
+    {
+      /* Either ARGZ/ARGZ_LEN is empty, or ENTRY points into an address
+        within the ARGZ vector.  */
+      assert ((!argz && !argz_len)
+             || ((argz <= entry) && (entry < (argz + argz_len))));
+
+      /* Move to the char immediately after the terminating
+        '\0' of ENTRY.  */
+      entry = 1+ strchr (entry, EOS_CHAR);
+
+      /* Return either the new ENTRY, or else NULL if ARGZ is
+        exhausted.  */
+      return (entry >= argz + argz_len) ? 0 : (char *) entry;
+    }
+  else
+    {
+      /* This should probably be flagged as a programmer error,
+        since starting an argz_next loop with the iterator set
+        to ARGZ is safer.  To preserve semantics, handle the NULL
+        case by returning the start of ARGZ (if any).  */
+      if (argz_len > 0)
+       return argz;
+      else
+       return 0;
+    }
+}
+
+
+void
+argz_stringify (char *argz, size_t argz_len, int sep)
+{
+  assert ((argz && argz_len) || (!argz && !argz_len));
+
+  if (sep)
+    {
+      --argz_len;              /* don't stringify the terminating EOS */
+      while (--argz_len > 0)
+       {
+         if (argz[argz_len] == EOS_CHAR)
+           argz[argz_len] = sep;
+       }
+    }
+}
diff --git a/lib/argz_.h b/lib/argz_.h
new file mode 100644 (file)
index 0000000..423a071
--- /dev/null
@@ -0,0 +1,49 @@
+/* lt__argz.h -- internal argz interface for non-glibc systems
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   Originally by Gary V. Vaughan  <gary@gnu.org>
+
+   NOTE: The canonical source of this file is maintained with the
+   GNU Libtool package.  Report bugs to bug-libtool@gnu.org.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#if !defined(LT__ARGZ_H)
+#define LT__ARGZ_H 1
+
+#include <stdlib.h>
+#include <sys/types.h>
+
+#if defined(LTDL)
+#  include "lt__glibc.h"
+#endif
+
+#if defined(_cplusplus)
+extern "C" {
+#endif
+
+error_t        argz_append     (char **pargz, size_t *pargz_len,
+                        const char *buf, size_t buf_len);
+error_t        argz_create_sep (const char *str, int delim,
+                        char **pargz, size_t *pargz_len);
+error_t        argz_insert     (char **pargz, size_t *pargz_len,
+                        char *before, const char *entry);
+char * argz_next       (char *argz, size_t argz_len, const char *entry);
+void   argz_stringify  (char *argz, size_t argz_len, int sep);
+
+#if defined(_cplusplus)
+}
+#endif
+
+#endif /*!defined(LT__ARGZ_H)*/
index 86cfac1..fedc0f7 100644 (file)
@@ -1,3 +1,7 @@
+2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * argz.m4: New file, which is autoupdated from libtool.
+
 2004-06-01  Jim Meyering  <jim@meyering.net>
 
        * calloc.m4: New file.
diff --git a/m4/argz.m4 b/m4/argz.m4
new file mode 100644 (file)
index 0000000..66f3bc1
--- /dev/null
@@ -0,0 +1,43 @@
+# Portability macros for glibc argz.                    -*- Autoconf -*-
+# Written by Gary V. Vaughan <gary@gnu.org>
+
+# Copyright (C) 2004  Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 1
+
+AC_DEFUN([gl_FUNC_ARGZ],
+[gl_PREREQ_ARGZ
+
+AC_CHECK_HEADERS([argz.h], [], [], [AC_INCLUDES_DEFAULT])
+
+AC_CHECK_TYPES([error_t],
+  [],
+  [AC_DEFINE([error_t], [int],
+   [Define to a type to use for `error_t' if it is not otherwise available.])],
+  [#if defined(HAVE_ARGZ_H)
+#  include <argz.h>
+#endif])
+
+ARGZ_H=
+AC_CHECK_FUNCS([argz_append argz_create_sep argz_insert argz_next \
+       argz_stringify], [], [ARGZ_H=argz.h; AC_LIBOBJ([argz])])
+AC_SUBST([ARGZ_H])
+])
+
+# Prerequisites of lib/argz.c.
+AC_DEFUN([gl_PREREQ_ARGZ], [:])
diff --git a/modules/argz b/modules/argz
new file mode 100644 (file)
index 0000000..5f59ae6
--- /dev/null
@@ -0,0 +1,30 @@
+Description:
+Argv style string arrays in a single null delimited char*.
+
+Files:
+lib/argz_.h
+lib/argz.c
+m4/argz.m4
+
+Depends-on:
+
+configure.ac:
+gl_FUNC_ARGZ
+
+Makefile.am:
+BUILT_SOURCES += $(ARGZ_H)
+EXTRA_DIST += argz_.h
+
+# We need the following in order to create an <argz.h> when the system
+# doesn't have one that works with the given compiler.
+all-local $(lib_OBJECTS): $(ARGZ_H)
+argz.h: argz_.h
+       cp $(srcdir)/argz_.h $@-t
+       mv $@-t $@
+MOSTLYCLEANFILES += argz.h argz.h-t
+
+Include:
+<argz.h>
+
+Maintainer:
+bug-libtool@gnu.org