summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2023-07-23 23:42:04 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2023-07-23 23:42:04 +0000
commitd996aac500be9c2888fc3fc9561d1ba2a9da7dcc (patch)
treeede3c979fdaeab09ac2efec6e6b17d857cc65514 /bin
parent1be80e21db0b00421a778eb9820278407928d229 (diff)
avoid MAIL* environment variables to save a few bytes in install media
ksh(1) MAIL, MAILCHECK, MAILPATH mbox handling is useless in the installer. OK miod deraadt
Diffstat (limited to 'bin')
-rw-r--r--bin/ksh/main.c8
-rw-r--r--bin/ksh/var.c10
2 files changed, 16 insertions, 2 deletions
diff --git a/bin/ksh/main.c b/bin/ksh/main.c
index 5ab581ecaaf..b011b22bfc0 100644
--- a/bin/ksh/main.c
+++ b/bin/ksh/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.99 2023/02/08 17:22:10 kn Exp $ */
+/* $OpenBSD: main.c,v 1.100 2023/07/23 23:42:03 kn Exp $ */
/*
* startup, main loop, environments and error handling
@@ -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 toplevel)
if (interactive) {
got_sigwinch = 1;
j_notify();
+#ifndef SMALL
mcheck();
+#endif /* SMALL */
set_prompt(PS1);
}
diff --git a/bin/ksh/var.c b/bin/ksh/var.c
index 9dbba073166..0757440ed66 100644
--- a/bin/ksh/var.c
+++ b/bin/ksh/var.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: var.c,v 1.72 2021/03/05 15:22:03 zhuk Exp $ */
+/* $OpenBSD: var.c,v 1.73 2023/07/23 23:42:03 kn Exp $ */
#include <sys/stat.h>
#include <sys/time.h>
@@ -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 */