diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-22 08:42:06 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-22 08:42:06 +0000 |
| commit | f47ff100cc7d7009da6186c7ceec609f211156c8 (patch) | |
| tree | a6bb80b5db5f82a4f2c977a253ce31657728791d /util-linux | |
| parent | cad36681d2a1f502824c19d85ebf59dc90c40524 (diff) | |
| download | busybox-w32-f47ff100cc7d7009da6186c7ceec609f211156c8.tar.gz busybox-w32-f47ff100cc7d7009da6186c7ceec609f211156c8.tar.bz2 busybox-w32-f47ff100cc7d7009da6186c7ceec609f211156c8.zip | |
getopt: fix whitespace damage
Diffstat (limited to 'util-linux')
| -rw-r--r-- | util-linux/getopt.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/util-linux/getopt.c b/util-linux/getopt.c index bf05f9164..a4968b72e 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c | |||
| @@ -56,7 +56,7 @@ static int alternative; /* 0 is getopt_long, 1 is getopt_long_only */ | |||
| 56 | /* Function prototypes */ | 56 | /* Function prototypes */ |
| 57 | static const char *normalize(const char *arg); | 57 | static const char *normalize(const char *arg); |
| 58 | static int generate_output(char * argv[],int argc,const char *optstr, | 58 | static int generate_output(char * argv[],int argc,const char *optstr, |
| 59 | const struct option *longopts); | 59 | const struct option *longopts); |
| 60 | static void add_long_options(char *options); | 60 | static void add_long_options(char *options); |
| 61 | static void add_longopt(const char *name,int has_arg); | 61 | static void add_longopt(const char *name,int has_arg); |
| 62 | static void set_shell(const char *new_shell); | 62 | static void set_shell(const char *new_shell); |
| @@ -80,7 +80,7 @@ const char *normalize(const char *arg) | |||
| 80 | free(BUFFER); | 80 | free(BUFFER); |
| 81 | 81 | ||
| 82 | if (!quote) { /* Just copy arg */ | 82 | if (!quote) { /* Just copy arg */ |
| 83 | BUFFER=xstrdup(arg); | 83 | BUFFER=xstrdup(arg); |
| 84 | return BUFFER; | 84 | return BUFFER; |
| 85 | } | 85 | } |
| 86 | 86 | ||
| @@ -134,7 +134,7 @@ const char *normalize(const char *arg) | |||
| 134 | * Other settings are found in global variables. | 134 | * Other settings are found in global variables. |
| 135 | */ | 135 | */ |
| 136 | int generate_output(char * argv[],int argc,const char *optstr, | 136 | int generate_output(char * argv[],int argc,const char *optstr, |
| 137 | const struct option *longopts) | 137 | const struct option *longopts) |
| 138 | { | 138 | { |
| 139 | int exit_code = 0; /* We assume everything will be OK */ | 139 | int exit_code = 0; /* We assume everything will be OK */ |
| 140 | int opt; | 140 | int opt; |
| @@ -146,8 +146,8 @@ int generate_output(char * argv[],int argc,const char *optstr, | |||
| 146 | optind=0; /* Reset getopt(3) */ | 146 | optind=0; /* Reset getopt(3) */ |
| 147 | 147 | ||
| 148 | while ((opt = (alternative? | 148 | while ((opt = (alternative? |
| 149 | getopt_long_only(argc,argv,optstr,longopts,&longindex): | 149 | getopt_long_only(argc,argv,optstr,longopts,&longindex): |
| 150 | getopt_long(argc,argv,optstr,longopts,&longindex))) | 150 | getopt_long(argc,argv,optstr,longopts,&longindex))) |
| 151 | != EOF) | 151 | != EOF) |
| 152 | if (opt == '?' || opt == ':' ) | 152 | if (opt == '?' || opt == ':' ) |
| 153 | exit_code = 1; | 153 | exit_code = 1; |
| @@ -156,7 +156,7 @@ int generate_output(char * argv[],int argc,const char *optstr, | |||
| 156 | printf(" --%s",longopts[longindex].name); | 156 | printf(" --%s",longopts[longindex].name); |
| 157 | if (longopts[longindex].has_arg) | 157 | if (longopts[longindex].has_arg) |
| 158 | printf(" %s", | 158 | printf(" %s", |
| 159 | normalize(optarg?optarg:"")); | 159 | normalize(optarg?optarg:"")); |
| 160 | } else if (opt == NON_OPT) | 160 | } else if (opt == NON_OPT) |
| 161 | printf(" %s",normalize(optarg)); | 161 | printf(" %s",normalize(optarg)); |
| 162 | else { | 162 | else { |
| @@ -164,7 +164,7 @@ int generate_output(char * argv[],int argc,const char *optstr, | |||
| 164 | charptr = strchr(optstr,opt); | 164 | charptr = strchr(optstr,opt); |
| 165 | if (charptr != NULL && *++charptr == ':') | 165 | if (charptr != NULL && *++charptr == ':') |
| 166 | printf(" %s", | 166 | printf(" %s", |
| 167 | normalize(optarg?optarg:"")); | 167 | normalize(optarg?optarg:"")); |
| 168 | } | 168 | } |
| 169 | } | 169 | } |
| 170 | 170 | ||
| @@ -209,7 +209,7 @@ void add_longopt(const char *name,int has_arg) | |||
| 209 | long_options[long_options_nr-1].has_arg=has_arg; | 209 | long_options[long_options_nr-1].has_arg=has_arg; |
| 210 | long_options[long_options_nr-1].flag=NULL; | 210 | long_options[long_options_nr-1].flag=NULL; |
| 211 | long_options[long_options_nr-1].val=LONG_OPT; | 211 | long_options[long_options_nr-1].val=LONG_OPT; |
| 212 | long_options[long_options_nr-1].name=xstrdup(name); | 212 | long_options[long_options_nr-1].name=xstrdup(name); |
| 213 | } | 213 | } |
| 214 | long_options_nr++; | 214 | long_options_nr++; |
| 215 | } | 215 | } |
| @@ -305,7 +305,7 @@ int getopt_main(int argc, char *argv[]) | |||
| 305 | /* For some reason, the original getopt gave no error | 305 | /* For some reason, the original getopt gave no error |
| 306 | when there were no arguments. */ | 306 | when there were no arguments. */ |
| 307 | printf(" --\n"); | 307 | printf(" --\n"); |
| 308 | return 0; | 308 | return 0; |
| 309 | } else | 309 | } else |
| 310 | bb_error_msg_and_die("missing optstring argument"); | 310 | bb_error_msg_and_die("missing optstring argument"); |
| 311 | } | 311 | } |
| @@ -317,7 +317,7 @@ int getopt_main(int argc, char *argv[]) | |||
| 317 | s=xmalloc(strlen(argv[1])+1); | 317 | s=xmalloc(strlen(argv[1])+1); |
| 318 | strcpy(s,argv[1]+strspn(argv[1],"-+")); | 318 | strcpy(s,argv[1]+strspn(argv[1],"-+")); |
| 319 | argv[1]=argv[0]; | 319 | argv[1]=argv[0]; |
| 320 | return (generate_output(argv+1,argc-1,s,long_options)); | 320 | return (generate_output(argv+1,argc-1,s,long_options)); |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | while ((opt=getopt_long(argc,argv,shortopts,longopts,NULL)) != EOF) | 323 | while ((opt=getopt_long(argc,argv,shortopts,longopts,NULL)) != EOF) |
| @@ -326,13 +326,13 @@ int getopt_main(int argc, char *argv[]) | |||
| 326 | alternative=1; | 326 | alternative=1; |
| 327 | break; | 327 | break; |
| 328 | case 'o': | 328 | case 'o': |
| 329 | optstr = optarg; | 329 | optstr = optarg; |
| 330 | break; | 330 | break; |
| 331 | case 'l': | 331 | case 'l': |
| 332 | add_long_options(optarg); | 332 | add_long_options(optarg); |
| 333 | break; | 333 | break; |
| 334 | case 'n': | 334 | case 'n': |
| 335 | name = optarg; | 335 | name = optarg; |
| 336 | break; | 336 | break; |
| 337 | case 'q': | 337 | case 'q': |
| 338 | quiet_errors=1; | 338 | quiet_errors=1; |
| @@ -344,7 +344,7 @@ int getopt_main(int argc, char *argv[]) | |||
| 344 | set_shell(optarg); | 344 | set_shell(optarg); |
| 345 | break; | 345 | break; |
| 346 | case 'T': | 346 | case 'T': |
| 347 | return 4; | 347 | return 4; |
| 348 | case 'u': | 348 | case 'u': |
| 349 | quote=0; | 349 | quote=0; |
| 350 | break; | 350 | break; |
| @@ -361,5 +361,5 @@ int getopt_main(int argc, char *argv[]) | |||
| 361 | argv[optind-1]=name; | 361 | argv[optind-1]=name; |
| 362 | else | 362 | else |
| 363 | argv[optind-1]=argv[0]; | 363 | argv[optind-1]=argv[0]; |
| 364 | return (generate_output(argv+optind-1,argc-optind+1,optstr,long_options)); | 364 | return generate_output(argv+optind-1,argc-optind+1,optstr,long_options); |
| 365 | } | 365 | } |
