# HG changeset patch # User Mychaela Falconia # Date 1613717594 0 # Node ID 8a27f45bc1e697497e8d2cb6c60ad4ba6658f35b # Parent e17940d7ce3585fd5954a6c9f6c32045d7d2b79c fc-simtool fplmn-dump: support output redirection diff -r e17940d7ce35 -r 8a27f45bc1e6 simtool/dispatch.c --- 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}, diff -r e17940d7ce35 -r 8a27f45bc1e6 simtool/fplmn.c --- 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); }