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

Re: output from ctrl-z not demetafyed (i think)



Yes, it looks like you're right, jobs.c isn't very good with
unmetafication.  This fixes it for descriptions in a couple of places.
There may be others but it's not entirely clear; for example, I think
error messages for job names work OK because the error function handles
it properly.

Index: Src/jobs.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.42
diff -u -r1.42 jobs.c
--- Src/jobs.c	13 Oct 2005 17:50:00 -0000	1.42
+++ Src/jobs.c	7 Feb 2006 16:33:27 -0000
@@ -556,10 +556,18 @@
 #ifdef HAVE_GETRUSAGE
     double total_time;
 #endif
-    int percent;
+    int percent, desclen;
 
     if (!desc)
+    {
 	desc = "";
+	desclen = 0;
+    }
+    else
+    {
+	desc = dupstring(desc);
+	unmetafy(desc, &desclen);
+    }
 
     /* go ahead and compute these, since almost every TIMEFMT will have them */
     elapsed_time = real->tv_sec + real->tv_usec / 1000000.0;
@@ -706,7 +714,7 @@
 		break;
 #endif
 	    case 'J':
-		fprintf(stderr, "%s", desc);
+		fwrite(desc, sizeof(char), desclen, stderr);
 		break;
 	    case '%':
 		putc('%', stderr);
@@ -914,8 +922,14 @@
 			(int)(len - 14 + 2 - strlen(sigmsg(WTERMSIG(pn->status)))), "");
 	    else
 		fprintf(fout, "%-*s", len + 2, sigmsg(WTERMSIG(pn->status)));
-	    for (; pn != qn; pn = pn->next)
-		fprintf(fout, (pn->next) ? "%s | " : "%s", pn->text);
+	    for (; pn != qn; pn = pn->next) {
+		char *txt = dupstring(pn->text);
+		int txtlen;
+		unmetafy(txt, &txtlen);
+		fwrite(txt, sizeof(char), txtlen, fout);
+		if (pn->next)
+		    fputs(" | ", fout);
+	    }
 	    putc('\n', fout);
 	    fline = 0;
 	}

-- 
Peter Stephenson <pws@xxxxxxx>                  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



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