summaryrefslogtreecommitdiff
path: root/src/chmod.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-03-08 19:00:27 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2012-03-08 19:01:26 -0800
commit8931cdbfdad34945f0f541e1d1e66f599cb62124 (patch)
treee935d80c96a23af111a831388e8225127e3444e6 /src/chmod.c
parent9076b2846404eb3f32c42a63064470103511ba74 (diff)
downloadcoreutils-8931cdbfdad34945f0f541e1d1e66f599cb62124.tar.xz
chmod: add notations +40, 00440, etc.
* NEWS: Document this. * doc/perm.texi (Operator Numeric Modes): New section. (Numeric Modes, Directory Setuid and Setgid): Document new behavior. * src/chmod.c (usage): Document new behavior. (main): Support new options -0, -1, etc. * tests/chmod/setgid: Test these new features.
Diffstat (limited to 'src/chmod.c')
-rw-r--r--src/chmod.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/chmod.c b/src/chmod.c
index a134e3f20..aa4ac771c 100644
--- a/src/chmod.c
+++ b/src/chmod.c
@@ -398,7 +398,7 @@ With --reference, change the mode of each FILE to that of RFILE.\n\
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
-Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+'.\n\
+Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'.\n\
"), stdout);
emit_ancillary_info ();
}
@@ -430,7 +430,8 @@ main (int argc, char **argv)
recurse = force_silent = diagnose_surprises = false;
while ((c = getopt_long (argc, argv,
- "Rcfvr::w::x::X::s::t::u::g::o::a::,::+::=::",
+ ("Rcfvr::w::x::X::s::t::u::g::o::a::,::+::=::"
+ "0::1::2::3::4::5::6::7::"),
long_options, NULL))
!= -1)
{
@@ -449,6 +450,8 @@ main (int argc, char **argv)
case ',':
case '+':
case '=':
+ case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7':
/* Support nonportable uses like "chmod -w", but diagnose
surprises due to umask confusion. Even though "--", "--r",
etc., are valid modes, there is no "case '-'" here since