Remove/rewrite some comments.
[gnulib.git] / lib / backupfile.c
index ddf3fa7..2888034 100644 (file)
    Some algorithms adapted from GNU Emacs. */
 
 #ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
-   using -I. -I will use ./config.h rather than /config.h
-   (which it would do because it found this file in ).  */
 #include <config.h>
-#else
-#include "config.h"
-#endif
 #endif
 
 #include <stdio.h>
 #include <strings.h>
 #endif
 
-#if defined(DIRENT) || defined(_POSIX_VERSION)
+#ifdef HAVE_DIRENT_H
 #include <dirent.h>
 #define NLENGTH(direct) (strlen((direct)->d_name))
-#else /* not (DIRENT or _POSIX_VERSION) */
+#else /* not HAVE_DIRENT_H */
 #define dirent direct
 #define NLENGTH(direct) ((direct)->d_namlen)
-#ifdef SYSNDIR
+#ifdef HAVE_SYS_NDIR_H
 #include <sys/ndir.h>
-#endif /* SYSNDIR */
-#ifdef SYSDIR
+#endif /* HAVE_SYS_NDIR_H */
+#ifdef HAVE_SYS_DIR_H
 #include <sys/dir.h>
-#endif /* SYSDIR */
-#ifdef NDIR
+#endif /* HAVE_SYS_DIR_H */
+#ifdef HAVE_NDIR_H
 #include <ndir.h>
-#endif /* NDIR */
-#endif /* DIRENT or _POSIX_VERSION */
+#endif /* HAVE_NDIR_H */
+#endif /* HAVE_DIRENT_H */
 
-#ifdef VOID_CLOSEDIR
+#ifdef CLOSEDIR_VOID
 /* Fake a return value. */
 #define CLOSEDIR(d) (closedir (d), 0)
 #else
@@ -156,11 +149,11 @@ max_backup_version (file, dir)
   int highest_version;
   int this_version;
   int file_name_length;
-  
+
   dirp = opendir (dir);
   if (!dirp)
     return 0;
-  
+
   highest_version = 0;
   file_name_length = strlen (file);
 
@@ -168,7 +161,7 @@ max_backup_version (file, dir)
     {
       if (!REAL_DIR_ENTRY (dp) || NLENGTH (dp) <= file_name_length)
        continue;
-      
+
       this_version = version_number (file, dp->d_name, file_name_length);
       if (this_version > highest_version)
        highest_version = this_version;
@@ -207,7 +200,7 @@ version_number (base, backup, base_length)
 {
   int version;
   char *p;
-  
+
   version = 0;
   if (!strncmp (base, backup, base_length) && ISDIGIT (backup[base_length]))
     {