diff options
-rw-r--r-- | mico-dump.c | 9 | ||||
-rw-r--r-- | mico-store.c | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/mico-dump.c b/mico-dump.c index 37ed025..cd80609 100644 --- a/mico-dump.c +++ b/mico-dump.c @@ -82,9 +82,14 @@ get1(struct bitreader *input) } int -main() +main(int argc, char *argv[]) { - zip = zip_open("out.zip", ZIP_RDONLY, 0); + if (argc < 2) { + fprintf(stderr, "usage: %s input.zip\n", argv[0]); + exit(-1); + } + + zip = zip_open(argv[1], ZIP_RDONLY, 0); int entries = zip_get_num_entries(zip, 0); diff --git a/mico-store.c b/mico-store.c index 9cf4aaa..ade4788 100644 --- a/mico-store.c +++ b/mico-store.c @@ -105,7 +105,7 @@ put1(struct bitfile *bf, int64_t v) } int -main() +main(int argc, char *argv[]) { sh_new_arena(metrics); @@ -117,6 +117,11 @@ main() ssize_t linelen = 0; int i = 0; + if (argc < 2) { + fprintf(stderr, "usage: %s output.zip\n", argv[0]); + exit(-1); + } + while ((linelen = getdelim(&line, &linebuflen, '\n', stdin)) >= 0) { char *start = strchr(line, ' '); if (!start) break; @@ -159,7 +164,7 @@ main() arrlen(metrics[i].value)); } - zip_t *zip = zip_open("out.zip", ZIP_CREATE | ZIP_TRUNCATE, 0); + zip_t *zip = zip_open(argv[1], ZIP_CREATE | ZIP_TRUNCATE, 0); if (!zip) exit(-1); |