+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.
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).
/* 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
#include <config.h>
/* Specification. */
-#include "getdomainname.h"
+#include <unistd.h>
#include <string.h>
#include <errno.h>
+++ /dev/null
-/* 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 */
/* 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
#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. */
/* 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
#include "xgetdomainname.h"
/* Get getdomainname. */
-#include "getdomainname.h"
+#include <unistd.h>
/* Get errno. */
#include <errno.h>
-# 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
])
-# 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,
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])
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])
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
-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' \
-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' \