#include #include #include #include void main(int argc, char *argv[]) { Biobuf bout; char *s, *e, c; ulong l; Binit(&bout, 1, OWRITE); while(++argv, --argc){ s = *argv; while(*s){ switch(c = *s){ case '^': s++; if(*s == '\0') sysfatal("bad control: %s", *argv); c = toupper(*s) - 0x40; /* lazy */ break; case '\\': s++; if(*s == '\0') sysfatal("bad escape: %s", *argv); switch(*s){ case 'a': c = '\a'; break; case 'b': c = '\b'; break; case 'f': c = '\f'; break; case 'n': c = '\n'; break; case 'r': c = '\r'; break; case 't': c = '\t'; break; case 'v': c = '\v'; break; case '\'': c = '\''; break; case '\\': c = '\\'; break; default: l = strtoul(s, &e, 0); if(e == s) break; c = (char)l; s = e-1; } break; } Bputc(&bout, c); s++; } } Bflush(&bout); exits(nil); }