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

PATCH: newlines in job-texts (was: Re: Questions)



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