Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: Expansion of \c escape sequences



Thanks for the \c fixes and your earlier Makefile.in patch -- I've
checked them into CVS (and I improved the function-comment for
getkeystring() while I was at it).

On Sun, Jul 24, 2005 at 04:15:12AM +0200, Thorsten Dahlheimer wrote:
> Finally, I've discovered that \c in an argument to a printing command
> only suppresses the final newline, but according POSIX it should
> suppress all output after the \c, and that's what ksh, bash, and
> echo/printf from GNU coreutils do.

I'm curious which version of coreutils behaves that way?  I've got 5.2.1
on my system, and it behaves as zsh does.  If we want to change the
behavior, the attached patch should handle it.

..wayne..
--- Src/utils.c	24 Jul 2005 05:19:58 -0000	1.80
+++ Src/utils.c	24 Jul 2005 05:42:08 -0000
@@ -3611,7 +3611,9 @@ getkeystring(char *s, int *len, int from
 	    case 'c':
 		if (fromwhere < 2) {
 		    *misc = 1;
-		    break;
+		    *t = '\0';
+		    *len = t - buf;
+		    return buf;
 		}
 		goto def;
 	    case 'u':


Messages sorted by: Reverse Date, Date, Thread, Author