From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3/2) with ESMTP id UAA14099 for ; Tue, 11 Jun 1996 20:13:12 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id FAA10040; Tue, 11 Jun 1996 05:56:20 -0400 (EDT) Resent-Date: Tue, 11 Jun 1996 05:56:20 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199606110956.LAA10452@bolyai.cs.elte.hu> Subject: Re: % bug in beta20-test1 To: pws@ifh.de (Peter Stephenson) Date: Tue, 11 Jun 1996 11:56:01 +0200 (MET DST) Cc: zsh-workers@math.gatech.edu In-Reply-To: <199606110914.LAA21011@hydra.ifh.de> from Peter Stephenson at "Jun 11, 96 11:14:14 am" Organization: Dept. of Comp. Sci., Eotvos University, Budapest, Hungary Phone: (36 1)2669833 ext: 2667, home phone: (36 1) 2752368 X-Mailer: ELM [version 2.4ME+ PL16 (25)] MIME-Version: 1.0 Content-Type: application/pgp; format=text; x-action=sign Content-Transfer-Encoding: 7bit Resent-Message-ID: <"1XZLS.0.oS2.3BKln"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/1329 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu -----BEGIN PGP SIGNED MESSAGE----- > mason@werple.net.au wrote: > > % % > > zsh: command not found: fg > > This is supposed to fixed this (plus the same bug which occurred with > autoresume). I did not try this patch but it seems that things like command %1 or foo=%1 ; $foo will trigger autoresume. Try the patch below instead (it contains some other little simplifications). > > I also had it not recognising "fg", and had to do "builtin fg" though I > > can't reproduce that at the moment. > > It's assumed not to fix this. I cannot reproduce it either so I cannot fix it. Zoltan *** Src/exec.c 1996/06/07 14:46:40 2.36 --- Src/exec.c 1996/06/10 23:41:33 *************** *** 1101,1106 **** --- 1101,1127 ---- mfds[i] = NULL; } + /* If the command begins with `%', then assume it is a * + * reference to a job in the job table. */ + if (nonempty(args) && *(char *)peekfirst(args) == '%') { + pushnode(args, dupstring((how & Z_DISOWN) + ? "disown" : (how & Z_ASYNC) ? "bg" : "fg")); + how = Z_SYNC; + } + + /* If AUTORESUME is set, the command is SIMPLE, and doesn't have * + * any redirections, then check if it matches as a prefix of a * + * job currently in the job table. If it does, then we treat it * + * as a command to resume this job. */ + if (isset(AUTORESUME) && type == SIMPLE && (how & Z_SYNC) && + nonempty(args) && empty(cmd->redir) && !input && + !nextnode(firstnode(args))) { + if (unset(NOTIFY)) + scanjobs(); + if (findjobnam(peekfirst(args)) != -1) + pushnode(args, dupstring("fg")); + } + /* Check if it's a builtin needing automatic MAGIC_EQUALS_SUBST * * handling. Things like typeset need this. We can't detect the * * command if it contains some tokens (e.g. x=ex; ${x}port), so this * *************** *** 1117,1124 **** is_shfunc = 1; break; } ! if (!(hn = builtintab->getnode(builtintab, cmdarg))) break; if (!(hn->flags & BINF_PREFIX)) { is_builtin = 1; assign = (hn->flags & BINF_MAGICEQUALS); --- 1138,1147 ---- is_shfunc = 1; break; } ! if (!(hn = builtintab->getnode(builtintab, cmdarg))) { ! checked = !(cflags & BINF_BUILTIN); break; + } if (!(hn->flags & BINF_PREFIX)) { is_builtin = 1; assign = (hn->flags & BINF_MAGICEQUALS); *************** *** 1202,1209 **** is_shfunc = 1; break; } ! if (!(hn = builtintab->getnode(builtintab, cmdarg))) break; if (!(hn->flags & BINF_PREFIX)) { is_builtin = 1; break; --- 1225,1238 ---- is_shfunc = 1; break; } ! if (!(hn = builtintab->getnode(builtintab, cmdarg))) { ! if (cflags & BINF_BUILTIN) { ! zerr("no such builtin: %s", cmdarg, 0); ! errflag = lastval = 1; ! return; ! } break; + } if (!(hn->flags & BINF_PREFIX)) { is_builtin = 1; break; *************** *** 1215,1241 **** } } - /* If the command begins with `%', then assume it is a * - * reference to a job in the job table. */ - if (nonempty(args) && *(char *)peekfirst(args) == '%') { - pushnode(args, dupstring((how & Z_DISOWN) - ? "disown" : (how & Z_ASYNC) ? "bg" : "fg")); - how = Z_SYNC; - } - - /* If AUTORESUME is set, the command is SIMPLE, and doesn't have * - * any redirections, then check if it matches as a prefix of a * - * job currently in the job table. If it does, then we treat it * - * as a command to resume this job. */ - if (isset(AUTORESUME) && type == SIMPLE && (how & Z_SYNC) && - nonempty(args) && empty(cmd->redir) && !input && - !nextnode(firstnode(args)) && !cmd->flags) { - if (unset(NOTIFY)) - scanjobs(); - if (findjobnam(peekfirst(args)) != -1) - pushnode(args, dupstring("fg")); - } - /* Get the text associated with this command. */ if (jobbing || (how & Z_TIMED)) text = getjobtext((void *) cmd); --- 1244,1249 ---- *************** *** 1285,1305 **** if (type == SIMPLE && !nullexec) { char *s; ! if (empty(args)) { ! zerr("command name expected", NULL, 0); ! errflag = lastval = 1; ! return; ! } if (!hn) { char *cmdarg = (char *) peekfirst(args); - if (cflags & BINF_BUILTIN) { - zerr("no such builtin: %s", cmdarg, 0); - errflag = lastval = 1; - return; - } - - /* Resolve external commands */ hn = cmdnamtab->getnode(cmdnamtab, cmdarg); if (!hn && isset(HASHCMDS) && strcmp(cmdarg, "..")) { for (s = cmdarg; *s && *s != '/'; s++); --- 1293,1303 ---- if (type == SIMPLE && !nullexec) { char *s; ! DPUTS(empty(args), "BUG: empty(args) in exec.c"); if (!hn) { + /* Resolve external commands */ char *cmdarg = (char *) peekfirst(args); hn = cmdnamtab->getnode(cmdnamtab, cmdarg); if (!hn && isset(HASHCMDS) && strcmp(cmdarg, "..")) { for (s = cmdarg; *s && *s != '/'; s++); -----BEGIN PGP SIGNATURE----- Version: 2.6.3i Charset: noconv iQCVAwUBMb1CrwupSCiLN749AQHYuQP/Rhhj1z45tP4EicJUuw/++2/Tn3kQxGv9 sx2UKoQLEhcR931BsR8kne6TaEyCfjjP8L2M3DwUn+J1hGw6xvMHtqPBJwCWL0PO vhBHC0Y7WgQoMAk9QrvhXqoJJpCiOU9god0cdhnDRkV31DFvPYBToWrEuk6nQ0W4 73zr7Ct1wVM= =CZgu -----END PGP SIGNATURE-----