From: Bruno Haible Date: Sun, 19 Oct 2008 01:36:00 +0000 (+0200) Subject: Move the getdomainname() declaration to . X-Git-Tag: v0.1~6824 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=977cc95fb20fde55a8ce6654397e7ca56f6c6792;p=gnulib.git Move the getdomainname() declaration to . --- diff --git a/ChangeLog b/ChangeLog index 7ca0aae5a..21dbe3cc9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,26 @@ 2008-10-18 Bruno Haible + * lib/xgetdomainname.c: Include instead of getdomainname.h. + + Move the getdomainname() declaration to . + * lib/getdomainname.h: Remove file. + * lib/unistd.in.h (getdomainname): New declaration. + * lib/getdomainname.c: Include 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 instead of getdomainname.h. + * modules/unistd (Makefile.am): Substitute GNULIB_GETDOMAINNAME and + HAVE_GETDOMAINNAME. + * NEWS: Mention the change. + +2008-10-18 Bruno Haible + * modules/dirent: New file. * m4/dirent_h.m4: New file. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Require gl_DIRENT_H_DEFAULTS. diff --git a/NEWS b/NEWS index ef04cf440..16569825c 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,9 @@ User visible incompatible changes Date Modules Changes +2008-10-18 getdomainname The include file is changed from "getdomainname.h" + to . + 2008-09-28 sockets When using this module, you now need to link with $(LIBSOCKET). diff --git a/lib/getdomainname.c b/lib/getdomainname.c index f4c6a1614..658075320 100644 --- 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 /* Specification. */ -#include "getdomainname.h" +#include #include #include diff --git a/lib/getdomainname.h b/lib/getdomainname.h deleted file mode 100644 index 47f23a794..000000000 --- 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 . */ - -#ifndef _GETDOMAINNAME_H -#define _GETDOMAINNAME_H - -#if HAVE_GETDOMAINNAME - -/* Get getdomainname() declaration. */ -# include - -#else - -# include - -/* 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 */ diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 2ffca2145..7a7983a90 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -1,5 +1,5 @@ /* Substitute for and wrapper around . - 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 @@ extern char * getcwd (char *buf, size_t size); #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. */ diff --git a/lib/xgetdomainname.c b/lib/xgetdomainname.c index 4b68b5dc5..1d557d65b 100644 --- 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 /* Get errno. */ #include diff --git a/m4/getdomainname.m4 b/m4/getdomainname.m4 index 88da554fc..e9198a0b9 100644 --- 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 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 ]) diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index e9f7a7d58..b9da779f3 100644 --- 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 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], 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 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], 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]) diff --git a/modules/getdomainname b/modules/getdomainname index b69a1f26d..4f37a0cc2 100644 --- a/modules/getdomainname +++ b/modules/getdomainname @@ -2,19 +2,21 @@ Description: 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" + License: GPL diff --git a/modules/unistd b/modules/unistd index 820f33e83..a5a5b791d 100644 --- a/modules/unistd +++ b/modules/unistd @@ -32,6 +32,7 @@ unistd.h: unistd.in.h -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 @@ unistd.h: unistd.in.h -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' \