1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-12-04 14:46:31 -05:00

Make cmdline_parse() restartable

This commit is contained in:
Moritz Grimm 2017-07-07 16:34:47 +02:00
parent 56694daa9d
commit 71e5820df1
2 changed files with 1 additions and 5 deletions

View File

@ -101,6 +101,7 @@ cmdline_parse(int argc, char *argv[], int *ret_p)
_set_program_name(argv[0]); _set_program_name(argv[0]);
optind = 1;
for (;;) { for (;;) {
ch = getopt(argc, argv, OPTSTRING); ch = getopt(argc, argv, OPTSTRING);
if (0 > ch) if (0 > ch)

View File

@ -7,8 +7,6 @@ Suite * cmdline_suite(void);
void setup_checked(void); void setup_checked(void);
void teardown_checked(void); void teardown_checked(void);
extern int optind;
START_TEST(test_configfile) START_TEST(test_configfile)
{ {
char *argv[] = char *argv[] =
@ -102,11 +100,9 @@ START_TEST(test_verbose)
ck_assert_int_ne(cmdline_parse(argc, argv, &ret), 0); ck_assert_int_ne(cmdline_parse(argc, argv, &ret), 0);
ck_assert_uint_eq(cfg_get_program_verbosity(), 1); ck_assert_uint_eq(cfg_get_program_verbosity(), 1);
optind = 1;
ck_assert_int_ne(cmdline_parse(argc2, argv2, &ret), 0); ck_assert_int_ne(cmdline_parse(argc2, argv2, &ret), 0);
ck_assert_uint_eq(cfg_get_program_verbosity(), 2); ck_assert_uint_eq(cfg_get_program_verbosity(), 2);
optind = 1;
ck_assert_int_ne(cmdline_parse(argc3, argv3, &ret), 0); ck_assert_int_ne(cmdline_parse(argc3, argv3, &ret), 0);
ck_assert_uint_eq(cfg_get_program_verbosity(), 3); ck_assert_uint_eq(cfg_get_program_verbosity(), 3);
@ -153,7 +149,6 @@ setup_checked(void)
{ {
if (0 < cfg_init()) if (0 < cfg_init())
ck_abort_msg("setup_checked failed"); ck_abort_msg("setup_checked failed");
optind = 1;
} }
void void