Changeset 1287 in kBuild for trunk/src/kmk/kmkbuiltin
- Timestamp:
- Nov 30, 2007 3:52:13 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kmkbuiltin/cp.c
r1246 r1287 74 74 #include "getopt.h" 75 75 76 #include "k/kDefs.h" 76 77 #ifdef _MSC_VER 77 78 # include "mscfakes.h" … … 101 102 #endif 102 103 103 #if defined(__WIN32__) || defined(__WIN64__) || defined(__OS2__)104 #if K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 104 105 # define IS_SLASH(ch) ((ch) == '/' || (ch) == '\\') 105 106 #else … … 122 123 static int Rflag, rflag; 123 124 volatile sig_atomic_t info; 125 static int cp_ignore_non_existing, cp_changed_only; 124 126 125 127 enum op { FILE_TO_FILE, FILE_TO_DIR, DIR_TO_DNE }; … … 129 131 { "help", no_argument, 0, 261 }, 130 132 { "version", no_argument, 0, 262 }, 133 { "ignore-non-existing", no_argument, 0, 263 }, 134 { "changed", no_argument, 0, 264 }, 131 135 { 0, 0, 0, 0 }, 132 136 }; … … 155 159 fflag = iflag = nflag = pflag = vflag = Rflag = rflag = 0; 156 160 info = 0; 161 cp_ignore_non_existing = cp_changed_only = 0; 157 162 158 163 /* reset getopt and set progname. */ … … 215 220 case 262: 216 221 return kbuild_version(argv[0]); 222 case 263: 223 cp_ignore_non_existing = 1; 224 break; 225 case 264: 226 cp_changed_only = 1; 227 break; 217 228 default: 218 229 return usage(stderr); … … 354 365 switch (curr->fts_info) { 355 366 case FTS_NS: 367 if ( cp_ignore_non_existing 368 && curr->fts_errno == ENOENT) { 369 if (vflag) { 370 warnx("%s: %s", curr->fts_path, 371 strerror(curr->fts_errno)); 372 } 373 continue; 374 } 356 375 case FTS_DNR: 357 376 case FTS_ERR: … … 395 414 if (type != DIR_TO_DNE) { 396 415 p = strrchr(curr->fts_path, '/'); 397 #if defined(__WIN32__) || defined(__WIN64__) || defined(__OS2__)416 #if K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 398 417 if (strrchr(curr->fts_path, '\\') > p) 399 418 p = strrchr(curr->fts_path, '\\'); … … 606 625 usage(FILE *fp) 607 626 { 608 fprintf(fp, "usage: %s [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target\n" 609 " or: %s [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory\n" 610 " or: %s --help\n" 611 " or: %s --version\n", 612 g_progname, g_progname, g_progname, g_progname); 627 fprintf(fp, "usage: %s [options] src target\n" 628 " or: %s [options] src1 ... srcN directory\n" 629 " or: %s --help\n" 630 " or: %s --version\n" 631 "\n" 632 "Options:\n" 633 " -R Recursive copy.\n" 634 " -H Description. Only valid with -R.\n" 635 " -L Description. Only valid with -R.\n" 636 " -P Description. Only valid with -R\n" 637 " -f Force. Overrides -i and -n.\n" 638 " -i Iteractive. Overrides -n and -f.\n" 639 " -n Don't overwrite any files. Overrides -i and -f.\n" 640 " --ignore-non-existing\n" 641 " Don't fail if the specified source file doesn't exist.\n" 642 " --changed\n" 643 " Only copy if changed (i.e. compare first). TODO.\n" 644 , 645 g_progname, g_progname, g_progname, g_progname); 613 646 return 1; 614 647 }
Note:
See TracChangeset
for help on using the changeset viewer.