summaryrefslogtreecommitdiffstats
path: root/3/2.c
diff options
context:
space:
mode:
authorSadeep Madurange <smadurange@users.noreply.github.com>2021-12-02 18:34:50 +0800
committerSadeep Madurange <smadurange@users.noreply.github.com>2021-12-02 18:34:50 +0800
commit2604a140814a955893c9fd892a9d71818de06db9 (patch)
tree32a1d85b6ee9af6b60f78bea8b1fbbdaabe653ba /3/2.c
parent401e5d024f88f0787d7f7f99f1d65ee91018107c (diff)
downloadk&r-exercises-2604a140814a955893c9fd892a9d71818de06db9.tar.gz
3.2
Diffstat (limited to '3/2.c')
-rw-r--r--3/2.c15
1 files changed, 5 insertions, 10 deletions
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;
}