* PATCH: shorthand for splitting on null bytes.
@ 2006-03-22 12:06 Peter Stephenson
2006-03-22 18:21 ` Wayne Davison
0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 2006-03-22 12:06 UTC (permalink / raw)
To: Zsh hackers list
I've been missing this. Any comments? Is a shorthand for joining
things together with nulls useful?
Index: Doc/Zsh/expn.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/expn.yo,v
retrieving revision 1.63
diff -u -r1.63 expn.yo
--- Doc/Zsh/expn.yo 20 Mar 2006 11:06:25 -0000 1.63
+++ Doc/Zsh/expn.yo 22 Mar 2006 12:01:17 -0000
@@ -826,6 +826,10 @@
in `tt(${${(z)foo}[2]})'. Likewise, to remove the quotes in the
resulting words one would do: `tt(${(Q)${(z)foo}})'.
)
+item(tt(0))(
+Split the result of the expansion on null bytes. This is a shorthand
+for `tt(ps:\0:)'.
+)
enditem()
The following flags (except tt(p)) are followed by one or more arguments
Index: Src/subst.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/subst.c,v
retrieving revision 1.49
diff -u -r1.49 subst.c
--- Src/subst.c 7 Mar 2006 22:05:51 -0000 1.49
+++ Src/subst.c 22 Mar 2006 12:01:18 -0000
@@ -1274,6 +1274,13 @@
sep = "\n";
break;
+ case '0':
+ spsep = zhalloc(3);
+ spsep[0] = Meta;
+ spsep[1] = ' ';
+ spsep[2] = '\0';
+ break;
+
case 's':
tt = 1;
/* fall through */
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH: shorthand for splitting on null bytes.
2006-03-22 12:06 PATCH: shorthand for splitting on null bytes Peter Stephenson
@ 2006-03-22 18:21 ` Wayne Davison
0 siblings, 0 replies; 2+ messages in thread
From: Wayne Davison @ 2006-03-22 18:21 UTC (permalink / raw)
To: Peter Stephenson; +Cc: Zsh hackers list
On Wed, Mar 22, 2006 at 12:06:54PM +0000, Peter Stephenson wrote:
> Any comments?
Just a comment on the obfuscationality :-) of one line in your patch:
> + spsep[0] = Meta;
> + spsep[1] = ' ';
I'd rather see that last line be "spsep[1] = '\0' ^ 32;" because that
makes the value a little clearer (the end result is obviously the same).
..wayne..
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-03-22 18:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-22 12:06 PATCH: shorthand for splitting on null bytes Peter Stephenson
2006-03-22 18:21 ` 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).