zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Expansion of \c escape sequences
@ 2005-07-24  2:15 Thorsten Dahlheimer
  2005-07-24  5:52 ` Wayne Davison
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Dahlheimer @ 2005-07-24  2:15 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 913 bytes --]

Hi,

I've noticed that in contexts where escape sequences are expanded
and \c's should not be recognized (i.e., not in arguments to the
various printing commands), then a \c is actually treated synonymous
to \U.  The attached patch contains a fix.

While inspecting the code I came across another glitch:  If a \c
occurs in the separator string of a $arr[(pws:...:)...] subscript,
it is not treated like an unrecognized sequence (i.e., replaced by
a "c"), but removed completely.  (Note that ${(p...)...} gets this
right.)  The attached patch also fixes that.

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.  So is the current behaviour really
desired, or should I send a patch to change it?

Best regards
Thorsten Dahlheimer

[-- Attachment #2: bsc.patch --]
[-- Type: application/octet-stream, Size: 924 bytes --]

Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.78
diff -u -r1.78 utils.c
--- Src/utils.c	31 Mar 2005 09:54:59 -0000	1.78
+++ Src/utils.c	24 Jul 2005 00:38:16 -0000
@@ -3611,6 +3611,7 @@
 		    *misc = 1;
 		    break;
 		}
+		goto def;
 	    case 'u':
 	    case 'U':
 	    	wval = 0;
Index: Src/params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/params.c,v
retrieving revision 1.98
diff -u -r1.98 params.c
--- Src/params.c	8 Apr 2005 16:42:58 -0000	1.98
+++ Src/params.c	24 Jul 2005 00:37:52 -0000
@@ -1002,7 +1002,7 @@
 		    goto flagerr;
 		sav = *t;
 		*t = '\0';
-		sep = escapes ? getkeystring(s + 1, &waste, 1, &waste) :
+		sep = escapes ? getkeystring(s + 1, &waste, 3, NULL) :
 				dupstring(s + 1);
 		*t = sav;
 		s = t;

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-07-26  0:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-24  2:15 PATCH: Expansion of \c escape sequences Thorsten Dahlheimer
2005-07-24  5:52 ` Wayne Davison
2005-07-24 18:09   ` Thorsten Dahlheimer
2005-07-26  0:10     ` Wayne Davison

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).