installed pty
[VSoRC/.git] / node_modules / node-pty / deps / winpty / misc / FormatChar.h
1 #include <ctype.h>
2 #include <stdio.h>
3 #include <string.h>
4
5 static inline void formatChar(char *str, char ch)
6 {
7     // Print some common control codes.
8     switch (ch) {
9     case '\r': strcpy(str, "CR "); break;
10     case '\n': strcpy(str, "LF "); break;
11     case ' ':  strcpy(str, "SP "); break;
12     case 27:   strcpy(str, "^[ "); break;
13     case 3:    strcpy(str, "^C "); break;
14     default:
15         if (isgraph(ch))
16             sprintf(str, "%c ", ch);
17         else
18             sprintf(str, "%02x ", ch);
19         break;
20     }
21 }