]> git.lizzy.rs Git - plan9front.git/blob - sys/src/liblex/allprint.c
ndb/dns: lookup *all* entries in dblookup(), v4 and v6 queries in parallel, remove...
[plan9front.git] / sys / src / liblex / allprint.c
1 #include        <u.h>
2 #include        <libc.h>
3 #include        <stdio.h>
4
5 extern  FILE*   yyout;
6
7 int
8 printable(int c)
9 {
10         return 040 < c && c < 0177;
11 }
12
13 void
14 allprint(int c)
15 {
16         switch(c) {
17         case '\n':
18                 fprintf(yyout,"\\n");
19                 break;
20         case '\t':
21                 fprintf(yyout,"\\t");
22                 break;
23         case '\b':
24                 fprintf(yyout,"\\b");
25                 break;
26         case ' ':
27                 fprintf(yyout,"\\\bb");
28                 break;
29         default:
30                 if(!printable(c))
31                         fprintf(yyout,"\\%-3o",c);
32                 else 
33                         c = putc(c,yyout);
34                         USED(c);
35                 break;
36         }
37         return;
38 }