zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: newlines in job-texts (was: Re: Questions)
@ 2000-04-17 10:42 Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2000-04-17 10:42 UTC (permalink / raw)
  To: zsh-workers


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@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 2+ messages in thread
* Re: PATCH: newlines in job-texts (was: Re: Questions)
@ 2000-04-18  7:09 Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2000-04-18  7:09 UTC (permalink / raw)
  To: zsh-workers


I'm sooo ashamed... When the text will not be used for a job-text, it
should still contain the newlines, of course.


Bye
 Sven

Index: Src/text.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/text.c,v
retrieving revision 1.3
diff -u -r1.3 text.c
--- Src/text.c	2000/04/17 10:46:01	1.3
+++ Src/text.c	2000/04/18 07:08:33
@@ -69,8 +69,12 @@
 	tlim = tbuf + tsiz;
 	tptr = tbuf + x;
     }
-    while ((c = *s++))
-	*tptr++ = (c == '\n' ? ' ' : c);
+    if (tnewlins) {
+	memcpy(tptr, s, sl);
+	tptr += sl;
+    } else
+	while ((c = *s++))
+	    *tptr++ = (c == '\n' ? ' ' : c);
 }
 
 /**/

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-04-18  7:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-17 10:42 PATCH: newlines in job-texts (was: Re: Questions) Sven Wischnowsky
2000-04-18  7:09 Sven Wischnowsky

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).