[PATCH] echo: make escape sequences depend on fancy mode
Denys Vlasenko
vda.linux at googlemail.com
Fri Jul 31 01:48:35 UTC 2015
Applied, thanks!
On Thu, Jul 30, 2015 at 5:33 AM, Mike Frysinger <vapier at gentoo.org> wrote:
> 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 at gentoo.org>
> ---
> coreutils/echo.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/coreutils/echo.c b/coreutils/echo.c
> index 9663894..1c41745 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' */
> };
>
> --
> 2.4.4
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
More information about the busybox
mailing list