]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Assume <dirent.h> on all Unix platforms. Assume closedir works.
authorBruno Haible <bruno@clisp.org>
Fri, 30 Jun 2006 14:37:52 +0000 (14:37 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:13:28 +0000 (12:13 +0200)
gettext-tools/lib/ChangeLog
gettext-tools/lib/backupfile.c
gettext-tools/m4/ChangeLog
gettext-tools/m4/backupfile.m4
gettext-tools/src/ChangeLog
gettext-tools/src/msginit.c

index cc1f22a5c87e06fd71046de41ffebab5c55d71c6..a8b044aefd3a9dffaebefa923638c6af312fcdd8 100644 (file)
@@ -1,3 +1,10 @@
+2006-06-28  Bruno Haible  <bruno@clisp.org>
+
+       Assume <dirent.h> on all Unix platforms. Assume closedir works.
+       * backupfile.c: Don't include <sys/ndir.h>, <sys/dir.h>, <ndir.h>.
+       (NLENGTH): Remove macro.
+       (max_backup_version): Use closedir directly.
+
 2006-06-27  Bruno Haible  <bruno@clisp.org>
 
        Assume correct S_ISDIR macro.
index 173c5e02aea2a509035999ac285d42ca1864f18b..7e1091ea9021ecccc07febea83ce43e7801f9d49 100644 (file)
@@ -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
 
 #if HAVE_DIRENT_H
 # include <dirent.h>
-# 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 <sys/ndir.h>
-# endif
-# if HAVE_SYS_DIR_H
-#  include <sys/dir.h>
-# endif
-# if HAVE_NDIR_H
-#  include <ndir.h>
-# endif
-#endif
-
-#if CLOSEDIR_VOID
-/* Fake a return value. */
-# define CLOSEDIR(d) (closedir (d), 0)
-#else
-# define CLOSEDIR(d) closedir (d)
 #endif
 
 #include <stdlib.h>
 
 #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;
 }
index 24542d4a12c50aeff9e19db5d817b7b172e2ed6c..58f1b85d9b62ec50fb99b03e91d939c17cd2f45f 100644 (file)
@@ -1,3 +1,9 @@
+2006-06-28  Bruno Haible  <bruno@clisp.org>
+
+       Assume <dirent.h> 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  <bruno@clisp.org>
 
        * Makefile.am (aclocal_DATA): Remove isc-posix.m4.
index 54c73efa5484cac9af59384ca1e509993aed8084..532bd5c9d709f4dc4ef9454f39b72c7326989ff4 100644 (file)
@@ -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)
index 50c19b9e91c2286831e019879136ba2a52333a43..cf2df682377142c2870ff16ed2e47be3cd5a235a 100644 (file)
@@ -1,3 +1,9 @@
+2006-06-28  Bruno Haible  <bruno@clisp.org>
+
+       Assume <dirent.h> on all Unix platforms. Assume closedir works.
+       * msginit.c: Don't include <sys/ndir.h>, <sys/dir.h>, <ndir.h>.
+       (find_pot): Use closedir directly.
+
 2006-06-27  Bruno Haible  <bruno@clisp.org>
 
        Assume correct S_ISDIR macro.
index a73251976a70627639c8882f9ed58c1976c13a46..c612f72aa06d76692c4bb0d6f2a3c65c45f3a426 100644 (file)
 
 #if HAVE_DIRENT_H
 # include <dirent.h>
-#else
-# define dirent direct
-# if HAVE_SYS_NDIR_H
-#  include <sys/ndir.h>
-# endif
-# if HAVE_SYS_DIR_H
-#  include <sys/dir.h>
-# endif
-# if HAVE_NDIR_H
-#  include <ndir.h>
-# 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)