blob: 2145759394281738b44d0d1aa5c62c201aebd421 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include <stdio.h>
extern char* program_name;
int
main (int argc, char* argv[]) {
char c;
while ((c = getchar()) != EOF) {
if (c=='\\') {
char c2 = getchar();
switch (c2) {
case 'n': putchar('\n'); break;
case '\\': putchar('\\'); break;
default: putchar(c2); break;
}
}
char n = getchar();
if (n != '\n') {
printf(
"%s: found other character when expecting newline: %c",
argv[0], n);
}
}
}
|