diff --git a/check.t b/check.t index 1afb4be..7f104df 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.37 2006/01/29 20:56:54 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.38 2006/05/08 11:42:36 tg Exp $ # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ @@ -3736,5 +3736,5 @@ category: pdksh stdin: echo $KSH_VERSION expected-stdout: - @(#)MIRBSD KSH R26 2006/01/29 + @(#)MIRBSD KSH R26 2006/05/08 --- diff --git a/main.c b/main.c index 4541ff2..2d74bfe 100644 --- a/main.c +++ b/main.c @@ -6,9 +6,9 @@ #define EXTERN /* define EXTERNs in sh.h */ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/main.c,v 1.34 2006/01/30 12:37:23 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/main.c,v 1.35 2006/05/08 11:42:36 tg Exp $"); -#define MKSH_VERSION "@(#)MIRBSD KSH R26 2006/01/29" +#define MKSH_VERSION "@(#)MIRBSD KSH R26 2006/05/08" extern char **environ; @@ -298,7 +298,8 @@ main(int argc, char *argv[]) char *env_file; /* include $ENV */ - env_file = substitute(str_val(global("ENV")), DOTILDE); + env_file = substitute(substitute("${ENV:-~/.mkshrc}", 0), + DOTILDE); if (*env_file != '\0') include(env_file, 0, NULL, 1); } diff --git a/mksh.1 b/mksh.1 index e5cd1b2..20baeba 100644 --- a/mksh.1 +++ b/mksh.1 @@ -1,4 +1,4 @@ -.\" $MirOS: src/bin/mksh/mksh.1,v 1.30 2006/02/16 11:48:32 tg Exp $ +.\" $MirOS: src/bin/mksh/mksh.1,v 1.31 2006/05/08 11:42:36 tg Exp $ .\" $OpenBSD: ksh.1,v 1.109 2005/12/06 20:40:02 jmc Exp $ .\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $ .\" @@ -95,7 +95,9 @@ A privileged shell does not process .Pa $HOME/.profile nor the .Ev ENV -parameter (see below). +parameter or +.Pa $HOME/.mkshrc +(see below). Instead, the file .Pa /etc/suid_profile is processed. @@ -183,6 +185,16 @@ command, arithmetic, and tilde .Pq Sq ~ substitution and the resulting file (if any) is read and executed. +If the +.Ev ENV +variable is unset, the file +.Pa $HOME/.mkshrc +is read and processed like above instead, leaving +.Ev ENV +unset in the shell environment. +This processing does not occur if +.Ev ENV +is set to a non-existing filename. .Pp The exit status of the shell is 127 if the command file specified on the command line could not be opened, or non-zero if a fatal syntax error @@ -5121,6 +5133,11 @@ deleted and a new prompt to be printed. .El .Sh FILES .Bl -tag -width "/etc/suid_profileXX" -compact +.It Pa ~/.mkshrc +User's startup script. +Used only if +.Ev ENV +is unset. .It Pa ~/.profile User's login profile. .It Pa /etc/profile