--- trunk/darkstattype.c 2014/03/21 16:59:56 13 +++ trunk/darkstattype.c 2014/03/21 18:35:50 14 @@ -78,22 +78,26 @@ int main(int argc, char **argv) argc -= optind; argv += optind; - if (argv[0] == NULL) { + if (*argv == NULL) { fprintf(stderr, "%s: missing filename\n\n", progname); show_usage(EXIT_FAILURE); } // if - filename = argv[0]; + while (*argv != NULL) { + filename = *argv; - decode_file(); + decode_file(); + argv++; + } // while + return EXIT_SUCCESS; } // main() void show_usage(int exitcode) { fprintf((exitcode == EXIT_SUCCESS) ? stdout : stderr, - "Usage: %s [-f] [-h] [-v] filename\n" + "Usage: %s [-f] [-h] [-v] filename ...\n" " E.g.: %s darkstat.db\n\n" "Options:\n" @@ -208,6 +212,11 @@ void decode_file(void) } // for exdent(); + + if (fclose(file) != 0) { + fprintf(stderr, "%s: fclose(\"%s\") = %s (%d)\n", progname, filename, strerror(errno), errno); + exit(EXIT_FAILURE); + } // if } // decode_file() void decode_host_db_v1(void)