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

Re: jobs not listing all commands



Felix Rosencrantz wrote:
> The jobs command seems to have a problem if there is a gap in job numbers. 

Thanks, it was a simple off-by-one error from the last time I `improved'
the job table (with a slight recount to avoid `jobs' in a subshell from
crashing).  The actual bug was it wouldn't report the last job in the
list.  However, if the table was full that was the job running `jobs',
so you wouldn't notice.  If the table wasn't full, the `jobs' job would
go in the middle and the last one would be missing.

Index: Src/jobs.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.24
diff -u -r1.24 jobs.c
--- Src/jobs.c	13 Nov 2003 14:34:38 -0000	1.24
+++ Src/jobs.c	17 Feb 2004 10:36:07 -0000
@@ -1488,14 +1488,14 @@
 	    int curmaxjob, ignorejob;
 	    if (unset(MONITOR) && oldmaxjob) {
 		jobptr = oldjobtab;
-		curmaxjob = oldmaxjob;
+		curmaxjob = oldmaxjob ? oldmaxjob - 1 : 0;
 		ignorejob = 0;
 	    } else {
 		jobptr = jobtab;
 		curmaxjob = maxjob;
 		ignorejob = thisjob;
 	    }
-	    for (job = 0; job != curmaxjob; job++, jobptr++)
+	    for (job = 0; job <= curmaxjob; job++, jobptr++)
 		if (job != ignorejob && jobptr->stat) {
 		    if ((!OPT_ISSET(ops,'r') && !OPT_ISSET(ops,'s')) ||
 			(OPT_ISSET(ops,'r') && OPT_ISSET(ops,'s')) ||

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, 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.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



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