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

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);