aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-07-29 23:33:16 -0400
committerDenys Vlasenko <vda.linux@googlemail.com>2015-07-31 03:47:49 +0200
commit670c3f7822e17c8bfdd9351fcfea071e696fc1d6 (patch)
tree39c385d577bb272af5451c9d860972259fabf6ba
parent52f2f37477affbbd416b27f051b2be9d87891dcd (diff)
downloadbusybox-670c3f7822e17c8bfdd9351fcfea071e696fc1d6.tar.gz
echo: make escape sequences depend on fancy mode
Currently when you disable fancy echo, escape sequences are hardcoded enabled (e.g. as if you used `echo -e` all the time). The opposite behavior is more desirable (always disable -e support) because: * This seems to contradict the spirit of the kconfig help text (where it says enable support for -n/-e flags), although you could say that we aren't supporting the -e flag directly as `echo -e` will show the -e flag. * POSIX makes escape sequences optional, and even says they are there only on XSI-conformant systems. * It saves space (~100 bytes on x86_64). * It makes things faster! * It makes it behave more like bash where you need an explicit -e flag in order for escape sequences to be interpreted. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--coreutils/echo.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/coreutils/echo.c b/coreutils/echo.c
index 9663894ec..1c4174559 100644
--- a/coreutils/echo.c
+++ b/coreutils/echo.c
@@ -72,7 +72,7 @@ int echo_main(int argc UNUSED_PARAM, char **argv)
unsigned buflen;
#if !ENABLE_FEATURE_FANCY_ECHO
enum {
- eflag = '\\',
+ eflag = 0, /* 0 -- disable escape sequences */
nflag = 1, /* 1 -- print '\n' */
};