Когда я использую -f, я получаю ошибку сегментации ошибки, есть идеи?опция -f предназначена для выбора входного файла.
struct list_names filenames;
list_names_init(&filenames, "filenames");
optind = 1;
while ((ch = getopt(argc, argv, ":hvf:")) != -1) //where getopt defined
{
switch (ch) {
case 'h':
printf("usage: ./hake [-h] [-v] [-f file]\n-h print help\n-v verbose mode; enable extra printing; can be repeated\n");
printf("-f file input filename; default is hakefile or Hakefile");
break;
case 'v':
verbose = 1;
break;
case 'f':
f_flag++;
list_names_append_from_file(&filenames, optarg);
printf("Read_file%s\n",optarg);
read_file(optarg);
break;