Commit | Line | Data |
---|---|---|
1 | #include <stdio.h> | |
2 | ||
3 | /* | |
4 | * This program does two things: | |
5 | * | |
6 | * - It converts <TAB> characters into backslashes '\' | |
7 | * - It converts <lf> (10) line end characters to <cr> (13) | |
8 | * | |
9 | */ | |
10 | ||
11 | #define INPUT_TAB 0x09 | |
12 | ||
13 | int main (int argc, char **agrv) | |
14 | { | |
15 | char c; | |
16 | while (read (0, &c, 1)) { | |
17 | switch (c) { | |
18 | case INPUT_TAB: | |
19 | printf ("\\"); | |
20 | break; | |
21 | case '\n': | |
22 | printf ("\r\n"); | |
23 | break; | |
24 | default: | |
25 | printf ("%c", c); | |
26 | break; | |
27 | } | |
28 | } | |
29 | return 0; | |
30 | } //main() | |
31 | // Ende. |