allow MKSHRC_PATH to change from 「"~/.mkshrc"」, for Android &c.

This commit is contained in:
tg 2010-03-27 20:36:26 +00:00
parent 401e262689
commit f41d5ba82f
3 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.448 2010/03/27 15:32:58 tg Exp $'
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.449 2010/03/27 20:36:25 tg Exp $'
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Thorsten Glaser <tg@mirbsd.org>
@ -28,7 +28,7 @@ srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.448 2010/03/27 15:32:58 tg Exp $'
# CPPFLAGS recognised: MKSH_ASSUME_UTF8 MKSH_BINSHREDUCED MKSH_CLS_STRING
# MKSH_CONSERVATIVE_FDS MKSH_MIDNIGHTBSD01ASH_COMPAT
# MKSH_NOPWNAM MKSH_NO_LIMITS MKSH_SMALL MKSH_S_NOVI
# MKSH_UNEMPLOYED MKSH_DEFAULT_EXECSHELL
# MKSH_UNEMPLOYED MKSH_DEFAULT_EXECSHELL MKSHRC_PATH
LC_ALL=C
export LC_ALL

8
main.c
View File

@ -33,7 +33,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.162 2010/01/29 09:34:29 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.163 2010/03/27 20:36:26 tg Exp $");
extern char **environ;
@ -42,6 +42,10 @@ extern uid_t kshuid;
extern gid_t kshgid, kshegid;
#endif
#ifndef MKSHRC_PATH
#define MKSHRC_PATH "~/.mkshrc"
#endif
static void reclaim(void);
static void remove_temps(struct temp *);
void chvt_reinit(void);
@ -429,7 +433,7 @@ mksh_init(int argc, const char *argv[])
char *env_file;
/* include $ENV */
env_file = substitute(substitute("${ENV:-~/.mkshrc}", 0),
env_file = substitute(substitute("${ENV:-" MKSHRC_PATH "}", 0),
DOTILDE);
if (*env_file != '\0')
include(env_file, 0, NULL, 1);

3
mksh.1
View File

@ -1,4 +1,4 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.221 2010/03/27 16:51:38 tg Exp $
.\" $MirOS: src/bin/mksh/mksh.1,v 1.222 2010/03/27 20:36:26 tg Exp $
.\" $OpenBSD: ksh.1,v 1.131 2010/02/26 03:32:39 william Exp $
.\"-
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
@ -5890,6 +5890,7 @@ User's startup script (interactive shells).
Used only if
.Ev ENV
is unset or empty.
The location can be changed at compile time (for embedded systems).
.It Pa \*(TI/.profile
User's login profile.
.It Pa /etc/profile