Mercurial > hg > octave-nkf > gnulib-hg
changeset 8198:d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 19 Feb 2007 00:08:40 +0000 |
parents | 7a8074237307 |
children | 51d32a83a7df |
files | ChangeLog lib/getsubopt.c lib/getsubopt.h lib/stdlib_.h m4/getsubopt.m4 m4/stdlib_h.m4 modules/getsubopt modules/stdlib |
diffstat | 8 files changed, 60 insertions(+), 52 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2007-02-18 Bruno Haible <bruno@clisp.org> + + * 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. + 2007-02-18 Bruno Haible <bruno@clisp.org> * modules/fchdir (Depends-on): Add dup2.
--- a/lib/getsubopt.c +++ b/lib/getsubopt.c @@ -1,4 +1,4 @@ -/* Parse comma separate list into words. +/* 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 <drepper@cygnus.com>, 1996. @@ -19,7 +19,6 @@ #if !_LIBC # include <config.h> -# include "getsubopt.h" #endif #include <stdlib.h>
deleted file mode 100644 --- a/lib/getsubopt.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Parse comma separate list into words. - Copyright (C) 2004-2005 Free Software Foundation, Inc. - Contributed by Simon Josefsson <jas@extundo.com>, 2004. - - 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* 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 HAVE_GETSUBOPT - -/* Get getsubopt declaration. */ -#include <stdlib.h> - -#else - -extern int getsubopt (char **optionp, char *const *tokens, char **valuep); - -#endif
--- a/lib/stdlib_.h +++ b/lib/stdlib_.h @@ -44,6 +44,30 @@ #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 !@HAVE_GETSUBOPT@ +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 !@HAVE_MKDTEMP@ /* Create a unique temporary directory from TEMPLATE. @@ -61,6 +85,7 @@ mkdtemp (t)) #endif + #if @GNULIB_MKSTEMP@ # if @REPLACE_MKSTEMP@ /* Create a unique temporary file from TEMPLATE.
--- a/m4/getsubopt.m4 +++ b/m4/getsubopt.m4 @@ -1,5 +1,5 @@ -# getsubopt.m4 serial 2 -dnl Copyright (C) 2004 Free Software Foundation, Inc. +# 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,8 +9,11 @@ dnl Persuade glibc <stdlib.h> to declare getsubopt(). AC_REQUIRE([AC_GNU_SOURCE]) - AC_REPLACE_FUNCS(getsubopt) + 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 ])
--- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -21,9 +21,11 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], [ - GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) - GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) + 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_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) - REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) + HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) + HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) + REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) ])
--- a/modules/getsubopt +++ b/modules/getsubopt @@ -1,21 +1,22 @@ Description: -getsubopt: Parse comma separate list into words. +getsubopt: Parse comma separated list into words. Files: -lib/getsubopt.h lib/getsubopt.c m4/getsubopt.m4 Depends-on: strchrnul +stdlib configure.ac: gl_FUNC_GETSUBOPT +gl_STDLIB_MODULE_INDICATOR([getsubopt]) Makefile.am: Include: -"getsubopt.h" +<stdlib.h> License: LGPL
--- a/modules/stdlib +++ b/modules/stdlib @@ -21,8 +21,10 @@ rm -f $@-t $@ { 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)' \