aboutsummaryrefslogtreecommitdiff
path: root/toys/echo.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/echo.c')
-rw-r--r--toys/echo.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/toys/echo.c b/toys/echo.c
index 93a3dbc0..397c21a7 100644
--- a/toys/echo.c
+++ b/toys/echo.c
@@ -14,7 +14,9 @@ int echo_main(void)
arg = toys.optargs[i];
if (!arg) break;
if (i++) xputc(' ');
-
+
+ // Handle -e
+
if (toys.optflags&2) {
int c, j = 0;
for (;;) {
@@ -24,6 +26,7 @@ int echo_main(void)
char *found;
int d = arg[j++];
+ // handle \escapes
if (d) {
found = strchr(from, d);
@@ -34,14 +37,13 @@ int echo_main(void)
while (arg[j]>='0' && arg[j]<='7')
c = (c*8)+arg[j++]-'0';
}
- // \0123
}
}
xputc(c);
}
- // \\ thingy
} else xprintf("%s", arg);
}
+
// Output "\n" if no -n
if (!(toys.optflags&1)) xputc('\n');
done: