Mercurial > hg > octave-nkf > gnulib-hg
changeset 10661:65c9436dc0d3
Move the getdomainname() declaration to <unistd.h>.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 19 Oct 2008 03:36:00 +0200 |
parents | 233e9f6eb098 |
children | ad36db29dad7 |
files | ChangeLog NEWS lib/getdomainname.c lib/getdomainname.h lib/unistd.in.h lib/xgetdomainname.c m4/getdomainname.m4 m4/unistd_h.m4 modules/getdomainname modules/unistd |
diffstat | 10 files changed, 69 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2008-10-18 Bruno Haible <bruno@clisp.org> + + * lib/xgetdomainname.c: Include <unistd.h> instead of getdomainname.h. + + Move the getdomainname() declaration to <unistd.h>. + * lib/getdomainname.h: Remove file. + * lib/unistd.in.h (getdomainname): New declaration. + * lib/getdomainname.c: Include <unistd.h> instead of getdomainname.h. + * m4/getdomainname.m4 (gl_FUNC_GETDOMAINNAME): Require + gl_UNISTD_H_DEFAULTS and AC_USE_SYSTEM_EXTENSIONS. Set + HAVE_GETDOMAINNAME. + * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize + GNULIB_GETDOMAINNAME and HAVE_GETDOMAINNAME. + * modules/getdomainname (Files): Remove lib/getdomainname.h. + (Depends-on): Add unistd, extensions. + (configure.ac): Invoke gl_UNISTD_MODULE_INDICATOR. + (Includes): Specify <unistd.h> instead of getdomainname.h. + * modules/unistd (Makefile.am): Substitute GNULIB_GETDOMAINNAME and + HAVE_GETDOMAINNAME. + * NEWS: Mention the change. + 2008-10-18 Bruno Haible <bruno@clisp.org> * modules/dirent: New file.
--- a/NEWS +++ b/NEWS @@ -6,6 +6,9 @@ Date Modules Changes +2008-10-18 getdomainname The include file is changed from "getdomainname.h" + to <unistd.h>. + 2008-09-28 sockets When using this module, you now need to link with $(LIBSOCKET).
--- a/lib/getdomainname.c +++ b/lib/getdomainname.c @@ -1,6 +1,6 @@ /* getdomainname emulation for systems that doesn't have it. - Copyright (C) 2003, 2006 Free Software Foundation, Inc. + Copyright (C) 2003, 2006, 2008 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 @@ -20,7 +20,7 @@ #include <config.h> /* Specification. */ -#include "getdomainname.h" +#include <unistd.h> #include <string.h> #include <errno.h>
deleted file mode 100644 --- a/lib/getdomainname.h +++ /dev/null @@ -1,43 +0,0 @@ -/* getdomainname - Return the NIS domain name. - Copyright (C) 2003 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */ - -#ifndef _GETDOMAINNAME_H -#define _GETDOMAINNAME_H - -#if HAVE_GETDOMAINNAME - -/* Get getdomainname() declaration. */ -# include <unistd.h> - -#else - -# include <stddef.h> - -/* Return the NIS domain name of the machine. - WARNING! The NIS domain name is unrelated to the fully qualified host name - of the machine. It is also unrelated to email addresses. - WARNING! The NIS domain name is usually the empty string or "(none)" when - not using NIS. - - Put up to LEN bytes of the NIS domain name into NAME. - Null terminate it if the name is shorter than LEN. - If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. - Return 0 if successful, otherwise set errno and return -1. */ -extern int getdomainname(char *name, size_t len); - -#endif /* HAVE_GETDOMAINNAME */ - -#endif /* _GETDOMAINNAME_H */
--- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -1,5 +1,5 @@ /* Substitute for and wrapper around <unistd.h>. - Copyright (C) 2004-2008 Free Software Foundation, Inc. + Copyright (C) 2003-2008 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 @@ -220,6 +220,29 @@ #endif +#if @GNULIB_GETDOMAINNAME@ +/* Return the NIS domain name of the machine. + WARNING! The NIS domain name is unrelated to the fully qualified host name + of the machine. It is also unrelated to email addresses. + WARNING! The NIS domain name is usually the empty string or "(none)" when + not using NIS. + + Put up to LEN bytes of the NIS domain name into NAME. + Null terminate it if the name is shorter than LEN. + If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. + Return 0 if successful, otherwise set errno and return -1. */ +# if !@HAVE_GETDOMAINNAME@ +extern int getdomainname(char *name, size_t len); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getdomainname +# define getdomainname(n,l) \ + (GL_LINK_WARNING ("getdomainname is unportable - " \ + "use gnulib module getdomainname for portability"), \ + getdomainname (n, l)) +#endif + + #if @GNULIB_GETDTABLESIZE@ # if !@HAVE_GETDTABLESIZE@ /* Return the maximum number of file descriptors in the current process. */
--- a/lib/xgetdomainname.c +++ b/lib/xgetdomainname.c @@ -1,5 +1,5 @@ /* xgetdomainname.c -- Return the NIS domain name, without size limitations. - Copyright (C) 1992, 1996, 2000, 2001, 2003, 2004, 2006 Free Software + Copyright (C) 1992, 1996, 2000-2001, 2003-2004, 2006, 2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -23,7 +23,7 @@ #include "xgetdomainname.h" /* Get getdomainname. */ -#include "getdomainname.h" +#include <unistd.h> /* Get errno. */ #include <errno.h>
--- a/m4/getdomainname.m4 +++ b/m4/getdomainname.m4 @@ -1,13 +1,19 @@ -# getdomainname.m4 serial 2 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# getdomainname.m4 serial 3 +dnl Copyright (C) 2002-2003, 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_GETDOMAINNAME], [ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + + dnl Persuade glibc <unistd.h> to declare getdomainname(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_REPLACE_FUNCS(getdomainname) if test $ac_cv_func_getdomainname = no; then + HAVE_GETDOMAINNAME=0 gl_PREREQ_GETDOMAINNAME fi ])
--- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 14 +# unistd_h.m4 serial 15 dnl Copyright (C) 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, @@ -40,6 +40,7 @@ GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) + GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) @@ -53,6 +54,7 @@ HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) + HAVE_GETDOMAINNAME=1; AC_SUBST([HAVE_GETDOMAINNAME]) HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) HAVE_READLINK=1; AC_SUBST([HAVE_READLINK])
--- a/modules/getdomainname +++ b/modules/getdomainname @@ -2,19 +2,21 @@ getdomainname() function: Return machine's NIS domain name. Files: -lib/getdomainname.h lib/getdomainname.c m4/getdomainname.m4 Depends-on: +unistd +extensions configure.ac: gl_FUNC_GETDOMAINNAME +gl_UNISTD_MODULE_INDICATOR([getdomainname]) Makefile.am: Include: -"getdomainname.h" +<unistd.h> License: GPL
--- a/modules/unistd +++ b/modules/unistd @@ -32,6 +32,7 @@ -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \ -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ + -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \ -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \ -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ @@ -44,6 +45,7 @@ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ + -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \ -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \