FreeCalypso > hg > freecalypso-tools
comparison rvinterf/tmsh/saverftab.c @ 140:e6c265bf5a6d
fc-tmsh: save-rf-table-raw command implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 26 Feb 2017 23:26:30 +0000 |
parents | b5e3899b1265 |
children | 6b01d4ef85c3 |
comparison
equal
deleted
inserted
replaced
139:b5e3899b1265 | 140:e6c265bf5a6d |
---|---|
77 } | 77 } |
78 tp->func(rftr_table_data, outf); | 78 tp->func(rftr_table_data, outf); |
79 fclose(outf); | 79 fclose(outf); |
80 return(0); | 80 return(0); |
81 } | 81 } |
82 | |
83 cmd_save_rf_table_raw(argc, argv) | |
84 char **argv; | |
85 { | |
86 FILE *outf; | |
87 int off, l, j; | |
88 | |
89 if (!rftr_table_size) { | |
90 printf("error: no RF table has been received\n"); | |
91 return(ERROR_TARGET); | |
92 } | |
93 outf = fopen(argv[1], "w"); | |
94 if (!outf) { | |
95 perror(argv[1]); | |
96 return(ERROR_UNIX); | |
97 } | |
98 fputs("rf_table raw\n\n", outf); | |
99 for (off = 0; off < rftr_table_size; ) { | |
100 l = rftr_table_size - off; | |
101 if (l > 16) | |
102 l = 16; | |
103 for (j = 0; j < l; j++) { | |
104 if (j) | |
105 putc(' ', outf); | |
106 if (j == 8) | |
107 putc(' ', outf); | |
108 fprintf(outf, "%02X", rftr_table_data[off++]); | |
109 } | |
110 putc('\n', outf); | |
111 } | |
112 fclose(outf); | |
113 return(0); | |
114 } |