bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new module stdlib


From: Bruno Haible
Subject: Re: new module stdlib
Date: Mon, 19 Feb 2007 01:16:38 +0100
User-agent: KMail/1.5.4

The module 'getsubopt' also belongs to the acquaintances of stdlib.h.
I'm applying this:

2007-02-18  Bruno Haible  <address@hidden>

        * lib/stdlib_.h (getsubopt): New declaration, copied from getsubopt.h.
        * modules/stdlib (stdlib.h): Also substitute GNULIB_GETSUBOPT and
        HAVE_GETSUBOPT.
        * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Also initialize
        GNULIB_GETSUBOPT and HAVE_GETSUBOPT.
        * lib/getsubopt.h: Remove file.
        * modules/getsubopt (Files): Remove lib/getsubopt.h.
        (Depends-on): Add stdlib.
        (configure.ac): Invoke gl_STDLIB_MODULE_INDICATOR.
        (Includes): Use <stdlib.h> instead of getsubopt.h.
        * m4/getsubopt.m4 (gl_FUNC_GETSUBOPT): Require gl_STDLIB_H_DEFAULTS.
        Set HAVE_GETSUBOPT.
        * lib/getsubopt.c: Don't include getsubopt.h.

*** lib/getsubopt.c     5 Feb 2007 05:44:11 -0000       1.5
--- lib/getsubopt.c     18 Feb 2007 23:54:31 -0000
***************
*** 1,4 ****
! /* Parse comma separate list into words.
     Copyright (C) 1996, 1997, 1999, 2004, 2007 Free Software Foundation, Inc.
     This file is part of the GNU C Library.
     Contributed by Ulrich Drepper <address@hidden>, 1996.
--- 1,4 ----
! /* Parse comma separated list into words.
     Copyright (C) 1996, 1997, 1999, 2004, 2007 Free Software Foundation, Inc.
     This file is part of the GNU C Library.
     Contributed by Ulrich Drepper <address@hidden>, 1996.
***************
*** 19,25 ****
  
  #if !_LIBC
  # include <config.h>
- # include "getsubopt.h"
  #endif
  
  #include <stdlib.h>
--- 19,24 ----
*** lib/stdlib_.h       18 Feb 2007 20:55:53 -0000      1.2
--- lib/stdlib_.h       18 Feb 2007 23:54:31 -0000
***************
*** 44,49 ****
--- 44,73 ----
  #endif
  
  
+ #if @GNULIB_GETSUBOPT@
+ /* Assuming *OPTIONP is a comma separated list of elements of the form
+    "token" or "token=value", getsubopt parses the first of these elements.
+    If the first element refers to a "token" that is member of the given
+    NULL-terminated array of tokens:
+      - It replaces the comma with a NUL byte, updates *OPTIONP to point past
+        the first option and the comma, sets *VALUEP to the value of the
+        element (or NULL if it doesn't contain an "=" sign),
+      - It returns the index of the "token" in the given array of tokens.
+    Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
+    For more details see the POSIX:2001 specification.
+    http://www.opengroup.org/susv3xsh/getsubopt.html */
+ # if address@hidden@
+ extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
+ # endif
+ #elif defined GNULIB_POSIXCHECK
+ # undef getsubopt
+ # define getsubopt(o,t,v) \
+     (GL_LINK_WARNING ("getsubopt is unportable - "\
+                       "use gnulib module getsubopt for portability"), \
+      getsubopt (o, t, v))
+ #endif
+ 
+ 
  #if @GNULIB_MKDTEMP@
  # if address@hidden@
  /* Create a unique temporary directory from TEMPLATE.
***************
*** 61,66 ****
--- 85,91 ----
       mkdtemp (t))
  #endif
  
+ 
  #if @GNULIB_MKSTEMP@
  # if @REPLACE_MKSTEMP@
  /* Create a unique temporary file from TEMPLATE.
*** modules/getsubopt   13 Oct 2006 12:40:23 -0000      1.4
--- modules/getsubopt   18 Feb 2007 23:54:31 -0000
***************
*** 1,21 ****
  Description:
! getsubopt: Parse comma separate list into words.
  
  Files:
- lib/getsubopt.h
  lib/getsubopt.c
  m4/getsubopt.m4
  
  Depends-on:
  strchrnul
  
  configure.ac:
  gl_FUNC_GETSUBOPT
  
  Makefile.am:
  
  Include:
! "getsubopt.h"
  
  License:
  LGPL
--- 1,22 ----
  Description:
! getsubopt: Parse comma separated list into words.
  
  Files:
  lib/getsubopt.c
  m4/getsubopt.m4
  
  Depends-on:
  strchrnul
+ stdlib
  
  configure.ac:
  gl_FUNC_GETSUBOPT
+ gl_STDLIB_MODULE_INDICATOR([getsubopt])
  
  Makefile.am:
  
  Include:
! <stdlib.h>
  
  License:
  LGPL
*** modules/stdlib      18 Feb 2007 15:39:54 -0000      1.1
--- modules/stdlib      18 Feb 2007 23:54:31 -0000
***************
*** 21,28 ****
--- 21,30 ----
        rm -f address@hidden $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''ABSOLUTE_STDLIB_H''@|$(ABSOLUTE_STDLIB_H)|g' \
+             -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
              -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
              -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
+             -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
              -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
*** m4/getsubopt.m4     23 Jan 2005 08:06:57 -0000      1.2
--- m4/getsubopt.m4     18 Feb 2007 23:54:31 -0000
***************
*** 1,5 ****
! # getsubopt.m4 serial 2
! dnl Copyright (C) 2004 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
  dnl with or without modifications, as long as this notice is preserved.
--- 1,5 ----
! # getsubopt.m4 serial 3
! dnl Copyright (C) 2004, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
  dnl with or without modifications, as long as this notice is preserved.
***************
*** 9,16 ****
    dnl Persuade glibc <stdlib.h> to declare getsubopt().
    AC_REQUIRE([AC_GNU_SOURCE])
  
!   AC_REPLACE_FUNCS(getsubopt)
    if test $ac_cv_func_getsubopt = no; then
      gl_PREREQ_GETSUBOPT
    fi
  ])
--- 9,19 ----
    dnl Persuade glibc <stdlib.h> to declare getsubopt().
    AC_REQUIRE([AC_GNU_SOURCE])
  
!   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
!   AC_CHECK_FUNCS_ONCE([getsubopt])
    if test $ac_cv_func_getsubopt = no; then
+     HAVE_GETSUBOPT=0
+     AC_LIBOBJ([getsubopt])
      gl_PREREQ_GETSUBOPT
    fi
  ])
*** m4/stdlib_h.m4      18 Feb 2007 15:39:54 -0000      1.1
--- m4/stdlib_h.m4      18 Feb 2007 23:54:31 -0000
***************
*** 21,29 ****
  
  AC_DEFUN([gl_STDLIB_H_DEFAULTS],
  [
!   GNULIB_MKDTEMP=0;  AC_SUBST([GNULIB_MKDTEMP])
!   GNULIB_MKSTEMP=0;  AC_SUBST([GNULIB_MKSTEMP])
    dnl Assume proper GNU behavior unless another module says otherwise.
!   HAVE_MKDTEMP=1;    AC_SUBST([HAVE_MKDTEMP])
!   REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
  ])
--- 21,31 ----
  
  AC_DEFUN([gl_STDLIB_H_DEFAULTS],
  [
!   GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT])
!   GNULIB_MKDTEMP=0;   AC_SUBST([GNULIB_MKDTEMP])
!   GNULIB_MKSTEMP=0;   AC_SUBST([GNULIB_MKSTEMP])
    dnl Assume proper GNU behavior unless another module says otherwise.
!   HAVE_GETSUBOPT=1;   AC_SUBST([HAVE_GETSUBOPT])
!   HAVE_MKDTEMP=1;     AC_SUBST([HAVE_MKDTEMP])
!   REPLACE_MKSTEMP=0;  AC_SUBST([REPLACE_MKSTEMP])
  ])





reply via email to

[Prev in Thread] Current Thread [Next in Thread]