From 2604a140814a955893c9fd892a9d71818de06db9 Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Thu, 2 Dec 2021 18:34:50 +0800 Subject: 3.2 --- 3/2.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to '3/2.c') diff --git a/3/2.c b/3/2.c index f6f6987..da56352 100644 --- a/3/2.c +++ b/3/2.c @@ -5,7 +5,7 @@ #define UNESCAPE 1 #define MAXLEN 1000 -/* convert new line and tab chars to visible chars */ +/* converts new line and tab chars to visible chars */ void escape(char s[], char t[]); /* converts escapes sequences to chars */ @@ -29,17 +29,12 @@ int main(int argc, char *argv[]) { t[i] = c; t[i] = 0; - if (cmd == ESCAPE) { + if (cmd == ESCAPE) escape(s, t); - printf("Escaped output:\n"); - printf("%s\n", s); - } else if (cmd == UNESCAPE) { + else unescape(s, t); - printf("Unescaped output:\n"); - printf("%s\n", s); - } else { - return 1; - } + + printf("Output:\n%s\n", s); return 0; } -- cgit v1.2.3