changeset 108:e17940d7ce35

fc-simtool a38: support output redirection
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 19 Feb 2021 06:45:42 +0000
parents f1836c8d36cb
children 8a27f45bc1e6
files simtool/a38.c simtool/dispatch.c
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/simtool/a38.c	Fri Feb 19 06:43:01 2021 +0000
+++ b/simtool/a38.c	Fri Feb 19 06:45:42 2021 +0000
@@ -9,8 +9,9 @@
 #include <stdlib.h>
 #include "simresp.h"
 
-cmd_a38(argc, argv)
+cmd_a38(argc, argv, outf)
 	char **argv;
+	FILE *outf;
 {
 	u_char cmd[21];
 	int rc;
@@ -50,9 +51,9 @@
 			sim_resp_data_len);
 		return(-1);
 	}
-	printf("SRES: %02X %02X %02X %02X\n", sim_resp_data[0],
+	fprintf(outf, "SRES: %02X %02X %02X %02X\n", sim_resp_data[0],
 		sim_resp_data[1], sim_resp_data[2], sim_resp_data[3]);
-	printf("Kc: %02X %02X %02X %02X %02X %02X %02X %02X\n",
+	fprintf(outf, "Kc: %02X %02X %02X %02X %02X %02X %02X %02X\n",
 		sim_resp_data[4], sim_resp_data[5], sim_resp_data[6],
 		sim_resp_data[7], sim_resp_data[8], sim_resp_data[9],
 		sim_resp_data[10], sim_resp_data[11]);
--- a/simtool/dispatch.c	Fri Feb 19 06:43:01 2021 +0000
+++ b/simtool/dispatch.c	Fri Feb 19 06:45:42 2021 +0000
@@ -92,7 +92,7 @@
 	int allow_redir;
 	int (*func)();
 } cmdtab[] = {
-	{"a38", 1, 1, 0, cmd_a38},
+	{"a38", 1, 1, 1, cmd_a38},
 	{"atr", 0, 0, 0, retrieve_atr},
 	{"change-chv1", 2, 2, 0, cmd_change_chv},
 	{"change-chv2", 2, 2, 0, cmd_change_chv},