From: downsj Date: Thu, 2 Jan 1997 17:37:25 +0000 (+0000) Subject: After discussing $_ with the maintainer, revert ksh behaviour and completely X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=731405d5d4c938f1c20610eca31213557726e860;p=openbsd After discussing $_ with the maintainer, revert ksh behaviour and completely eliminate it from sh. --- diff --git a/bin/ksh/exec.c b/bin/ksh/exec.c index 079ccc93940..d84987cd41c 100644 --- a/bin/ksh/exec.c +++ b/bin/ksh/exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.c,v 1.6 1997/01/02 09:33:56 downsj Exp $ */ +/* $OpenBSD: exec.c,v 1.7 1997/01/02 17:37:25 downsj Exp $ */ /* * execute command tree @@ -457,14 +457,13 @@ comexec(t, tp, ap, flags) int type_flags; int keepasn_ok; int fcflags = FC_BI|FC_FUNC|FC_PATH; - volatile int underscore = (!Flag(FSH) || Flag(FTALKING)); /* snag the last argument for $_ XXX not the same as at&t ksh, * which only seems to set $_ after a newline (but not in * functions/dot scripts, but in interactive and scipt) - * perhaps save last arg here and set it in shell()?. */ - if (underscore && *(lastp = ap)) { + if (!Flag(FSH) && *(lastp = ap)) { while (*++lastp) ; setstr(typeset("_", LOCAL, 0, 0, 0), *--lastp); @@ -699,7 +698,7 @@ comexec(t, tp, ap, flags) break; } - if (underscore) { + if (!Flag(FSH)) { /* set $_ to program's full path */ setstr(typeset("_", LOCAL|EXPORT, 0, 0, 0), tp->val.s); } diff --git a/bin/ksh/history.c b/bin/ksh/history.c index f29e7e7d281..295f108f130 100644 --- a/bin/ksh/history.c +++ b/bin/ksh/history.c @@ -1,4 +1,4 @@ -/* $OpenBSD: history.c,v 1.3 1997/01/02 09:34:00 downsj Exp $ */ +/* $OpenBSD: history.c,v 1.4 1997/01/02 17:37:26 downsj Exp $ */ /* * command history @@ -242,7 +242,7 @@ c_fc(wp) return 1; } - if (!Flag(FSH) || Flag(FTALKING)) + if (!Flag(FSH)) setstr(local("_", FALSE), tf->name); /* XXX: source should not get trashed by this.. */ diff --git a/bin/ksh/mail.c b/bin/ksh/mail.c index a26bde87579..04033a4f2d3 100644 --- a/bin/ksh/mail.c +++ b/bin/ksh/mail.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mail.c,v 1.2 1996/08/19 20:08:55 downsj Exp $ */ +/* $OpenBSD: mail.c,v 1.3 1997/01/02 17:37:27 downsj Exp $ */ /* * Mailbox checking code by Robert J. Gibson, adapted for PD ksh by @@ -180,7 +180,8 @@ mbox_t *mbp; { struct tbl *vp; - setstr((vp = local("_", FALSE)), mbp->mb_path); + if (!Flag(FSH)) + setstr((vp = local("_", FALSE)), mbp->mb_path); shellf("%s\n", substitute(mbp->mb_msg ? mbp->mb_msg : MBMESSAGE, 0)); diff --git a/bin/pdksh/exec.c b/bin/pdksh/exec.c index 079ccc93940..d84987cd41c 100644 --- a/bin/pdksh/exec.c +++ b/bin/pdksh/exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.c,v 1.6 1997/01/02 09:33:56 downsj Exp $ */ +/* $OpenBSD: exec.c,v 1.7 1997/01/02 17:37:25 downsj Exp $ */ /* * execute command tree @@ -457,14 +457,13 @@ comexec(t, tp, ap, flags) int type_flags; int keepasn_ok; int fcflags = FC_BI|FC_FUNC|FC_PATH; - volatile int underscore = (!Flag(FSH) || Flag(FTALKING)); /* snag the last argument for $_ XXX not the same as at&t ksh, * which only seems to set $_ after a newline (but not in * functions/dot scripts, but in interactive and scipt) - * perhaps save last arg here and set it in shell()?. */ - if (underscore && *(lastp = ap)) { + if (!Flag(FSH) && *(lastp = ap)) { while (*++lastp) ; setstr(typeset("_", LOCAL, 0, 0, 0), *--lastp); @@ -699,7 +698,7 @@ comexec(t, tp, ap, flags) break; } - if (underscore) { + if (!Flag(FSH)) { /* set $_ to program's full path */ setstr(typeset("_", LOCAL|EXPORT, 0, 0, 0), tp->val.s); } diff --git a/bin/pdksh/history.c b/bin/pdksh/history.c index f29e7e7d281..295f108f130 100644 --- a/bin/pdksh/history.c +++ b/bin/pdksh/history.c @@ -1,4 +1,4 @@ -/* $OpenBSD: history.c,v 1.3 1997/01/02 09:34:00 downsj Exp $ */ +/* $OpenBSD: history.c,v 1.4 1997/01/02 17:37:26 downsj Exp $ */ /* * command history @@ -242,7 +242,7 @@ c_fc(wp) return 1; } - if (!Flag(FSH) || Flag(FTALKING)) + if (!Flag(FSH)) setstr(local("_", FALSE), tf->name); /* XXX: source should not get trashed by this.. */ diff --git a/bin/pdksh/mail.c b/bin/pdksh/mail.c index a26bde87579..04033a4f2d3 100644 --- a/bin/pdksh/mail.c +++ b/bin/pdksh/mail.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mail.c,v 1.2 1996/08/19 20:08:55 downsj Exp $ */ +/* $OpenBSD: mail.c,v 1.3 1997/01/02 17:37:27 downsj Exp $ */ /* * Mailbox checking code by Robert J. Gibson, adapted for PD ksh by @@ -180,7 +180,8 @@ mbox_t *mbp; { struct tbl *vp; - setstr((vp = local("_", FALSE)), mbp->mb_path); + if (!Flag(FSH)) + setstr((vp = local("_", FALSE)), mbp->mb_path); shellf("%s\n", substitute(mbp->mb_msg ? mbp->mb_msg : MBMESSAGE, 0));