Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/coreutils/mv.c
- Timestamp:
- Jan 1, 2014, 12:47:38 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi-busybox/coreutils/mv.c
r2725 r3232 22 22 //usage:#define mv_full_usage "\n\n" 23 23 //usage: "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY\n" 24 //usage: "\nOptions:"25 24 //usage: "\n -f Don't prompt before overwriting" 26 25 //usage: "\n -i Interactive, prompt before overwrite" … … 35 34 "force\0" No_argument "f" 36 35 "no-clobber\0" No_argument "n" 36 "verbose\0" No_argument "v" 37 37 ; 38 38 #endif 39 39 40 #define OPT_F ILEUTILS_FORCE 141 #define OPT_ FILEUTILS_INTERACTIVE 242 #define OPT_ FILEUTILS_NOCLOBBER 440 #define OPT_FORCE (1 << 0) 41 #define OPT_INTERACTIVE (1 << 1) 42 #define OPT_NOCLOBBER (1 << 2) 43 43 44 44 int mv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; … … 58 58 /* Need at least two arguments. 59 59 * If more than one of -f, -i, -n is specified , only the final one 60 * takes effect (it unsets previous options). */ 60 * takes effect (it unsets previous options). 61 * -v is accepted but ignored. 62 */ 61 63 opt_complementary = "-2:f-in:i-fn:n-fi"; 62 flags = getopt32(argv, "fin ");64 flags = getopt32(argv, "finv"); 63 65 argc -= optind; 64 66 argv += optind; … … 86 88 DO_MOVE: 87 89 if (dest_exists) { 88 if (flags & OPT_ FILEUTILS_NOCLOBBER)90 if (flags & OPT_NOCLOBBER) 89 91 goto RET_0; 90 if (!(flags & OPT_F ILEUTILS_FORCE)92 if (!(flags & OPT_FORCE) 91 93 && ((access(dest, W_OK) < 0 && isatty(0)) 92 || (flags & OPT_ FILEUTILS_INTERACTIVE))94 || (flags & OPT_INTERACTIVE)) 93 95 ) { 94 96 if (fprintf(stderr, "mv: overwrite '%s'? ", dest) < 0) {
Note:
See TracChangeset
for help on using the changeset viewer.