# HG changeset patch # User Rob Landley # Date 1338517031 18000 # Node ID 9802b2afbce874a6d27d1987de87c6a79056170c # Parent b88bc7dcdb4887b086ef3146de12c88b6fe0941c cp doesn't really need the optstring + logic. Still needs to be updated for new dirtree, though. diff -r b88bc7dcdb48 -r 9802b2afbce8 toys/cp.c --- a/toys/cp.c Sun May 27 00:56:17 2012 -0500 +++ b/toys/cp.c Thu May 31 21:17:11 2012 -0500 @@ -7,7 +7,7 @@ * See http://www.opengroup.org/onlinepubs/009695399/utilities/cp.html * * "R+ra+d+p+r" -USE_CP(NEWTOY(cp, "<2vslrR+rdpa+d+p+rHLPif", TOYFLAG_BIN)) +USE_CP(NEWTOY(cp, "<2vslrRdpaHLPif", TOYFLAG_BIN)) config CP bool "cp (broken by dirtree changes)" @@ -113,7 +113,7 @@ // Inability to set these isn't fatal, some require root access. // Can't do fchmod() etc here because -p works on mkdir, too. - if (toys.optflags & FLAG_p) { + if (toys.optflags & (FLAG_p|FLAG_a)) { int mask = umask(0); struct utimbuf ut; @@ -188,7 +188,7 @@ // Skip nonexistent sources. - TT.keep_symlinks = toys.optflags & FLAG_d; + TT.keep_symlinks = toys.optflags & (FLAG_d|FLAG_a); if (TT.keep_symlinks ? lstat(src, &st) : stat(src, &st)) { perror_msg("'%s'", src); @@ -205,7 +205,7 @@ dst = xmsprintf("%s/%s", TT.destname, dst); } else dst = TT.destname; if (S_ISDIR(st.st_mode)) { - if (toys.optflags & FLAG_r) { + if (toys.optflags & (FLAG_r|FLAG_R|FLAG_a)) { cp_file(src, dst, &st); TT.keep_symlinks++;