summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog21
-rw-r--r--NEWS3
-rw-r--r--lib/getdomainname.c4
-rw-r--r--lib/getdomainname.h43
-rw-r--r--lib/unistd.in.h25
-rw-r--r--lib/xgetdomainname.c4
-rw-r--r--m4/getdomainname.m410
-rw-r--r--m4/unistd_h.m44
-rw-r--r--modules/getdomainname6
-rw-r--r--modules/unistd2
10 files changed, 69 insertions, 53 deletions
diff --git a/ChangeLog b/ChangeLog
index 7ca0aae5a5..21dbe3cc97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,26 @@
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.
* m4/dirent_h.m4: New file.
* m4/fchdir.m4 (gl_FUNC_FCHDIR): Require gl_DIRENT_H_DEFAULTS.
diff --git a/NEWS b/NEWS
index ef04cf4403..16569825c2 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 <unistd.h>.
+
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 f4c6a16147..658075320c 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 <config.h>
/* Specification. */
-#include "getdomainname.h"
+#include <unistd.h>
#include <string.h>
#include <errno.h>
diff --git a/lib/getdomainname.h b/lib/getdomainname.h
deleted file mode 100644
index 47f23a794c..0000000000
--- 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 */
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 2ffca21458..7a7983a903 100644
--- 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 @@ 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 4b68b5dc5c..1d557d65b8 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 <unistd.h>
/* Get errno. */
#include <errno.h>
diff --git a/m4/getdomainname.m4 b/m4/getdomainname.m4
index 88da554fc4..e9198a0b9e 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 <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
])
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index e9f7a7d58b..b9da779f3d 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 b69a1f26df..4f37a0cc22 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"
+<unistd.h>
License:
GPL
diff --git a/modules/unistd b/modules/unistd
index 820f33e83a..a5a5b791dc 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' \