From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28036 invoked from network); 29 Jun 2000 09:26:42 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 29 Jun 2000 09:26:42 -0000 Received: (qmail 24290 invoked by alias); 29 Jun 2000 09:26:26 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12121 Received: (qmail 24282 invoked from network); 29 Jun 2000 09:26:21 -0000 Date: Thu, 29 Jun 2000 10:25:42 +0100 From: Peter Stephenson Subject: PATCH: Re: jobs command in precmd In-reply-to: "Your message of Wed, 28 Jun 2000 11:20:38 BST." <0FWV001LZ0QDKS@la-la.cambridgesiliconradio.com> To: zsh-workers@sunsite.auc.dk (Zsh hackers list), Rob Egelink Message-id: <0FWW00BFDSUU9D@la-la.cambridgesiliconradio.com> Content-transfer-encoding: 7BIT > Maybe simply saving and restoring stopmsg when executing > precmd would be enough. This seems to be OK; here's the patch for the latest code in CVS. I'll send a patch for 3.0.8, too. The last hunk keeps variables in read_poll() under control; it should patch against 3.1.9 or 3.1.9-dev-1 if that's left out. I couldn't find any description of the current logic for checking jobs, so I added a short description to the CHECK_JOBS option. Index: Doc/Zsh/options.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v retrieving revision 1.8 diff -u -r1.8 options.yo --- Doc/Zsh/options.yo 2000/05/24 17:20:26 1.8 +++ Doc/Zsh/options.yo 2000/06/29 09:21:46 @@ -244,8 +244,14 @@ cindex(logging out, checking jobs when) item(tt(CHECK_JOBS) )( Report the status of background and suspended jobs before exiting a shell -with job control. tt(NO_CHECK_JOBS) is best used only in combination with -tt(NO_HUP), else such jobs will be killed automatically. +with job control; a second attempt to exit the shell will succeed. +tt(NO_CHECK_JOBS) is best used only in combination with tt(NO_HUP), else +such jobs will be killed automatically. + +The check is omitted if the commands run from the previous command line +included a `tt(jobs)' command, since it is assumed the user is aware that +there are background or suspended jobs. A `tt(jobs)' command run from the +tt(precmd) function is not counted for this purpose. ) pindex(CLOBBER) cindex(clobbering, of files) Index: Src/utils.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/utils.c,v retrieving revision 1.9 diff -u -r1.9 utils.c --- Src/utils.c 2000/06/26 21:27:08 1.9 +++ Src/utils.c 2000/06/29 09:21:46 @@ -644,11 +644,16 @@ /* If a shell function named "precmd" exists, * * then execute it. */ if ((prog = getshfunc("precmd")) != &dummy_eprog) { - int osc = sfcontext; + /* + * Save stopmsg, since user doesn't get a chance to respond + * to a list of jobs generated in precmd. + */ + int osc = sfcontext, osm = stopmsg; sfcontext = SFC_HOOK; doshfunc("precmd", prog, NULL, 0, 1); sfcontext = osc; + stopmsg = osm; } if (errflag) return; @@ -1316,12 +1321,13 @@ int ret = 0; long mode = -1; char c; -#ifdef FIONREAD - int val; -#endif #ifdef HAVE_SELECT fd_set foofd; struct timeval expire_tv; +#else +#ifdef FIONREAD + int val; +#endif #endif #ifdef HAS_TIO struct ttyinfo ti; -- Peter Stephenson Cambridge Silicon Radio, Unit 300, Science Park, Milton Road, Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070