-/* $OpenBSD: lex.c,v 1.78 2018/01/15 14:58:05 jca Exp $ */
+/* $OpenBSD: lex.c,v 1.79 2023/02/08 17:22:10 kn Exp $ */
/*
* lexical analysis and source input
case 'u': /* '\' 'u' username */
strlcpy(strbuf, username, sizeof strbuf);
break;
+#ifndef SMALL
case 'v': /* '\' 'v' version (short) */
p = strchr(ksh_version, ' ');
if (p)
case 'V': /* '\' 'V' version (long) */
strlcpy(strbuf, ksh_version, sizeof strbuf);
break;
+#endif /* SMALL */
case 'w': /* '\' 'w' cwd */
p = str_val(global("PWD"));
n = strlen(str_val(global("HOME")));
-/* $OpenBSD: main.c,v 1.98 2019/06/28 13:34:59 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.99 2023/02/08 17:22:10 kn Exp $ */
/*
* startup, main loop, environments and error handling
static const char initsubs[] = "${PS2=> } ${PS3=#? } ${PS4=+ }";
static const char *initcoms [] = {
+#ifndef SMALL
"typeset", "-r", "KSH_VERSION", NULL,
+#endif /* SMALL */
"typeset", "-x", "SHELL", "PATH", "HOME", "PWD", "OLDPWD", NULL,
"typeset", "-ir", "PPID", NULL,
"typeset", "-i", "OPTIND=1", NULL,
char username[_PW_NAME_LEN + 1];
+#ifndef SMALL
#define version_param (initcoms[2])
+#endif /* SMALL */
/* The shell uses its own variation on argv, to build variables like
* $0 and $@.
(strlen(kshname) >= 3 &&
!strcmp(&kshname[strlen(kshname) - 3], "/sh"))) {
Flag(FSH) = 1;
+#ifndef SMALL
version_param = "SH_VERSION";
+#endif /* SMALL */
}
/* Set edit mode to emacs by default, may be overridden
}
ppid = getppid();
setint(global("PPID"), (int64_t) ppid);
+#ifndef SMALL
/* setstr can't fail here */
setstr(global(version_param), ksh_version, KSH_RETURN_ERROR);
+#endif /* SMALL */
/* execute initialization statements */
for (wp = (char**) initcoms; *wp != NULL; wp++) {
-# $OpenBSD: Makefile,v 1.5 2017/08/01 14:30:07 deraadt Exp $
+# $OpenBSD: Makefile,v 1.6 2023/02/08 17:22:10 kn Exp $
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 \
misc.c path.c shf.c syn.c table.c trap.c tree.c tty.c var.c \
- version.c vi.c
+ vi.c
DEFS= -Wall -DEMACS -DSMALL
CFLAGS+=${DEFS} -I. -I${.CURDIR}/../../../bin/ksh -I${.CURDIR}/../../../lib/libc/gen