comparison toys/posix/chgrp.c @ 1655:45a612fb0ce6 draft

Let chown build standalone.
author Rob Landley <rob@landley.net>
date Wed, 14 Jan 2015 00:31:06 -0600
parents 5fac2769a159
children 88e6a100490e
comparison
equal deleted inserted replaced
1654:c8be6e37a616 1655:45a612fb0ce6
2 * 2 *
3 * Copyright 2012 Georgi Chorbadzhiyski <georgi@unixsol.org> 3 * Copyright 2012 Georgi Chorbadzhiyski <georgi@unixsol.org>
4 * 4 *
5 * See http://opengroup.org/onlinepubs/9699919799/utilities/chown.html 5 * See http://opengroup.org/onlinepubs/9699919799/utilities/chown.html
6 * See http://opengroup.org/onlinepubs/9699919799/utilities/chgrp.html 6 * See http://opengroup.org/onlinepubs/9699919799/utilities/chgrp.html
7 *
8 * TODO: group only one of [HLP]
9 7
10 USE_CHGRP(NEWTOY(chgrp, "<2hPLHRfv", TOYFLAG_BIN)) 8 USE_CHGRP(NEWTOY(chgrp, "<2hPLHRfv[-HLP]", TOYFLAG_BIN))
11 USE_CHGRP(OLDTOY(chown, chgrp, TOYFLAG_BIN)) 9 USE_CHOWN(OLDTOY(chown, chgrp, TOYFLAG_BIN))
12 10
13 config CHGRP 11 config CHGRP
14 bool "chgrp/chown" 12 bool "chgrp"
15 default y 13 default y
16 help 14 help
17 usage: chown [-RHLP] [-fvh] [owner][:group] file... 15 usage: chgrp/chown [-RHLP] [-fvh] group file...
18 usage: chgrp [-RHLP] [-fvh] group file...
19 16
20 Change ownership of one or more files. 17 Change group of one or more files.
21 18
22 -f suppress most error messages. 19 -f suppress most error messages.
23 -h change symlinks instead of what they point to 20 -h change symlinks instead of what they point to
24 -R recurse into subdirectories (implies -h). 21 -R recurse into subdirectories (implies -h).
25 -H with -R change target of symlink, follow command line symlinks 22 -H with -R change target of symlink, follow command line symlinks
26 -L with -R change target of symlink, follow all symlinks 23 -L with -R change target of symlink, follow all symlinks
27 -P with -R change symlink, do not follow symlinks (default) 24 -P with -R change symlink, do not follow symlinks (default)
28 -v verbose output. 25 -v verbose output.
26
27 config CHOWN
28 bool "chown"
29 default y
30 help
31 see: chgrp
29 */ 32 */
30 33
31 #define FOR_chgrp 34 #define FOR_chgrp
35 #define FORCE_FLAGS
32 #include "toys.h" 36 #include "toys.h"
33 37
34 GLOBALS( 38 GLOBALS(
35 uid_t owner; 39 uid_t owner;
36 gid_t group; 40 gid_t group;
107 else toys.exitval = 1; 111 else toys.exitval = 1;
108 } 112 }
109 113
110 if (CFG_TOYBOX_FREE && ischown) free(own); 114 if (CFG_TOYBOX_FREE && ischown) free(own);
111 } 115 }
116
117 void chown_main()
118 {
119 chgrp_main();
120 }