diff --git a/README.md b/README.md index 7d4423c..35ddf44 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,6 @@ And then just iterate `argv`: ```c int main(int argc, char *argv[]) { - char identifier; bool simple_flag = false, multiple_flag = false, long_flag = false; const char *value = NULL; int param_index; @@ -84,8 +83,7 @@ int main(int argc, char *argv[]) cag_option_context context; cag_option_init(&context, options, CAG_ARRAY_SIZE(options), argc, argv); while (cag_option_fetch(&context)) { - identifier = cag_option_get_identifier(&context); - switch (identifier) { + switch (cag_option_get_identifier(&context)) { case 's': simple_flag = true; break; @@ -113,11 +111,6 @@ int main(int argc, char *argv[]) printf("simple_flag: %i, multiple_flag: %i, long_flag: %i, key: %s\n", simple_flag, multiple_flag, long_flag, value ? value : "-"); - for (param_index = cag_option_get_index(&context); param_index < argc; - ++param_index) { - printf("additional parameter: %s\n", argv[param_index]); - } - return EXIT_SUCCESS; } diff --git a/demo/main.c b/demo/main.c index e62f5db..21bce69 100755 --- a/demo/main.c +++ b/demo/main.c @@ -34,7 +34,6 @@ static struct cag_option options[] = { int main(int argc, char *argv[]) { - char identifier; bool simple_flag = false, multiple_flag = false, long_flag = false; const char *value = NULL; int param_index; @@ -42,8 +41,7 @@ int main(int argc, char *argv[]) cag_option_context context; cag_option_init(&context, options, CAG_ARRAY_SIZE(options), argc, argv); while (cag_option_fetch(&context)) { - identifier = cag_option_get_identifier(&context); - switch (identifier) { + switch (cag_option_get_identifier(&context)) { case 's': simple_flag = true; break; diff --git a/docs/index.md b/docs/index.md index 43bee7e..2d1ddc7 100644 --- a/docs/index.md +++ b/docs/index.md @@ -45,7 +45,6 @@ static struct cag_option options[] = { int main(int argc, char *argv[]) { - char identifier; bool simple_flag = false, multiple_flag = false, long_flag = false; const char *value = NULL; int param_index; @@ -53,8 +52,7 @@ int main(int argc, char *argv[]) cag_option_context context; cag_option_init(&context, options, CAG_ARRAY_SIZE(options), argc, argv); while (cag_option_fetch(&context)) { - identifier = cag_option_get_identifier(&context); - switch (identifier) { + switch (cag_option_get_identifier(&context)) { case 's': simple_flag = true; break;