1: # include <stdio.h> 2: allprint(c) 3: char c; { 4: extern FILE *yyout; 5: switch(c){ 6: case '\n': 7: fprintf(yyout,"\\n"); 8: break; 9: case '\t': 10: fprintf(yyout,"\\t"); 11: break; 12: case '\b': 13: fprintf(yyout,"\\b"); 14: break; 15: case ' ': 16: fprintf(yyout,"\\\bb"); 17: break; 18: default: 19: if(!printable(c)) 20: fprintf(yyout,"\\%-3o",c); 21: else 22: putc(c,yyout); 23: break; 24: } 25: return; 26: } 27: sprint(s) 28: char *s; { 29: while(*s) 30: allprint(*s++); 31: return; 32: } 33: printable(c) 34: int c; 35: { 36: return(040 < c && c < 0177); 37: }