check_stdin();
case oldaskconfig:
fflush(stdout);
- fgets(line, 128, stdin);
+ xfgets(line, 128, stdin);
return 1;
default:
break;
check_stdin();
case oldaskconfig:
fflush(stdout);
- fgets(line, 128, stdin);
+ xfgets(line, 128, stdin);
strip(line);
if (line[0] == '?') {
print_help(menu);
break;
case savedefconfig:
break;
- case oldconfig:
case oldaskconfig:
rootEntry = &rootmenu;
conf(&rootmenu);
input_mode = silentoldconfig;
/* fall through */
+ case oldconfig:
case listnewconfig:
case oldnoconfig:
case silentoldconfig:
}
return 0;
}
+ /*
+ * Helper function to facilitate fgets() by Jean Sacren.
+ */
+ void xfgets(str, size, in)
+ char *str;
+ int size;
+ FILE *in;
+ {
+ if (fgets(str, size, in) == NULL)
+ fprintf(stderr, "\nError in reading or end of file.\n");
+ }