aboutsummaryrefslogtreecommitdiff
path: root/toys/chmod.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-06-10 19:44:33 -0500
committerRob Landley <rob@landley.net>2012-06-10 19:44:33 -0500
commit60a99fae7cccd8d67df9f6fadf33c9270e575e06 (patch)
tree349cea9cd75d85111d0760f6aa7b727bfcc5a15b /toys/chmod.c
parent4af1e1d784fa757e1d50b3fa42bd27f0a9b7782c (diff)
downloadtoybox-60a99fae7cccd8d67df9f6fadf33c9270e575e06.tar.gz
The linux from scratch build wants -v on chmod.
Diffstat (limited to 'toys/chmod.c')
-rw-r--r--toys/chmod.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/toys/chmod.c b/toys/chmod.c
index b11c3cd9..2a4e5e3d 100644
--- a/toys/chmod.c
+++ b/toys/chmod.c
@@ -7,7 +7,7 @@
* See http://pubs.opengroup.org/onlinepubs/009695399/utilities/chmod.html
*
-USE_CHMOD(NEWTOY(chmod, "<2?R", TOYFLAG_BIN))
+USE_CHMOD(NEWTOY(chmod, "<2?vR", TOYFLAG_BIN))
config CHMOD
bool "chmod"
@@ -44,6 +44,7 @@ DEFINE_GLOBALS(
#define TT this.chmod
#define FLAG_R 1
+#define FLAG_v 2
int do_chmod(struct dirtree *try)
{
@@ -52,6 +53,11 @@ int do_chmod(struct dirtree *try)
if (!dirtree_notdotdot(try)) return 0;
mode = string_to_mode(TT.mode, try->st.st_mode);
+ if (toys.optflags & FLAG_v) {
+ char *s = dirtree_path(try, 0);
+ printf("chmod '%s' to %04o\n", s, mode);
+ free(s);
+ }
wfchmodat(try->parent ? try->parent->data : AT_FDCWD, try->name, mode);
return (toys.optflags & FLAG_R) ? DIRTREE_RECURSE : 0;