From: Bruno Haible Date: Fri, 30 Jun 2006 14:37:52 +0000 (+0000) Subject: Assume on all Unix platforms. Assume closedir works. X-Git-Tag: v0.15~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35c6e20d3e3eb9febf06a32b4a7158cfb886eb7d;p=thirdparty%2Fgettext.git Assume on all Unix platforms. Assume closedir works. --- diff --git a/gettext-tools/lib/ChangeLog b/gettext-tools/lib/ChangeLog index cc1f22a5c..a8b044aef 100644 --- a/gettext-tools/lib/ChangeLog +++ b/gettext-tools/lib/ChangeLog @@ -1,3 +1,10 @@ +2006-06-28 Bruno Haible + + Assume on all Unix platforms. Assume closedir works. + * backupfile.c: Don't include , , . + (NLENGTH): Remove macro. + (max_backup_version): Use closedir directly. + 2006-06-27 Bruno Haible Assume correct S_ISDIR macro. diff --git a/gettext-tools/lib/backupfile.c b/gettext-tools/lib/backupfile.c index 173c5e02a..7e1091ea9 100644 --- a/gettext-tools/lib/backupfile.c +++ b/gettext-tools/lib/backupfile.c @@ -1,5 +1,5 @@ /* backupfile.c -- make Emacs style backup file names - Copyright (C) 1990-1999, 2000-2003, 2005 Free Software Foundation, Inc. + Copyright (C) 1990-1999, 2000-2003, 2005-2006 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 @@ -36,33 +36,13 @@ #if HAVE_DIRENT_H # include -# define NLENGTH(direct) strlen ((direct)->d_name) -#else -# define dirent direct -# define NLENGTH(direct) ((size_t) (direct)->d_namlen) -# if HAVE_SYS_NDIR_H -# include -# endif -# if HAVE_SYS_DIR_H -# include -# endif -# if HAVE_NDIR_H -# include -# endif -#endif - -#if CLOSEDIR_VOID -/* Fake a return value. */ -# define CLOSEDIR(d) (closedir (d), 0) -#else -# define CLOSEDIR(d) closedir (d) #endif #include #include "basename.h" -#if HAVE_DIRENT_H || HAVE_NDIR_H || HAVE_SYS_DIR_H || HAVE_SYS_NDIR_H +#if HAVE_DIRENT_H # define HAVE_DIR 1 #else # define HAVE_DIR 0 @@ -172,14 +152,14 @@ max_backup_version (const char *file, const char *dir) while ((dp = readdir (dirp)) != 0) { - if (!REAL_DIR_ENTRY (dp) || NLENGTH (dp) < file_name_length + 4) + if (!REAL_DIR_ENTRY (dp) || strlen (dp->d_name) < file_name_length + 4) continue; this_version = version_number (file, dp->d_name, file_name_length); if (this_version > highest_version) highest_version = this_version; } - if (CLOSEDIR (dirp)) + if (closedir (dirp)) return 0; return highest_version; } diff --git a/gettext-tools/m4/ChangeLog b/gettext-tools/m4/ChangeLog index 24542d4a1..58f1b85d9 100644 --- a/gettext-tools/m4/ChangeLog +++ b/gettext-tools/m4/ChangeLog @@ -1,3 +1,9 @@ +2006-06-28 Bruno Haible + + Assume on all Unix platforms. Assume closedir works. + * backupfile.m4 (gt_PREREQ_BACKUPFILE): Don't invoke AC_HEADER_DIRENT, + AC_FUNC_CLOSEDIR_VOID. Instead test for dirent.h. + 2006-06-27 Bruno Haible * Makefile.am (aclocal_DATA): Remove isc-posix.m4. diff --git a/gettext-tools/m4/backupfile.m4 b/gettext-tools/m4/backupfile.m4 index 54c73efa5..532bd5c9d 100644 --- a/gettext-tools/m4/backupfile.m4 +++ b/gettext-tools/m4/backupfile.m4 @@ -1,5 +1,5 @@ -# backupfile.m4 serial 2 (gettext-0.13) -dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. +# backupfile.m4 serial 3 (gettext-0.15) +dnl Copyright (C) 2001-2003, 2006 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. @@ -9,9 +9,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gt_PREREQ_BACKUPFILE], [ dnl For backupfile.c. - AC_REQUIRE([AC_HEADER_DIRENT]) - AC_FUNC_CLOSEDIR_VOID - AC_CHECK_HEADERS(string.h) + AC_CHECK_HEADERS(dirent.h string.h) dnl For addext.c. AC_SYS_LONG_FILE_NAMES AC_CHECK_FUNCS(pathconf) diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 50c19b9e9..cf2df6823 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,9 @@ +2006-06-28 Bruno Haible + + Assume on all Unix platforms. Assume closedir works. + * msginit.c: Don't include , , . + (find_pot): Use closedir directly. + 2006-06-27 Bruno Haible Assume correct S_ISDIR macro. diff --git a/gettext-tools/src/msginit.c b/gettext-tools/src/msginit.c index a73251976..c612f72aa 100644 --- a/gettext-tools/src/msginit.c +++ b/gettext-tools/src/msginit.c @@ -41,27 +41,9 @@ #if HAVE_DIRENT_H # include -#else -# define dirent direct -# if HAVE_SYS_NDIR_H -# include -# endif -# if HAVE_SYS_DIR_H -# include -# endif -# if HAVE_NDIR_H -# include -# endif #endif -#if CLOSEDIR_VOID -/* Fake a return value. */ -# define CLOSEDIR(d) (closedir (d), 0) -#else -# define CLOSEDIR(d) closedir (d) -#endif - -#if HAVE_DIRENT_H || HAVE_NDIR_H || HAVE_SYS_DIR_H || HAVE_SYS_NDIR_H +#if HAVE_DIRENT_H # define HAVE_DIR 1 #else # define HAVE_DIR 0 @@ -468,7 +450,7 @@ Please specify the input .pot file through the --input option.\n"))); else break; } - if (CLOSEDIR (dirp)) + if (closedir (dirp)) error (EXIT_FAILURE, errno, _("error reading current directory")); if (found != NULL)