From 2a91a7640cfb8a6caadfd096d6e6975cdc56aacb Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Thu, 20 Dec 2012 18:10:08 -0800 Subject: [PATCH] Make echo recognize -ne --- builtin.cpp | 14 ++++++++++---- exec.cpp | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/builtin.cpp b/builtin.cpp index 88022c04a..ae587e185 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -1595,14 +1595,20 @@ static int builtin_echo(parser_t &parser, wchar_t **argv) { print_newline = false; } - else if (! wcscmp(*argv, L"-s")) - { - print_spaces = false; - } else if (! wcscmp(*argv, L"-e")) { interpret_special_chars = true; } + else if (! wcscmp(*argv, L"-ne")) + { + print_newline = false; + interpret_special_chars = true; + } + else if (! wcscmp(*argv, L"-s")) + { + // fish-specific extension, which we should try to nix + print_spaces = false; + } else if (! wcscmp(*argv, L"-E")) { interpret_special_chars = false; diff --git a/exec.cpp b/exec.cpp index cdae00aff..13652b5ea 100644 --- a/exec.cpp +++ b/exec.cpp @@ -1469,13 +1469,13 @@ static int exec_subshell_internal(const wcstring &cmd, wcstring_list_t *lst) { // Look for the next separator const char *stop = (const char *)memchr(cursor, sep, end - cursor); - bool hit_separator = (stop != NULL); + const bool hit_separator = (stop != NULL); if (! hit_separator) { // If it's not found, just use the end stop = end; } - // Stop now points at the first character we do not want to copy) + // Stop now points at the first character we do not want to copy const wcstring wc = str2wcstring(cursor, stop - cursor); lst->push_back(wc);