Mercurial > hg > octave-lyh > gnulib-hg
changeset 10666:d162e4057aa8
Add getusershell(), setusershell(), endusershell() declarations to <unistd.h>.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 19 Oct 2008 13:07:15 +0200 |
parents | 5394a3a10398 |
children | 678640901735 |
files | ChangeLog lib/getusershell.c lib/unistd.in.h m4/getusershell.m4 m4/unistd_h.m4 modules/getusershell modules/unistd |
diffstat | 7 files changed, 71 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2008-10-18 Bruno Haible <bruno@clisp.org> + + Add getusershell(), setusershell(), endusershell() declarations to + <unistd.h>. + * lib/unistd.in.h (getusershell, setusershell, endusershell): New + declarations. + * lib/getusershell.c: Include unistd.h. + * m4/getusershell.m4 (gl_FUNC_GETUSERSHELL): Require + gl_UNISTD_H_DEFAULTS and AC_USE_SYSTEM_EXTENSIONS. Set + HAVE_GETUSERSHELL. + * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_GETUSERSHELL + and HAVE_GETUSERSHELL. + * modules/getusershell (Depends-on): Add unistd, extensions. + (configure.ac): Invoke gl_UNISTD_MODULE_INDICATOR. + (Include): Specify <unistd.h>. + * modules/unistd (Makefile.am): Substitute GNULIB_GETUSERSHELL and + HAVE_GETUSERSHELL. + 2008-10-18 Bruno Haible <bruno@clisp.org> Add a getloadavg() declaration to <stdlib.h>.
--- a/lib/getusershell.c +++ b/lib/getusershell.c @@ -1,6 +1,6 @@ /* getusershell.c -- Return names of valid user shells. - Copyright (C) 1991, 1997, 2000, 2001, 2003, 2004, 2005, 2006 Free + Copyright (C) 1991, 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -20,6 +20,9 @@ #include <config.h> +/* Specification. */ +#include <unistd.h> + #ifndef SHELLS_FILE # ifndef __DJGPP__ /* File containing a list of nonrestricted shells, one per line. */
--- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -353,6 +353,36 @@ #endif +#if @GNULIB_GETUSERSHELL@ +# if !@HAVE_GETUSERSHELL@ +/* Return the next valid login shell on the system, or NULL when the end of + the list has been reached. */ +extern char *getusershell (void); +/* Rewind to pointer that is advanced at each getusershell() call. */ +extern void setusershell (void); +/* Free the pointer that is advanced at each getusershell() call and + associated resources. */ +extern void endusershell (void); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getusershell +# define getusershell() \ + (GL_LINK_WARNING ("getusershell is unportable - " \ + "use gnulib module getusershell for portability"), \ + getusershell ()) +# undef setusershell +# define setusershell() \ + (GL_LINK_WARNING ("setusershell is unportable - " \ + "use gnulib module getusershell for portability"), \ + setusershell ()) +# undef endusershell +# define endusershell() \ + (GL_LINK_WARNING ("endusershell is unportable - " \ + "use gnulib module getusershell for portability"), \ + endusershell ()) +#endif + + #if @GNULIB_LCHOWN@ # if @REPLACE_LCHOWN@ /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
--- a/m4/getusershell.m4 +++ b/m4/getusershell.m4 @@ -1,10 +1,18 @@ -# getusershell.m4 serial 4 -dnl Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc. +# getusershell.m4 serial 5 +dnl Copyright (C) 2002, 2003, 2006, 2008 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. AC_DEFUN([gl_FUNC_GETUSERSHELL], [ - AC_REPLACE_FUNCS(getusershell) + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + + dnl Persuade glibc <unistd.h> to declare {get,set,end}usershell(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_REPLACE_FUNCS([getusershell]) + if test $ac_cv_func_getusershell = no; then + HAVE_GETUSERSHELL=0 + fi ])
--- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -45,6 +45,7 @@ GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) + GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) @@ -59,6 +60,7 @@ HAVE_GETDOMAINNAME=1; AC_SUBST([HAVE_GETDOMAINNAME]) HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) + HAVE_GETUSERSHELL=1; AC_SUBST([HAVE_GETUSERSHELL]) HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON])
--- a/modules/getusershell +++ b/modules/getusershell @@ -6,15 +6,19 @@ m4/getusershell.m4 Depends-on: +unistd +extensions fopen-safer xalloc configure.ac: gl_FUNC_GETUSERSHELL +gl_UNISTD_MODULE_INDICATOR([getusershell]) Makefile.am: Include: +<unistd.h> License: GPL
--- a/modules/unistd +++ b/modules/unistd @@ -37,6 +37,7 @@ -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \ -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ + -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \ -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ @@ -50,6 +51,7 @@ -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \ -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ + -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \ -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \