changeset 116:9c16cf1a79af

fc-simtool sst: support output redirection
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 19 Feb 2021 07:30:17 +0000
parents f1ea981ab225
children b89bc690dec4
files simtool/dispatch.c simtool/sstlist.c
diffstat 2 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/simtool/dispatch.c	Fri Feb 19 07:26:15 2021 +0000
+++ b/simtool/dispatch.c	Fri Feb 19 07:30:17 2021 +0000
@@ -167,7 +167,7 @@
 	{"smsp-set", 2, 6, 0, cmd_smsp_set},
 	{"smsp-set-tag", 3, 7, 0, cmd_smsp_set_tag},
 	{"spn", 0, 0, 1, cmd_spn},
-	{"sst", 0, 0, 0, cmd_sst},
+	{"sst", 0, 0, 1, cmd_sst},
 	{"telecom-sum", 0, 0, 0, cmd_telecom_sum},
 	{"uicc-dir", 0, 0, 1, cmd_uicc_dir},
 	{"unblock-chv1", 2, 2, 0, cmd_unblock_chv},
--- a/simtool/sstlist.c	Fri Feb 19 07:26:15 2021 +0000
+++ b/simtool/sstlist.c	Fri Feb 19 07:30:17 2021 +0000
@@ -10,7 +10,9 @@
 #include "curfile.h"
 #include "file_id.h"
 
-cmd_sst()
+cmd_sst(argc, argv, outf)
+	char **argv;
+	FILE *outf;
 {
 	int rc;
 	unsigned byte, pos, code, nserv, linelen;
@@ -48,21 +50,21 @@
 			if (!(code & 1))
 				continue;
 			if (linelen > 73) {
-				putchar('\n');
+				putc('\n', outf);
 				linelen = 0;
 			}
 			if (linelen) {
-				putchar(' ');
+				putc(' ', outf);
 				linelen++;
 			}
-			linelen += printf("%u", nserv);
+			linelen += fprintf(outf, "%u", nserv);
 			if (!(code & 2)) {
-				putchar('^');
+				putc('^', outf);
 				linelen++;
 			}
 		}
 	}
 	if (linelen)
-		putchar('\n');
+		putc('\n', outf);
 	return(0);
 }