summaryrefslogtreecommitdiff
path: root/chmod_chown_chgrp.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-11-10 23:13:02 +0000
committerEric Andersen <andersen@codepoet.org>1999-11-10 23:13:02 +0000
commitd73dc5b07390fb90e7f605871c993a28eedf1d46 (patch)
tree3e448e6550da52d2709e5f52fbae56e9df9462cc /chmod_chown_chgrp.c
parent84d85680712573c7a8bd7d0491c3f944dc08ad10 (diff)
downloadbusybox-w32-d73dc5b07390fb90e7f605871c993a28eedf1d46.tar.gz
busybox-w32-d73dc5b07390fb90e7f605871c993a28eedf1d46.tar.bz2
busybox-w32-d73dc5b07390fb90e7f605871c993a28eedf1d46.zip
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 da3ba8d50..e9704fff8 100644
--- a/chmod_chown_chgrp.c
+++ b/chmod_chown_chgrp.c
@@ -38,16 +38,16 @@ static mode_t mode=0644;
38#define CHOWN_APP 2 38#define CHOWN_APP 2
39#define CHMOD_APP 3 39#define CHMOD_APP 3
40 40
41static const char chgrp_usage[] = "[OPTION]... GROUP FILE...\n" 41static const char chgrp_usage[] = "chgrp [OPTION]... GROUP FILE...\n\n"
42 "Change the group membership of each FILE to GROUP.\n" 42 "Change the group membership of each FILE to GROUP.\n"
43 "\n\tOptions:\n" "\t-R\tchange files and directories recursively\n"; 43 "\nOptions:\n\t-R\tchange files and directories recursively\n";
44static const char chown_usage[] = "[OPTION]... OWNER[.[GROUP] FILE...\n" 44static const char chown_usage[] = "chown [OPTION]... OWNER[.[GROUP] FILE...\n\n"
45 "Change the owner and/or group of each FILE to OWNER and/or GROUP.\n" 45 "Change the owner and/or group of each FILE to OWNER and/or GROUP.\n"
46 "\n\tOptions:\n" "\t-R\tchange files and directories recursively\n"; 46 "\nOptions:\n\t-R\tchange files and directories recursively\n";
47static const char chmod_usage[] = "[-R] MODE[,MODE]... FILE...\n" 47static const char chmod_usage[] = "chmod [-R] MODE[,MODE]... FILE...\n\n"
48"Each MODE is one or more of the letters ugoa, one of the symbols +-= and\n" 48"Each MODE is one or more of the letters ugoa, one of the symbols +-= and\n"
49"one or more of the letters rwxst.\n\n" 49"one or more of the letters rwxst.\n\n"
50 "\t-R\tchange files and directories recursively.\n"; 50 "\nOptions:\n\t-R\tchange files and directories recursively.\n";
51 51
52 52
53static int fileAction(const char *fileName, struct stat* statbuf) 53static int fileAction(const char *fileName, struct stat* statbuf)
@@ -73,14 +73,14 @@ int chmod_chown_chgrp_main(int argc, char **argv)
73{ 73{
74 int recursiveFlag=FALSE; 74 int recursiveFlag=FALSE;
75 char *groupName; 75 char *groupName;
76 const char *appUsage;
76 77
77 whichApp = (strcmp(*argv, "chown")==0)? CHOWN_APP : (strcmp(*argv, "chmod")==0)? CHMOD_APP : CHGRP_APP; 78 whichApp = (strcmp(*argv, "chown")==0)? CHOWN_APP : (strcmp(*argv, "chmod")==0)? CHMOD_APP : CHGRP_APP;
78 79
79 if (argc < 2) { 80 appUsage = (whichApp==CHOWN_APP)? chown_usage : (whichApp==CHMOD_APP)? chmod_usage : chgrp_usage;
80 fprintf(stderr, "Usage: %s %s", *argv, 81
81 (whichApp==TRUE)? chown_usage : chgrp_usage); 82 if (argc < 2)
82 exit( FALSE); 83 usage( appUsage);
83 }
84 invocationName=*argv; 84 invocationName=*argv;
85 argc--; 85 argc--;
86 argv++; 86 argv++;
@@ -93,7 +93,7 @@ int chmod_chown_chgrp_main(int argc, char **argv)
93 break; 93 break;
94 default: 94 default:
95 fprintf(stderr, "Unknown option: %c\n", **argv); 95 fprintf(stderr, "Unknown option: %c\n", **argv);
96 exit( FALSE); 96 usage( appUsage);
97 } 97 }
98 argc--; 98 argc--;
99 argv++; 99 argv++;