From 89324074c4d365e96b566559c77cc27f049872c5 Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Sat, 9 May 2015 15:45:08 +0900 Subject: [PATCH] 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. --- check.pl | 2 +- exec.c | 2 +- main.c | 6 ++++-- sh.h | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/check.pl b/check.pl index 506e58e..c80ef5e 100644 --- a/check.pl +++ b/check.pl @@ -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'; diff --git a/exec.c b/exec.c index 8e755a6..8d3a486 100644 --- a/exec.c +++ b/exec.c @@ -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 **, diff --git a/main.c b/main.c index 49c6583..7a97005 100644 --- a/main.c +++ b/main.c @@ -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 /* diff --git a/sh.h b/sh.h index 1c19143..48096e5 100644 --- a/sh.h +++ b/sh.h @@ -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