Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: newlines in job-texts (was: Re: Questions)
- X-seq: zsh-workers 10788
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: newlines in job-texts (was: Re: Questions)
- Date: Mon, 17 Apr 2000 12:42:45 +0200 (MET DST)
- In-reply-to: Peter Stephenson's message of Mon, 17 Apr 2000 10:08:00 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Peter Stephenson wrote:
> > Would anyone object if I applied the patch below to make newlines in
> > strings in the job text be output as spaces (keeping the `jobs' output
> > better readable)?
>
> It's a good idea to keep the job text on one line for any kind of automated
> use, too.
Right.
Bye
Sven
Index: Src/text.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/text.c,v
retrieving revision 1.2
diff -u -r1.2 text.c
--- Src/text.c 2000/04/01 20:49:48 1.2
+++ Src/text.c 2000/04/17 10:41:29
@@ -58,6 +58,7 @@
taddstr(char *s)
{
int sl = strlen(s);
+ char c;
while (tptr + sl >= tlim) {
int x = tptr - tbuf;
@@ -68,8 +69,8 @@
tlim = tbuf + tsiz;
tptr = tbuf + x;
}
- strcpy(tptr, s);
- tptr += sl;
+ while ((c = *s++))
+ *tptr++ = (c == '\n' ? ' ' : c);
}
/**/
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author