changeset 109:8a27f45bc1e6

fc-simtool fplmn-dump: support output redirection
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 19 Feb 2021 06:53:14 +0000
parents e17940d7ce35
children 2aa92dfcb4b5
files simtool/dispatch.c simtool/fplmn.c
diffstat 2 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/simtool/dispatch.c	Fri Feb 19 06:45:42 2021 +0000
+++ b/simtool/dispatch.c	Fri Feb 19 06:53:14 2021 +0000
@@ -109,7 +109,7 @@
 	{"exec", 1, 1, 0, cmd_exec},
 	{"exit", 0, 0, 0, good_exit},
 	{"fix-sysmo-msisdn", 0, 0, 0, cmd_fix_sysmo_msisdn},
-	{"fplmn-dump", 0, 0, 0, cmd_fplmn_dump},
+	{"fplmn-dump", 0, 0, 1, cmd_fplmn_dump},
 	{"fplmn-erase", 1, 2, 0, cmd_fplmn_erase},
 	{"fplmn-erase-all", 0, 0, 0, cmd_fplmn_erase_all},
 	{"fplmn-write", 2, 2, 0, cmd_fplmn_write},
--- a/simtool/fplmn.c	Fri Feb 19 06:45:42 2021 +0000
+++ b/simtool/fplmn.c	Fri Feb 19 06:53:14 2021 +0000
@@ -37,8 +37,9 @@
 	return(0);
 }
 
-cmd_fplmn_dump(argc, argv)
+cmd_fplmn_dump(argc, argv, outf)
 	char **argv;
+	FILE *outf;
 {
 	int rc;
 	u_char *dp;
@@ -54,15 +55,15 @@
 	dp = sim_resp_data;
 	for (idx = 0; idx < 4; idx++, dp += 3) {
 		if (idx)
-			putchar(' ');
+			putc(' ', outf);
 		if (dp[0] == 0xFF && dp[1] == 0xFF && dp[2] == 0xFF)
-			fputs("-blank-", stdout);
+			fputs("-blank-", outf);
 		else {
 			decode_plmn_3bytes(dp, ascbuf, 1);
-			fputs(ascbuf, stdout);
+			fputs(ascbuf, outf);
 		}
 	}
-	putchar('\n');
+	putc('\n', outf);
 	return(0);
 }