summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2023-10-13 23:03:02 +0200
committerLeah Neukirchen <leah@vuxu.org>2023-10-13 23:03:02 +0200
commit65c4ebf3102f9970b18c3dd0445f1128f1f683f9 (patch)
treecdedcd1d16d2780002526c482c3f1427796e7c31
parent6660e95842fb64a98601d835362da992ab890db0 (diff)
downloadmico-65c4ebf3102f9970b18c3dd0445f1128f1f683f9.tar.gz
mico-65c4ebf3102f9970b18c3dd0445f1128f1f683f9.tar.xz
mico-65c4ebf3102f9970b18c3dd0445f1128f1f683f9.zip
use argv for filenames
-rw-r--r--mico-dump.c9
-rw-r--r--mico-store.c9
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);