Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/coreutils/cp.c


Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/coreutils/cp.c

    r3232 r3621  
    3232//usage:     "\n    -i  Prompt before overwrite"
    3333//usage:     "\n    -l,-s   Create (sym)links"
     34//usage:     "\n    -u  Copy only newer files"
    3435
    3536#include "libbb.h"
     
    5051    int status;
    5152    enum {
    52         OPT_a = 1 << (sizeof(FILEUTILS_CP_OPTSTR)-1),
    53         OPT_r = 1 << (sizeof(FILEUTILS_CP_OPTSTR)),
    54         OPT_P = 1 << (sizeof(FILEUTILS_CP_OPTSTR)+1),
    55         OPT_v = 1 << (sizeof(FILEUTILS_CP_OPTSTR)+2),
    56 #if ENABLE_FEATURE_CP_LONG_OPTIONS
    57         OPT_parents = 1 << (sizeof(FILEUTILS_CP_OPTSTR)+3),
     53        FILEUTILS_CP_OPTNUM = sizeof(FILEUTILS_CP_OPTSTR)-1,
     54#if ENABLE_FEATURE_CP_LONG_OPTIONS
     55        /*OPT_rmdest  = FILEUTILS_RMDEST = 1 << FILEUTILS_CP_OPTNUM */
     56        OPT_parents = 1 << (FILEUTILS_CP_OPTNUM+1),
    5857#endif
    5958    };
     
    7776        "symbolic-link\0"  No_argument "s"
    7877        "verbose\0"        No_argument "v"
    79         "parents\0"        No_argument "\xff"
     78        "update\0"         No_argument "u"
     79        "remove-destination\0" No_argument "\xff"
     80        "parents\0"        No_argument "\xfe"
    8081        ;
    8182#endif
    82     // -v (--verbose) is ignored
    83     flags = getopt32(argv, FILEUTILS_CP_OPTSTR "arPv");
     83    flags = getopt32(argv, FILEUTILS_CP_OPTSTR);
    8484    /* Options of cp from GNU coreutils 6.10:
    8585     * -a, --archive
     
    9696     * -p   same as --preserve=mode,ownership,timestamps
    9797     * -c   same as --preserve=context
     98     * -u, --update
     99     *  copy only when the SOURCE file is newer than the destination
     100     *  file or when the destination file is missing
     101     * --remove-destination
     102     *  remove each existing destination file before attempting to open
    98103     * --parents
    99104     *  use full source file name under DIRECTORY
     
    108113     *  if possible additional attributes: security context,links,all
    109114     * --no-preserve=ATTR_LIST
    110      * --remove-destination
    111      *  remove  each existing destination file before attempting to open
    112115     * --sparse=WHEN
    113116     *  control creation of sparse files
     
    120123     * -T, --no-target-directory
    121124     *  treat DEST as a normal file
    122      * -u, --update
    123      *  copy only when the SOURCE file is newer than the destination
    124      *  file or when the destination file is missing
    125125     * -x, --one-file-system
    126126     *  stay on this file system
     
    158158
    159159#if ENABLE_FEATURE_CP_LONG_OPTIONS
     160        //bb_error_msg("flags:%x FILEUTILS_RMDEST:%x OPT_parents:%x",
     161        //  flags, FILEUTILS_RMDEST, OPT_parents);
    160162        if (flags & OPT_parents) {
    161163            if (!(d_flags & 2)) {
    162164                bb_error_msg_and_die("with --parents, the destination must be a directory");
    163165            }
     166        }
     167        if (flags & FILEUTILS_RMDEST) {
     168            flags |= FILEUTILS_FORCE;
    164169        }
    165170#endif
Note: See TracChangeset for help on using the changeset viewer.