diff options
author | Erik Andersen <andersen@codepoet.org> | 2000-02-11 21:55:04 +0000 |
---|---|---|
committer | Erik Andersen <andersen@codepoet.org> | 2000-02-11 21:55:04 +0000 |
commit | 9ffdaa647ee57263247e047e6c67c5a7fa1f2a6c (patch) | |
tree | 3485e1645439990642fcb941d579deb10f8a17a7 /chmod_chown_chgrp.c | |
parent | 5e1b2ca1161cba481ccf4873427389f59dbc23e0 (diff) | |
download | busybox-w32-9ffdaa647ee57263247e047e6c67c5a7fa1f2a6c.tar.gz busybox-w32-9ffdaa647ee57263247e047e6c67c5a7fa1f2a6c.tar.bz2 busybox-w32-9ffdaa647ee57263247e047e6c67c5a7fa1f2a6c.zip |
Updates
-Erik
Diffstat (limited to 'chmod_chown_chgrp.c')
-rw-r--r-- | chmod_chown_chgrp.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/chmod_chown_chgrp.c b/chmod_chown_chgrp.c index d5e67b599..f037e9591 100644 --- a/chmod_chown_chgrp.c +++ b/chmod_chown_chgrp.c | |||
@@ -81,9 +81,7 @@ static int fileAction(const char *fileName, struct stat *statbuf) | |||
81 | case CHMOD_APP: | 81 | case CHMOD_APP: |
82 | /* Parse the specified modes */ | 82 | /* Parse the specified modes */ |
83 | if (parse_mode(theMode, &(statbuf->st_mode)) == FALSE) { | 83 | if (parse_mode(theMode, &(statbuf->st_mode)) == FALSE) { |
84 | fprintf(stderr, "%s: unknown mode: %s\n", invocationName, | 84 | fatalError( "%s: unknown mode: %s\n", invocationName, theMode); |
85 | theMode); | ||
86 | exit(FALSE); | ||
87 | } | 85 | } |
88 | if (chmod(fileName, statbuf->st_mode) == 0) | 86 | if (chmod(fileName, statbuf->st_mode) == 0) |
89 | return (TRUE); | 87 | return (TRUE); |
@@ -101,14 +99,13 @@ int chmod_chown_chgrp_main(int argc, char **argv) | |||
101 | const char *appUsage; | 99 | const char *appUsage; |
102 | 100 | ||
103 | whichApp = | 101 | whichApp = |
104 | (strcmp(*argv, "chown") == | 102 | (strcmp(*argv, "chown") == 0)? |
105 | 0) ? CHOWN_APP : (strcmp(*argv, | 103 | CHOWN_APP : (strcmp(*argv, "chmod") == 0)? |
106 | "chmod") == 0) ? CHMOD_APP : CHGRP_APP; | 104 | CHMOD_APP : CHGRP_APP; |
107 | 105 | ||
108 | appUsage = | 106 | appUsage = |
109 | (whichApp == CHOWN_APP) ? chown_usage : (whichApp == | 107 | (whichApp == CHOWN_APP)? |
110 | CHMOD_APP) ? chmod_usage : | 108 | chown_usage : (whichApp == CHMOD_APP) ? chmod_usage : chgrp_usage; |
111 | chgrp_usage; | ||
112 | 109 | ||
113 | if (argc < 2) | 110 | if (argc < 2) |
114 | usage(appUsage); | 111 | usage(appUsage); |
@@ -163,17 +160,15 @@ int chmod_chown_chgrp_main(int argc, char **argv) | |||
163 | if (*argv == p) | 160 | if (*argv == p) |
164 | uid = my_getpwnam(*argv); | 161 | uid = my_getpwnam(*argv); |
165 | if (uid == -1) { | 162 | if (uid == -1) { |
166 | fprintf(stderr, "%s: unknown user name: %s\n", | 163 | fatalError( "%s: unknown user name: %s\n", |
167 | invocationName, *argv); | 164 | invocationName, *argv); |
168 | exit(FALSE); | ||
169 | } | 165 | } |
170 | } | 166 | } |
171 | } | 167 | } |
172 | 168 | ||
173 | /* Ok, ready to do the deed now */ | 169 | /* Ok, ready to do the deed now */ |
174 | if (argc <= 1) { | 170 | if (argc <= 1) { |
175 | fprintf(stderr, "%s: too few arguments\n", invocationName); | 171 | fatalError( "%s: too few arguments\n", invocationName); |
176 | exit(FALSE); | ||
177 | } | 172 | } |
178 | while (argc-- > 1) { | 173 | while (argc-- > 1) { |
179 | if (recursiveAction | 174 | if (recursiveAction |
@@ -184,7 +179,5 @@ int chmod_chown_chgrp_main(int argc, char **argv) | |||
184 | exit(TRUE); | 179 | exit(TRUE); |
185 | 180 | ||
186 | bad_group: | 181 | bad_group: |
187 | fprintf(stderr, "%s: unknown group name: %s\n", invocationName, | 182 | fatalError( "%s: unknown group name: %s\n", invocationName, groupName); |
188 | groupName); | ||
189 | exit(FALSE); | ||
190 | } | 183 | } |