}
if (!vec_size(items)) {
- FILE *src;
- char *line;
+ FILE *src;
+ char *line = NULL;
size_t linelen = 0;
+ bool hasline = false;
progs_src = true;
goto cleanup;
}
- line = NULL;
- if (!progs_nextline(&line, &linelen, src) || !line[0]) {
- con_err("illformatted progs.src file: expected output filename in first line\n");
- retval = 1;
- goto srcdone;
- }
-
- if (!opts_output_wasset) {
- OPTS_OPTION_STR(OPTION_OUTPUT) = util_strdup(line);
- opts_output_free = true;
- }
-
while (progs_nextline(&line, &linelen, src)) {
argitem item;
+
if (!line[0] || (line[0] == '/' && line[1] == '/'))
continue;
- item.filename = util_strdup(line);
- item.type = TYPE_QC;
- vec_push(items, item);
+
+ if (hasline) {
+ item.filename = util_strdup(line);
+ item.type = TYPE_QC;
+ vec_push(items, item);
+ } else if (!opts_output_wasset) {
+ OPTS_OPTION_STR(OPTION_OUTPUT) = util_strdup(line);
+ opts_output_free = true;
+ hasline = true;
+ }
}
-srcdone:
fs_file_close(src);
mem_d(line);
}