comparison rvinterf/lowlevel/format_fc.c @ 927:4e243402f453

rvinterf/lowlevel: use libprint for backslash-escape output
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 23 May 2023 03:59:42 +0000
parents e7502631a0f9
children 65953c172f24
comparison
equal deleted inserted replaced
926:6a0aa8d36d06 927:4e243402f453
16 static char fmtbuf[MAX_PKT_FROM_TARGET*8]; /* size it generously */ 16 static char fmtbuf[MAX_PKT_FROM_TARGET*8]; /* size it generously */
17 17
18 void 18 void
19 print_ati_output() 19 print_ati_output()
20 { 20 {
21 int i, c; 21 strcpy(fmtbuf, "ATI: ");
22 char *dp; 22 safe_print_trace(rxpkt + 1, rxpkt_len - 1, fmtbuf + 5);
23
24 dp = fmtbuf;
25 strcpy(dp, "ATI: ");
26 dp += 5;
27 for (i = 1; i < rxpkt_len; i++) {
28 c = rxpkt[i];
29 if (c & 0x80) {
30 *dp++ = 'M';
31 *dp++ = '-';
32 c &= 0x7F;
33 }
34 if (c < 0x20) {
35 *dp++ = '^';
36 *dp++ = c + '@';
37 } else if (c == 0x7F) {
38 *dp++ = '^';
39 *dp++ = '?';
40 } else
41 *dp++ = c;
42 }
43 *dp = '\0';
44 output_line(fmtbuf); 23 output_line(fmtbuf);
45 } 24 }
46 25
47 void 26 void
48 print_fc_lld_msg() 27 print_fc_lld_msg()
49 { 28 {
50 int i, c; 29 strcpy(fmtbuf, "LLD: ");
51 char *dp; 30 safe_print_trace(rxpkt + 1, rxpkt_len - 1, fmtbuf + 5);
52
53 dp = fmtbuf;
54 strcpy(dp, "LLD: ");
55 dp += 5;
56 for (i = 1; i < rxpkt_len; i++) {
57 c = rxpkt[i];
58 if (c & 0x80) {
59 *dp++ = 'M';
60 *dp++ = '-';
61 c &= 0x7F;
62 }
63 if (c < 0x20) {
64 *dp++ = '^';
65 *dp++ = c + '@';
66 } else if (c == 0x7F) {
67 *dp++ = '^';
68 *dp++ = '?';
69 } else
70 *dp++ = c;
71 }
72 *dp = '\0';
73 output_line(fmtbuf); 31 output_line(fmtbuf);
74 } 32 }
75 33
76 void 34 void
77 print_tch_output_raw() 35 print_tch_output_raw()