From f41d5ba82f35c03c4974e5713135b1142d5a85f1 Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 27 Mar 2010 20:36:26 +0000 Subject: [PATCH] =?UTF-8?q?allow=20MKSHRC=5FPATH=20to=20change=20from=20?= =?UTF-8?q?=E3=80=8C"~/.mkshrc"=E3=80=8D,=20for=20Android=20&c.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Build.sh | 4 ++-- main.c | 8 ++++++-- mksh.1 | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Build.sh b/Build.sh index 62146e2..96489cf 100644 --- a/Build.sh +++ b/Build.sh @@ -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 @@ -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 diff --git a/main.c b/main.c index ac3db32..a91aa63 100644 --- a/main.c +++ b/main.c @@ -33,7 +33,7 @@ #include #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); diff --git a/mksh.1 b/mksh.1 index 5174821..9780ee1 100644 --- a/mksh.1 +++ b/mksh.1 @@ -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