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

Re: Chatty little precompiler for _arguments



Tanaka Akira wrote:

> In article <199909200843.KAA06289@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
>   Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> writes:
> 
> > I would be against this because its much less useful in cases where
> > you stuff together string from multiple parameters. However, in its
> > first life `:q' did that and we could use the doubled-flag convention
> > so that `${(qq)foo}' would emit stuff in single quotes. (Tripled for
> > double quotes?)
> 
> I found a problem about quoting.
> 
> Z(2):akr@is27e1u11% Src/zsh -f
> is27e1u11% a=$'\n\n\n\n\n\n'
> is27e1u11% print -lr - ${(q)a}
> zsh: segmentation fault (core dumped)  Src/zsh -f
> 
> Also I suppose that `${(qqqq)foo}' should quote foo in $'...' style.
> # I really want this because I frequently use dangeraous characters
> # such as NUL.

The longest string a character can be quoted to is three characters...

Bye
 Sven

--- os/utils.c	Thu Sep 23 10:18:58 1999
+++ Src/utils.c	Thu Sep 23 11:04:51 1999
@@ -2964,7 +2964,7 @@
 {
     const char *u, *tt;
     char *v;
-    char *buf = ncalloc(2 * strlen(s) + 1);
+    char *buf = ncalloc(3 * strlen(s) + 1);
     int sf = 0;
 
     tt = v = buf;

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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