Skip to content

Commit

Permalink
removed unnecessary variable
Browse files Browse the repository at this point in the history
  • Loading branch information
likle committed Jan 7, 2024
1 parent f7b2249 commit fefca31
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,14 @@ 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;
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;
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 1 addition & 3 deletions demo/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@ 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;

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;
Expand Down
4 changes: 1 addition & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,14 @@ 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;

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;
Expand Down

0 comments on commit fefca31

Please sign in to comment.