Prepend /@unixroot to rooted paths on OS/2

$UNIXROOT is a root directory of FHS on OS/2. /@unixroot is replaced by
$UNIXROOT at runtime.
This commit is contained in:
KO Myung-Hun 2015-05-09 15:45:08 +09:00
parent 0fbbbed49c
commit 89324074c4
4 changed files with 9 additions and 5 deletions

View File

@ -275,7 +275,7 @@ $all_tests = @ARGV == 0;
# Set up a very minimal environment
%new_env = ();
foreach $env (('HOME', 'LD_LIBRARY_PATH', 'LOCPATH', 'LOGNAME',
'PATH', 'SHELL', 'UNIXMODE', 'USER')) {
'PATH', 'SHELL', 'UNIXMODE', 'USER', 'UNIXROOT')) {
$new_env{$env} = $ENV{$env} if defined $ENV{$env};
}
$new_env{'CYGWIN'} = 'nodosfilewarning';

2
exec.c
View File

@ -26,7 +26,7 @@
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.152 2015/04/29 18:32:43 tg Exp $");
#ifndef MKSH_DEFAULT_EXECSHELL
#define MKSH_DEFAULT_EXECSHELL "/bin/sh"
#define MKSH_DEFAULT_EXECSHELL UNIXROOT "/bin/sh"
#endif
static int comexec(struct op *, struct tbl * volatile, const char **,

6
main.c
View File

@ -43,7 +43,7 @@ extern char **environ;
#endif
#ifndef MKSH_DEFAULT_TMPDIR
#define MKSH_DEFAULT_TMPDIR "/tmp"
#define MKSH_DEFAULT_TMPDIR UNIXROOT "/tmp"
#endif
static uint8_t isuc(const char *);
@ -323,7 +323,9 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp)
* "keeping a regular /usr"; this is supposed
* to be a sane 'basic' default PATH
*/
def_path = "/bin:/usr/bin:/sbin:/usr/sbin";
def_path = UNIXROOT "/bin" PATH_SEP_STR
UNIXROOT "/usr/bin" PATH_SEP_STR
UNIXROOT "/sbin" PATH_SEP_STR UNIXROOT "/usr/sbin";
#endif
/*

4
sh.h
View File

@ -303,6 +303,7 @@ struct rusage {
#endif
#ifdef __OS2__
#define UNIXROOT "/@unixroot"
#define PATH_SEP ';'
#define PATH_SEP_STR ";"
#define IS_DIR_SEP(c) ({ \
@ -328,6 +329,7 @@ struct rusage {
(ksh_isalphx(_p_[0]) && _p_[1] == ':')); \
})
#else
#define UNIXROOT ""
#define PATH_SEP ':'
#define PATH_SEP_STR ":"
#define IS_DIR_SEP(c) ((c) == '/')
@ -1083,7 +1085,7 @@ EXTERN mksh_ari_t x_lins E_INIT(24); /* tty lines */
#if defined(ANDROID)
#define MKSH_DEFAULT_PROFILEDIR "/system/etc"
#else
#define MKSH_DEFAULT_PROFILEDIR "/etc"
#define MKSH_DEFAULT_PROFILEDIR UNIXROOT "/etc"
#endif
#endif