+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.
/* 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
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;
}
+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.
-# 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.
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)
+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.
#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
else
break;
}
- if (CLOSEDIR (dirp))
+ if (closedir (dirp))
error (EXIT_FAILURE, errno, _("error reading current directory"));
if (found != NULL)