fluffy/printfesc.c

29 lines
339 B
C
Raw Normal View History

2012-11-03 21:43:56 -06:00
#include <stdio.h>
int
main(int argc, char *argv[])
{
2013-01-29 21:53:17 -07:00
printf("printf ");
2012-11-03 21:43:56 -06:00
2013-01-29 21:53:17 -07:00
while (!feof(stdin)) {
int c = getchar();
2012-11-03 21:43:56 -06:00
2013-01-29 21:53:17 -07:00
switch (c) {
case EOF:
break;
case '0' ... '9':
case 'A' ... 'Z':
case 'a' ... 'z':
putchar(c);
break;
default:
printf("\\\\%03o", c);
break;
}
}
2012-11-03 21:43:56 -06:00
2013-01-29 21:53:17 -07:00
putchar('\n');
2012-11-03 21:43:56 -06:00
2013-01-29 21:53:17 -07:00
return 0;
2012-11-03 21:43:56 -06:00
}