Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #72 from ploxiln/options_parse_cs

options parsing codestyle tweak
  • Loading branch information...
commit 708d16775b314cd85a31a221a18fe65fd3383d3b 2 parents eb1e9da + 479f542
@mreiferson mreiferson authored
Showing with 4 additions and 6 deletions.
  1. +4 −6 simplehttp/options.c
View
10 simplehttp/options.c
@@ -87,16 +87,14 @@ int option_parse_command_line(int argc, char **argv)
fprintf(stderr, "ERROR: invalid argument \"%s\"\n", option_str);
return 0;
}
- option_name = strchr(option_str, '-');
- option_name++;
- option_name = strchr(option_name, '-');
- option_name++;
+ option_name = option_str + 2;
value = strchr(option_name, '=');
- option_name_len = strlen(option_str) - (option_name - option_str);
if (value != NULL) {
- option_name_len -= strlen(value);
+ option_name_len = value - option_name;
*value = '\0';
value++;
+ } else {
+ option_name_len = strlen(option_name);
}
if (format_option_name(option_name)) {
fprintf(stderr, "ERROR: unknown option \"--%s\"\n", option_name); // option_str ?
Please sign in to comment.
Something went wrong with that request. Please try again.