zsh-workers
 help / color / mirror / code / Atom feed
* LONG_LIST_JOBS doesn't affect all job listings?
@ 2005-06-20  3:46 Bart Schaefer
  2005-06-20  9:55 ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2005-06-20  3:46 UTC (permalink / raw)
  To: zsh-workers

I just noticed that "setopt long_list_jobs" doesn't have any effect except
for asynchronous job notifications; e.g. when a background job exits or is
signalled you get long format, but when a foreground job is stopped you do
not.

Shouldn't it also affect the output of "jobs", "bg", "fg", etc.?  There's
some room to argue that "jobs" has the -l option, but "bg" and "fg" don't.

It *does* appear to affect the output of "wait".


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

* Re: LONG_LIST_JOBS doesn't affect all job listings?
  2005-06-20  3:46 LONG_LIST_JOBS doesn't affect all job listings? Bart Schaefer
@ 2005-06-20  9:55 ` Peter Stephenson
  2005-06-20 15:23   ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 2005-06-20  9:55 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:
> I just noticed that "setopt long_list_jobs" doesn't have any effect except
> for asynchronous job notifications; e.g. when a background job exits or is
> signalled you get long format, but when a foreground job is stopped you do
> not.
> 
> Shouldn't it also affect the output of "jobs", "bg", "fg", etc.?  There's
> some room to argue that "jobs" has the -l option, but "bg" and "fg" don't.
> 
> It *does* appear to affect the output of "wait".

I would certainly have said bg and fg should work like job
notifications, at least.

Is this connected with users/8989?  The messages seem to be generally
rather inconsistent.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************


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

* Re: LONG_LIST_JOBS doesn't affect all job listings?
  2005-06-20  9:55 ` Peter Stephenson
@ 2005-06-20 15:23   ` Bart Schaefer
  2005-06-20 16:54     ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2005-06-20 15:23 UTC (permalink / raw)
  To: zsh-workers

On Jun 20, 10:55am, Peter Stephenson wrote:
} Subject: Re: LONG_LIST_JOBS doesn't affect all job listings?
}
} I would certainly have said bg and fg should work like job
} notifications, at least.

Even job notifications aren't consistent; only *asynchronous* notices
get the long format.  If you have no_notify set, the short form is used.
[That's because scanjobs() also ignores long_list_jobs.]

} Is this connected with users/8989?  The messages seem to be generally
} rather inconsistent.

Yes; I was peeking at how difficult it would be to implement tcsh's
option, and was using LONGLISTJOBS as a placeholder (and wondering if
perhaps it couldn't just be employed full time as a stand-in).


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

* Re: LONG_LIST_JOBS doesn't affect all job listings?
  2005-06-20 15:23   ` Bart Schaefer
@ 2005-06-20 16:54     ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2005-06-20 16:54 UTC (permalink / raw)
  To: zsh-workers

On Jun 20,  3:23pm, Bart Schaefer wrote:
}
} } Is this connected with users/8989?
} 
} Yes; I was peeking at how difficult it would be to implement tcsh's
} option, and was using LONGLISTJOBS as a placeholder (and wondering if
} perhaps it couldn't just be employed full time as a stand-in).

The necessary patch follows.  The (!thisfmt || lng) hunk is where "lng"
would have to be replaced with a test of a new option if zsh were going
to behave as described in users/8989.

Index: Src/jobs.c
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/jobs.c,v
retrieving revision 1.15
diff -c -r1.15 jobs.c
--- Src/jobs.c	26 Mar 2005 16:14:05 -0000	1.15
+++ Src/jobs.c	20 Jun 2005 16:47:18 -0000
@@ -809,7 +813,7 @@
 
     if (lng < 0) {
 	conted = 1;
-	lng = 0;
+	lng = !!isset(LONGLISTJOBS);
     }
 
 /* find length of longest signame, check to see */
@@ -869,7 +873,7 @@
 			break;
 		    len2 += strlen(qn->text) + 2;
 		}
-	    if (!thisfmt) {
+	    if (!thisfmt || lng) {
 		if (fline)
 		    fprintf(fout, "[%ld]  %c ",
 			    (long)job,
@@ -1335,7 +1339,7 @@
  
     for (i = 1; i <= maxjob; i++)
         if (jobtab[i].stat & STAT_CHANGED)
-            printjob(jobtab + i, 0, 1);
+            printjob(jobtab + i, !!isset(LONGLISTJOBS), 1);
 }
 
 /**** job control builtins ****/
@@ -1603,10 +1607,14 @@
 	return 0;
     }
 
-    lng = (OPT_ISSET(ops,'l')) ? 1 : (OPT_ISSET(ops,'p')) ? 2 : 0;
-    if (OPT_ISSET(ops,'d'))
-	lng |= 4;
-    
+    if (func == BIN_JOBS) {
+	lng = (OPT_ISSET(ops,'l')) ? 1 : (OPT_ISSET(ops,'p')) ? 2 : 0;
+	if (OPT_ISSET(ops,'d'))
+	    lng |= 4;
+    } else {
+	lng = !!isset(LONGLISTJOBS);
+    }
+
     if ((func == BIN_FG || func == BIN_BG) && !jobbing) {
 	/* oops... maybe bg and fg should have been disabled? */
 	zwarnnam(name, "no job control in this shell.", NULL, 0);
@@ -1743,7 +1751,7 @@
 	    }
 	    if (func != BIN_WAIT)
 		/* for bg and fg -- show the job we are operating on */
-		printjob(jobtab + job, (stopped) ? -1 : 0, 1);
+		printjob(jobtab + job, (stopped) ? -1 : lng, 1);
 	    if (func != BIN_BG) {		/* fg or wait */
 		if (jobtab[job].pwd && strcmp(jobtab[job].pwd, pwd)) {
 		    fprintf(shout, "(pwd : ");


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

end of thread, other threads:[~2005-06-20 16:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-20  3:46 LONG_LIST_JOBS doesn't affect all job listings? Bart Schaefer
2005-06-20  9:55 ` Peter Stephenson
2005-06-20 15:23   ` Bart Schaefer
2005-06-20 16:54     ` Bart Schaefer

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