# HG changeset patch # User Rob Landley # Date 1418922815 21600 # Node ID 95b6ae6498fd5d0ee973b63bacae9348e958c759 # Parent 21867cda5e419208af38602240222fe4adb1d224 Decouple cp and mv so mv uses its own --help text. MV still requires CP enabled until the flag generation logic gets updated. diff -r 21867cda5e41 -r 95b6ae6498fd toys/posix/cp.c --- a/toys/posix/cp.c Thu Dec 18 11:05:06 2014 -0600 +++ b/toys/posix/cp.c Thu Dec 18 11:13:35 2014 -0600 @@ -4,11 +4,11 @@ * * Posix says "cp -Rf dir file" shouldn't delete file, but our -f does. -// This is subtle: MV options must be in same order (right to left) as CP -// for FLAG_X macros to work out right. +// This is subtle: MV options shared with CP must be in same order (right to +// left) as CP for FLAG_X macros to work out right. USE_CP(NEWTOY(cp, "<2RHLPp"USE_CP_MORE("rdaslvnF")"fi[-HLPd]"USE_CP_MORE("[-ni]"), TOYFLAG_BIN)) -USE_CP_MV(OLDTOY(mv, cp, "<2"USE_CP_MORE("vnF")"fi"USE_CP_MORE("[-ni]"), TOYFLAG_BIN)) +USE_MV(NEWTOY(mv, "<2"USE_CP_MORE("vnF")"fi"USE_CP_MORE("[-ni]"), TOYFLAG_BIN)) USE_INSTALL(NEWTOY(install, "<1cdDpsvm:o:g:", TOYFLAG_USR|TOYFLAG_BIN)) * @@ -45,7 +45,7 @@ -s symlink instead of copy -v verbose -config CP_MV +config MV bool "mv" default y depends on CP @@ -55,10 +55,10 @@ -f force copy by deleting destination file -i interactive, prompt before overwriting existing DEST -config CP_MV_MORE +config MV_MORE bool default y - depends on CP_MV && CP_MORE + depends on MV && CP_MORE help usage: mv [-vn] @@ -290,7 +290,7 @@ if (fdout != AT_FDCWD) xclose(fdout); - if (CFG_CP_MV && toys.which->name[0] == 'm') + if (CFG_MV && toys.which->name[0] == 'm') if (unlinkat(tfd, try->name, S_ISDIR(try->st.st_mode) ? AT_REMOVEDIR :0)) err = "%s"; } @@ -321,7 +321,7 @@ else TT.destname = destname; errno = EXDEV; - if (CFG_CP_MV && toys.which->name[0] == 'm') { + if (CFG_MV && toys.which->name[0] == 'm') { if (!(toys.optflags & FLAG_f)) { struct stat st; @@ -351,6 +351,11 @@ } } +void mv_main(void) +{ + cp_main(); +} + #define CLEANUP_cp #define FOR_install #include