FreeCalypso > hg > fc-pcsc-tools
comparison simtool/fplmn.c @ 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 | 9b2cb2b9c910 |
children | 3ddbc3fea5f0 |
comparison
equal
deleted
inserted
replaced
108:e17940d7ce35 | 109:8a27f45bc1e6 |
---|---|
35 return(-1); | 35 return(-1); |
36 } | 36 } |
37 return(0); | 37 return(0); |
38 } | 38 } |
39 | 39 |
40 cmd_fplmn_dump(argc, argv) | 40 cmd_fplmn_dump(argc, argv, outf) |
41 char **argv; | 41 char **argv; |
42 FILE *outf; | |
42 { | 43 { |
43 int rc; | 44 int rc; |
44 u_char *dp; | 45 u_char *dp; |
45 char ascbuf[8]; | 46 char ascbuf[8]; |
46 unsigned idx; | 47 unsigned idx; |
52 if (rc < 0) | 53 if (rc < 0) |
53 return(rc); | 54 return(rc); |
54 dp = sim_resp_data; | 55 dp = sim_resp_data; |
55 for (idx = 0; idx < 4; idx++, dp += 3) { | 56 for (idx = 0; idx < 4; idx++, dp += 3) { |
56 if (idx) | 57 if (idx) |
57 putchar(' '); | 58 putc(' ', outf); |
58 if (dp[0] == 0xFF && dp[1] == 0xFF && dp[2] == 0xFF) | 59 if (dp[0] == 0xFF && dp[1] == 0xFF && dp[2] == 0xFF) |
59 fputs("-blank-", stdout); | 60 fputs("-blank-", outf); |
60 else { | 61 else { |
61 decode_plmn_3bytes(dp, ascbuf, 1); | 62 decode_plmn_3bytes(dp, ascbuf, 1); |
62 fputs(ascbuf, stdout); | 63 fputs(ascbuf, outf); |
63 } | 64 } |
64 } | 65 } |
65 putchar('\n'); | 66 putc('\n', outf); |
66 return(0); | 67 return(0); |
67 } | 68 } |
68 | 69 |
69 cmd_fplmn_write(argc, argv) | 70 cmd_fplmn_write(argc, argv) |
70 char **argv; | 71 char **argv; |