From 01441036e9754425e2b09b43deec879ca46206cb Mon Sep 17 00:00:00 2001 From: Matt Kraai Date: Tue, 24 Apr 2001 01:30:02 +0000 Subject: Use generic flag names. --- libbb/copy_file.c | 19 ++++++++++--------- libbb/libbb.h | 10 +++++----- 2 files changed, 15 insertions(+), 14 deletions(-) (limited to 'libbb') diff --git a/libbb/copy_file.c b/libbb/copy_file.c index f24d1b119..4ee3efdbc 100644 --- a/libbb/copy_file.c +++ b/libbb/copy_file.c @@ -39,8 +39,9 @@ int copy_file(const char *source, const char *dest, int flags) int dest_exists = 1; int status = 0; - if (((flags & CP_PRESERVE_SYMLINKS) && lstat(source, &source_stat) < 0) || - (!(flags & CP_PRESERVE_SYMLINKS) && + if (((flags & FILEUTILS_PRESERVE_SYMLINKS) && + lstat(source, &source_stat) < 0) || + (!(flags & FILEUTILS_PRESERVE_SYMLINKS) && stat(source, &source_stat) < 0)) { perror_msg("%s", source); return -1; @@ -64,7 +65,7 @@ int copy_file(const char *source, const char *dest, int flags) DIR *dp; struct dirent *d; - if (!(flags & CP_RECUR)) { + if (!(flags & FILEUTILS_RECUR)) { error_msg("%s: omitting directory", source); return -1; } @@ -80,7 +81,7 @@ int copy_file(const char *source, const char *dest, int flags) saved_umask = umask(0); mode = source_stat.st_mode; - if (!(flags & CP_PRESERVE_STATUS)) + if (!(flags & FILEUTILS_PRESERVE_STATUS)) mode = source_stat.st_mode & ~saved_umask; mode |= S_IRWXU; @@ -125,14 +126,14 @@ int copy_file(const char *source, const char *dest, int flags) FILE *sfp, *dfp; if (dest_exists) { - if (flags & CP_INTERACTIVE) { + if (flags & FILEUTILS_INTERACTIVE) { fprintf(stderr, "%s: overwrite `%s'? ", applet_name, dest); if (!ask_confirmation()) return 0; } if ((dfp = fopen(dest, "w")) == NULL) { - if (!(flags & CP_FORCE)) { + if (!(flags & FILEUTILS_FORCE)) { perror_msg("unable to open `%s'", dest); return -1; } @@ -187,7 +188,7 @@ int copy_file(const char *source, const char *dest, int flags) saved_umask = umask(0); mode = source_stat.st_mode; - if (!(flags & CP_PRESERVE_STATUS)) + if (!(flags & FILEUTILS_PRESERVE_STATUS)) mode = source_stat.st_mode & ~saved_umask; mode |= S_IRWXU; @@ -213,7 +214,7 @@ int copy_file(const char *source, const char *dest, int flags) } #if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) - if (flags & CP_PRESERVE_STATUS) + if (flags & FILEUTILS_PRESERVE_STATUS) if (lchown(dest, source_stat.st_uid, source_stat.st_gid) < 0) perror_msg("unable to preserve ownership of `%s'", dest); #endif @@ -225,7 +226,7 @@ int copy_file(const char *source, const char *dest, int flags) end: - if (flags & CP_PRESERVE_STATUS) { + if (flags & FILEUTILS_PRESERVE_STATUS) { struct utimbuf times; times.actime = source_stat.st_atime; diff --git a/libbb/libbb.h b/libbb/libbb.h index 4eeb99343..404d7076c 100644 --- a/libbb/libbb.h +++ b/libbb/libbb.h @@ -255,11 +255,11 @@ extern int gz_open(FILE *compressed_file, int *pid); /* extern int convert(char *fn, int ConvType); */ enum { - CP_PRESERVE_STATUS = 1, - CP_PRESERVE_SYMLINKS = 2, - CP_RECUR = 4, - CP_FORCE = 8, - CP_INTERACTIVE = 16 + FILEUTILS_PRESERVE_STATUS = 1, + FILEUTILS_PRESERVE_SYMLINKS = 2, + FILEUTILS_RECUR = 4, + FILEUTILS_FORCE = 8, + FILEUTILS_INTERACTIVE = 16 }; extern const char *applet_name; -- cgit v1.2.3