summaryrefslogtreecommitdiff
path: root/src/core/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/misc.c')
-rw-r--r--src/core/misc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/core/misc.c b/src/core/misc.c
index 952c7149..3a3b76bb 100644
--- a/src/core/misc.c
+++ b/src/core/misc.c
@@ -506,3 +506,24 @@ int dec2octal(int decimal)
return octal;
}
+
+/* convert all low-ascii (<32) to ^<A..> combinations */
+char *show_lowascii(const char *channel)
+{
+ char *str, *p;
+
+ str = p = g_malloc(strlen(channel)*2+1);
+ while (*channel != '\0') {
+ if ((unsigned char) *channel >= 32)
+ *p++ = *channel;
+ else {
+ *p++ = '^';
+ *p++ = *channel + 'A'-1;
+ }
+ channel++;
+ }
+ *p = '\0';
+
+ return str;
+}
+