aboutsummaryrefslogtreecommitdiffstats
path: root/printparse.c
blob: ceb1360aec76ba5d34f4dd87f84a9e22834679ac (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
26
27
28
29
30
31
32
33
/*
 * Copyright (C) 2014  Tomasz Kramkowski <tk@the-tk.com>
 *
 * This program is free software. It is licensed under version 3 of the
 * GNU General Public License.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see [http://www.gnu.org/licenses/].
 */

// In collaboration with clone.c this was meant to turn clone.c's code into something I
// could paste back into clone.c.
#include<stdio.h>

int main ( int argc, char *argv[] ) {
    char c;
    while ( (c = getchar()) != EOF ) {
        switch (c) {
            case '\n' :
                printf("\\n");
                break;
            case '\t' :
                printf("\\t");
                break;
            case '\\' :
                printf("\\\\");
                break;
            default :
                putchar(c);
                break;
        }
    }
}