summaryrefslogtreecommitdiffstats
path: root/bin/sh/options.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2010-04-05 14:15:51 +0000
committerjilles <jilles@FreeBSD.org>2010-04-05 14:15:51 +0000
commitf43d9cd1711a47fa152591bb0cd6dfaba4bf49aa (patch)
treef74711fe0adf0b6526051ddc49a0fb496ffd8603 /bin/sh/options.c
parentf3678f9f9c67b47c27d072971dc36f1f26c88301 (diff)
downloadFreeBSD-src-f43d9cd1711a47fa152591bb0cd6dfaba4bf49aa.zip
FreeBSD-src-f43d9cd1711a47fa152591bb0cd6dfaba4bf49aa.tar.gz
sh: Automatically enable -o emacs in interactive shells with terminals.
This makes sh a bit more friendly in single user mode, make buildenv, chroot and the like, and matches other shells. The -o emacs can be overridden on the command line or in the ENV file.
Diffstat (limited to 'bin/sh/options.c')
-rw-r--r--bin/sh/options.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/sh/options.c b/bin/sh/options.c
index bde96aa..3baeccc 100644
--- a/bin/sh/options.c
+++ b/bin/sh/options.c
@@ -93,8 +93,11 @@ procargs(int argc, char **argv)
options(1);
if (*argptr == NULL && minusc == NULL)
sflag = 1;
- if (iflag == 2 && sflag == 1 && isatty(0) && isatty(1))
+ if (iflag != 0 && sflag == 1 && isatty(0) && isatty(1)) {
iflag = 1;
+ if (Eflag == 2)
+ Eflag = 1;
+ }
if (mflag == 2)
mflag = iflag;
for (i = 0; i < NOPTS; i++)
OpenPOWER on IntegriCloud