484 |
token_t |
token_t |
485 |
parse_percent_token (void) |
parse_percent_token (void) |
486 |
{ |
{ |
487 |
const struct option_table_struct *tx = NULL; |
const struct option_table_s *tx = NULL; |
488 |
const char *arg = NULL; |
const char *arg = NULL; |
489 |
/* Where the ARG was found in token_buffer. */ |
/* Where the ARG was found in token_buffer. */ |
490 |
size_t arg_offset = 0; |
size_t arg_offset = 0; |
578 |
switch (tx->ret_val) |
switch (tx->ret_val) |
579 |
{ |
{ |
580 |
case tok_stropt: |
case tok_stropt: |
581 |
assert (tx->set_flag); |
assert (tx->flag); |
582 |
if (arg) |
if (arg) |
583 |
{ |
{ |
584 |
|
char **flag = (char **) tx->flag; |
585 |
/* Keep only the first assignment: command line options have |
/* Keep only the first assignment: command line options have |
586 |
already been processed, and we want them to have |
already been processed, and we want them to have |
587 |
precedence. Side effect: if this %-option is used |
precedence. Side effect: if this %-option is used |
588 |
several times, only the first is honored. Bah. */ |
several times, only the first is honored. Bah. */ |
589 |
if (!*((char **) (tx->set_flag))) |
if (!*flag) |
590 |
*((char **) (tx->set_flag)) = xstrdup (arg); |
*flag = xstrdup (arg); |
591 |
} |
} |
592 |
else |
else |
593 |
fatal (_("`%s' requires an argument"), token_buffer); |
fatal (_("`%s' requires an argument"), token_buffer); |
595 |
break; |
break; |
596 |
|
|
597 |
case tok_intopt: |
case tok_intopt: |
598 |
assert (tx->set_flag); |
assert (tx->flag); |
599 |
*((int *) (tx->set_flag)) = 1; |
*((int *) (tx->flag)) = 1; |
600 |
return tok_noop; |
return tok_noop; |
601 |
break; |
break; |
602 |
|
|