FreeCalypso > hg > freecalypso-tools
comparison rvinterf/libasync/rvtrace.c @ 926:6a0aa8d36d06
rvinterf backslash escape: introduce libprint
The new helper function library named libprint is meant to replace
the badly misnamed libg23, and will soon contain functions for
printing all of the same kinds of GPF TST packets that are now handled
in libg23. However, we are also moving safe_print_trace() from libasync
to this new library, and changing it to emit our new backslash escape
format.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 23 May 2023 03:47:46 +0000 |
parents | e7502631a0f9 |
children |
comparison
equal
deleted
inserted
replaced
925:85d144f9fe56 | 926:6a0aa8d36d06 |
---|---|
13 | 13 |
14 extern u_char rvi_msg[]; | 14 extern u_char rvi_msg[]; |
15 extern int rvi_msg_len; | 15 extern int rvi_msg_len; |
16 | 16 |
17 void | 17 void |
18 safe_print_trace(src, srclen, dest) | |
19 u_char *src; | |
20 char *dest; | |
21 { | |
22 int i, c; | |
23 char *dp; | |
24 | |
25 dp = dest; | |
26 for (i = 0; i < srclen; i++) { | |
27 c = src[i]; | |
28 if (c & 0x80) { | |
29 *dp++ = 'M'; | |
30 *dp++ = '-'; | |
31 c &= 0x7F; | |
32 } | |
33 if (c < 0x20) { | |
34 *dp++ = '^'; | |
35 *dp++ = c + '@'; | |
36 } else if (c == 0x7F) { | |
37 *dp++ = '^'; | |
38 *dp++ = '?'; | |
39 } else | |
40 *dp++ = c; | |
41 } | |
42 *dp = '\0'; | |
43 } | |
44 | |
45 void | |
46 handle_useid_0() | 18 handle_useid_0() |
47 { | 19 { |
48 char buf[MAX_PKT_FROM_TARGET*4]; | 20 char buf[MAX_PKT_FROM_TARGET*4]; |
49 | 21 |
50 if (strncmp(rvi_msg + 7, "RVT: Lost Message", 17)) | 22 if (strncmp(rvi_msg + 7, "RVT: Lost Message", 17)) |