summaryrefslogtreecommitdiff
path: root/chmod_chown_chgrp.c
diff options
context:
space:
mode:
authorEric Andersen1999-11-10 23:13:02 +0000
committerEric Andersen1999-11-10 23:13:02 +0000
commitd73dc5b07390fb90e7f605871c993a28eedf1d46 (patch)
tree3e448e6550da52d2709e5f52fbae56e9df9462cc /chmod_chown_chgrp.c
parent84d85680712573c7a8bd7d0491c3f944dc08ad10 (diff)
downloadbusybox-d73dc5b07390fb90e7f605871c993a28eedf1d46.zip
busybox-d73dc5b07390fb90e7f605871c993a28eedf1d46.tar.gz
Updates to usage, and made tar work.
-Erik
Diffstat (limited to 'chmod_chown_chgrp.c')
-rw-r--r--chmod_chown_chgrp.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/chmod_chown_chgrp.c b/chmod_chown_chgrp.c
index da3ba8d..e9704ff 100644
--- a/chmod_chown_chgrp.c
+++ b/chmod_chown_chgrp.c
@@ -38,16 +38,16 @@ static mode_t mode=0644;
#define CHOWN_APP 2
#define CHMOD_APP 3
-static const char chgrp_usage[] = "[OPTION]... GROUP FILE...\n"
+static const char chgrp_usage[] = "chgrp [OPTION]... GROUP FILE...\n\n"
"Change the group membership of each FILE to GROUP.\n"
- "\n\tOptions:\n" "\t-R\tchange files and directories recursively\n";
-static const char chown_usage[] = "[OPTION]... OWNER[.[GROUP] FILE...\n"
+ "\nOptions:\n\t-R\tchange files and directories recursively\n";
+static const char chown_usage[] = "chown [OPTION]... OWNER[.[GROUP] FILE...\n\n"
"Change the owner and/or group of each FILE to OWNER and/or GROUP.\n"
- "\n\tOptions:\n" "\t-R\tchange files and directories recursively\n";
-static const char chmod_usage[] = "[-R] MODE[,MODE]... FILE...\n"
+ "\nOptions:\n\t-R\tchange files and directories recursively\n";
+static const char chmod_usage[] = "chmod [-R] MODE[,MODE]... FILE...\n\n"
"Each MODE is one or more of the letters ugoa, one of the symbols +-= and\n"
"one or more of the letters rwxst.\n\n"
- "\t-R\tchange files and directories recursively.\n";
+ "\nOptions:\n\t-R\tchange files and directories recursively.\n";
static int fileAction(const char *fileName, struct stat* statbuf)
@@ -73,14 +73,14 @@ int chmod_chown_chgrp_main(int argc, char **argv)
{
int recursiveFlag=FALSE;
char *groupName;
+ const char *appUsage;
whichApp = (strcmp(*argv, "chown")==0)? CHOWN_APP : (strcmp(*argv, "chmod")==0)? CHMOD_APP : CHGRP_APP;
- if (argc < 2) {
- fprintf(stderr, "Usage: %s %s", *argv,
- (whichApp==TRUE)? chown_usage : chgrp_usage);
- exit( FALSE);
- }
+ appUsage = (whichApp==CHOWN_APP)? chown_usage : (whichApp==CHMOD_APP)? chmod_usage : chgrp_usage;
+
+ if (argc < 2)
+ usage( appUsage);
invocationName=*argv;
argc--;
argv++;
@@ -93,7 +93,7 @@ int chmod_chown_chgrp_main(int argc, char **argv)
break;
default:
fprintf(stderr, "Unknown option: %c\n", **argv);
- exit( FALSE);
+ usage( appUsage);
}
argc--;
argv++;