diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2006-07-09 16:59:05 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2006-07-09 16:59:05 +0000 |
commit | cb052e4f6cc723bc408f32963e921705f3286c94 (patch) | |
tree | d6f6172f7cff8f5c44f9ae557a525e4b1baf277b /lib/backupfile.c | |
parent | 28edf6a75ef4f95e18da5b506bdcf122a53ca3ec (diff) | |
download | coreutils-cb052e4f6cc723bc408f32963e921705f3286c94.tar.xz |
Update from gnulib.
Diffstat (limited to 'lib/backupfile.c')
-rw-r--r-- | lib/backupfile.c | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/lib/backupfile.c b/lib/backupfile.c index a990addec..13c471583 100644 --- a/lib/backupfile.c +++ b/lib/backupfile.c @@ -47,21 +47,7 @@ #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 HAVE_DIRENT_H || HAVE_NDIR_H || HAVE_SYS_DIR_H || HAVE_SYS_NDIR_H -# define HAVE_DIR 1 -#else -# define HAVE_DIR 0 +# include <ndir.h> #endif #if D_INO_IN_DIRENT @@ -95,11 +81,11 @@ #endif /* ISDIGIT differs from isdigit, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char. - - It's guaranteed to evaluate its argument exactly once. + - Its arg may be any int or unsigned int; it need not be an unsigned char + or EOF. - It's typically faster. POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to - ISDIGIT_LOCALE unless it's important to use the locale's definition + ISDIGIT unless it's important to use the locale's definition of `digit' even when the host does not conform to POSIX. */ #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) @@ -166,8 +152,6 @@ check_extension (char *file, size_t filelen, char e) } } -#if HAVE_DIR - /* Returned values for NUMBERED_BACKUP. */ enum numbered_backup_result @@ -282,7 +266,6 @@ numbered_backup (char **buffer, size_t buffer_size, size_t filelen) *buffer = buf; return result; } -#endif /* HAVE_DIR */ /* Return the name of the new backup file for the existing file FILE, allocated with malloc. Report an error and fail if out of memory. @@ -301,14 +284,13 @@ find_backup_file_name (char const *file, enum backup_type backup_type) size_t simple_backup_suffix_size = strlen (simple_backup_suffix) + 1; size_t backup_suffix_size_guess = simple_backup_suffix_size; enum { GUESS = sizeof ".~12345~" }; - if (HAVE_DIR && backup_suffix_size_guess < GUESS) + if (backup_suffix_size_guess < GUESS) backup_suffix_size_guess = GUESS; ssize = filelen + backup_suffix_size_guess + 1; s = xmalloc (ssize); memcpy (s, file, filelen + 1); -#if HAVE_DIR if (backup_type != simple_backups) switch (numbered_backup (&s, ssize, filelen)) { @@ -323,7 +305,6 @@ find_backup_file_name (char const *file, enum backup_type backup_type) simple = (backup_type == numbered_existing_backups); break; } -#endif if (simple) memcpy (s + filelen, simple_backup_suffix, simple_backup_suffix_size); |