Anyone checking their mailboxes in the installer's interactive shell?
MAIL If set, the user will be informed of the arrival of mail in
the named file. This parameter is ignored if the MAILPATH
parameter is set.
MAILCHECK ...
MAILPATH ...
Put it behind !SMALL to save some bits; no `grep -r MAIL distrib/' hits.
It could also be a feature like -DVI, but vi mode actually seems reasonable
to flip in custom builds while I can't think of a use case for -DMAIL.
Feedback? Objection? OK?
Index: bin/ksh/main.c
===
RCS file: /cvs/src/bin/ksh/main.c,v
retrieving revision 1.99
diff -u -p -r1.99 main.c
--- bin/ksh/main.c 8 Feb 2023 17:22:10 - 1.99
+++ bin/ksh/main.c 8 Feb 2023 21:14:00 -
@@ -87,7 +87,11 @@ static const char *initcoms [] = {
"typeset", "-x", "SHELL", "PATH", "HOME", "PWD", "OLDPWD", NULL,
"typeset", "-ir", "PPID", NULL,
"typeset", "-i", "OPTIND=1", NULL,
+#ifndef SMALL
"eval", "typeset -i RANDOM MAILCHECK=\"${MAILCHECK-600}\"
SECONDS=\"${SECONDS-0}\" TMOUT=\"${TMOUT-0}\"", NULL,
+#else
+ "eval", "typeset -i RANDOM SECONDS=\"${SECONDS-0}\"
TMOUT=\"${TMOUT-0}\"", NULL,
+#endif /* SMALL */
"alias",
/* Standard ksh aliases */
"hash=alias -t", /* not "alias -t --": hash -r needs to work */
@@ -615,7 +619,9 @@ shell(Source *volatile s, volatile int t
if (interactive) {
got_sigwinch = 1;
j_notify();
+#ifndef SMALL
mcheck();
+#endif /* SMALL */
set_prompt(PS1);
}
Index: bin/ksh/var.c
===
RCS file: /cvs/src/bin/ksh/var.c,v
retrieving revision 1.72
diff -u -p -r1.72 var.c
--- bin/ksh/var.c 5 Mar 2021 15:22:03 - 1.72
+++ bin/ksh/var.c 8 Feb 2023 21:15:21 -
@@ -108,9 +108,11 @@ initvar(void)
{ "HISTSIZE", V_HISTSIZE },
{ "EDITOR", V_EDITOR },
{ "VISUAL", V_VISUAL },
+#ifndef SMALL
{ "MAIL", V_MAIL },
{ "MAILCHECK", V_MAILCHECK },
{ "MAILPATH", V_MAILPATH },
+#endif /* SMALL */
{ "RANDOM", V_RANDOM },
{ "SECONDS",V_SECONDS },
{ "TMOUT", V_TMOUT },
@@ -1029,6 +1031,7 @@ setspec(struct tbl *vp)
x_cols = l;
}
break;
+#ifndef SMALL
case V_MAIL:
mbset(str_val(vp));
break;
@@ -1040,6 +1043,7 @@ setspec(struct tbl *vp)
mcset(intval(vp));
vp->flag |= SPECIAL;
break;
+#endif /* SMALL */
case V_RANDOM:
vp->flag &= ~SPECIAL;
srand_deterministic((unsigned int)intval(vp));
@@ -1099,17 +1103,21 @@ unsetspec(struct tbl *vp)
afree(tmpdir, APERM);
tmpdir = NULL;
break;
+#ifndef SMALL
case V_MAIL:
mbset(NULL);
break;
case V_MAILPATH:
mpset(NULL);
break;
+#endif /* SMALL */
case V_HISTCONTROL:
sethistcontrol(NULL);
break;
case V_LINENO:
+#ifndef SMALL
case V_MAILCHECK: /* at&t ksh leaves previous value in place */
+#endif /* SMALL */
case V_RANDOM:
case V_SECONDS:
case V_TMOUT: /* at&t ksh leaves previous value in place */
Index: distrib/special/ksh/Makefile
===
RCS file: /cvs/src/distrib/special/ksh/Makefile,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile
--- distrib/special/ksh/Makefile8 Feb 2023 17:22:10 - 1.6
+++ distrib/special/ksh/Makefile8 Feb 2023 20:41:00 -
@@ -2,7 +2,7 @@
PROG= ksh
SRCS= alloc.c c_ksh.c c_sh.c c_test.c c_ulimit.c edit.c emacs.c eval.c \
- exec.c expr.c history.c io.c jobs.c lex.c mail.c main.c \
+ exec.c expr.c history.c io.c jobs.c lex.c main.c \
misc.c path.c shf.c syn.c table.c trap.c tree.c tty.c var.c \
vi.c