39 char* assistant_getcfg(char *cfgname) { |
39 char* assistant_getcfg(char *cfgname) { |
40 sstr_t line; |
40 sstr_t line; |
41 char *value = NULL; |
41 char *value = NULL; |
42 while(!value) { |
42 while(!value) { |
43 printf("%s: ", cfgname); |
43 printf("%s: ", cfgname); |
|
44 fflush(stdout); |
44 line = util_readline(stdin); |
45 line = util_readline(stdin); |
45 if(line.length == 0 || !line.ptr) { |
46 if(line.length == 0 || !line.ptr) { |
46 fprintf(stderr, "%s must be not empty\n", cfgname); |
47 fprintf(stderr, "%s must be not empty\n", cfgname); |
47 continue; |
48 continue; |
48 } |
49 } |
86 char* assistant_getdefcfg(char *cfgname, char *defval) { |
89 char* assistant_getdefcfg(char *cfgname, char *defval) { |
87 sstr_t line; |
90 sstr_t line; |
88 char *value = NULL; |
91 char *value = NULL; |
89 while(!value) { |
92 while(!value) { |
90 printf("%s (default: %s): ", cfgname, defval); |
93 printf("%s (default: %s): ", cfgname, defval); |
|
94 fflush(stdout); |
91 line = util_readline(stdin); |
95 line = util_readline(stdin); |
92 if(line.length == 0 || !line.ptr) { |
96 if(line.length == 0 || !line.ptr) { |
93 if(line.ptr) { |
97 if(line.ptr) { |
94 free(line.ptr); |
98 free(line.ptr); |
95 } |
99 } |