mirror of https://github.com/dirtbags/fluffy.git
add printf esc program
This commit is contained in:
parent
49ff09dc9e
commit
456102b59e
1
Makefile
1
Makefile
|
@ -1,5 +1,6 @@
|
|||
CFLAGS = -Wall -Werror
|
||||
TARGETS = pmerge puniq p4split hd
|
||||
TARGETS += pyesc printfesc
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
printf("printf ");
|
||||
|
||||
while (! feof(stdin)) {
|
||||
int c = getchar();
|
||||
|
||||
switch (c) {
|
||||
case EOF:
|
||||
break;
|
||||
case '0' ... '9':
|
||||
case 'A' ... 'Z':
|
||||
case 'a' ... 'z':
|
||||
putchar(c);
|
||||
break;
|
||||
default:
|
||||
printf("\\\\%03o", c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
putchar('\n');
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue