1 /* vi: set sw=4 ts=4: */
3 * Mini chgrp implementation for busybox
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 //config: bool "chgrp"
13 //config: chgrp is used to change the group ownership of files.
15 //applet:IF_CHGRP(APPLET_NOEXEC(chgrp, chgrp, BB_DIR_BIN, BB_SUID_DROP, chgrp))
17 //kbuild:lib-$(CONFIG_CHGRP) += chgrp.o chown.o
19 /* BB_AUDIT SUSv3 defects - none? */
20 /* BB_AUDIT GNU defects - unsupported long options. */
21 /* http://www.opengroup.org/onlinepubs/007904975/utilities/chgrp.html */
23 //usage:#define chgrp_trivial_usage
24 //usage: "[-RhLHP"IF_DESKTOP("cvf")"]... GROUP FILE..."
25 //usage:#define chgrp_full_usage "\n\n"
26 //usage: "Change the group membership of each FILE to GROUP\n"
27 //usage: "\n -R Recurse"
28 //usage: "\n -h Affect symlinks instead of symlink targets"
29 //usage: "\n -L Traverse all symlinks to directories"
30 //usage: "\n -H Traverse symlinks on command line only"
31 //usage: "\n -P Don't traverse symlinks (default)"
33 //usage: "\n -c List changed files"
34 //usage: "\n -v Verbose"
35 //usage: "\n -f Hide errors"
38 //usage:#define chgrp_example_usage
39 //usage: "$ ls -l /tmp/foo\n"
40 //usage: "-r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo\n"
41 //usage: "$ chgrp root /tmp/foo\n"
42 //usage: "$ ls -l /tmp/foo\n"
43 //usage: "-r--r--r-- 1 andersen root 0 Apr 12 18:25 /tmp/foo\n"
47 /* This is a NOEXEC applet. Be very careful! */
50 int chgrp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
51 int chgrp_main(int argc, char **argv)
53 /* "chgrp [opts] abc file(s)" == "chown [opts] :abc file(s)" */
57 p[0] = xasprintf(":%s", p[0]);
61 return chown_main(argc, argv);