From: "Thorsten Dahlheimer" <tdahlheim@gmx.net>
To: <zsh-workers@sunsite.dk>
Subject: PATCH: Expansion of \c escape sequences
Date: Sun, 24 Jul 2005 04:15:12 +0200 [thread overview]
Message-ID: <003c01c58ff5$870469a0$13e6fea9@pcdahl4201> (raw)
[-- 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;
next reply other threads:[~2005-07-24 2:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-24 2:15 Thorsten Dahlheimer [this message]
2005-07-24 5:52 ` Wayne Davison
2005-07-24 18:09 ` Thorsten Dahlheimer
2005-07-26 0:10 ` Wayne Davison
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='003c01c58ff5$870469a0$13e6fea9@pcdahl4201' \
--to=tdahlheim@gmx.net \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).