changeset 219:e3bbb8cfbbc0

pircalextr: added second argument for output directory
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 28 May 2017 20:33:26 +0000
parents b6a95d35fabc
children 2cc7a17c3859
files miscprog/pircalextr.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/miscprog/pircalextr.c	Sun May 28 20:12:14 2017 +0000
+++ b/miscprog/pircalextr.c	Sun May 28 20:33:26 2017 +0000
@@ -155,11 +155,15 @@
 	struct calmap *tp;
 	FILE *of;
 
-	if (argc != 2) {
-		fprintf(stderr, "usage: %s fact.bin\n", argv[0]);
+	if (argc != 3) {
+		fprintf(stderr, "usage: %s fact.bin outdir\n", argv[0]);
 		exit(1);
 	}
 	read_factory_struct(argv[1]);
+	if (chdir(argv[2]) < 0) {
+		perror(argv[2]);
+		exit(1);
+	}
 	for (tp = pirelli_cal_map; tp->outfile; tp++) {
 		of = fopen(tp->outfile, "w");
 		if (!of) {