split path-specific ('C:\FOO' instead of '/foo') stuff into MKSH_DOSPATH:
• backslashes as directory separators • semicolon as $PATH separator • drive letters are absolute paths
This commit is contained in:
parent
7529e350cf
commit
d68e69bd59
4
exec.c
4
exec.c
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.191 2017/03/22 00:20:51 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.192 2017/04/02 13:08:06 tg Exp $");
|
||||||
|
|
||||||
#ifndef MKSH_DEFAULT_EXECSHELL
|
#ifndef MKSH_DEFAULT_EXECSHELL
|
||||||
#define MKSH_DEFAULT_EXECSHELL MKSH_UNIXROOT "/bin/sh"
|
#define MKSH_DEFAULT_EXECSHELL MKSH_UNIXROOT "/bin/sh"
|
||||||
@ -1136,7 +1136,7 @@ findcom(const char *name, int flags)
|
|||||||
union mksh_cchack npath;
|
union mksh_cchack npath;
|
||||||
|
|
||||||
if (mksh_vdirsep(name)
|
if (mksh_vdirsep(name)
|
||||||
#ifdef __OS2__
|
#ifdef MKSH_DOSPATH
|
||||||
&& (strcmp(name, T_builtin) != 0)
|
&& (strcmp(name, T_builtin) != 0)
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
|
4
misc.c
4
misc.c
@ -30,7 +30,7 @@
|
|||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.253 2017/03/26 00:10:24 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.254 2017/04/02 13:08:06 tg Exp $");
|
||||||
|
|
||||||
#define KSH_CHVT_FLAG
|
#define KSH_CHVT_FLAG
|
||||||
#ifdef MKSH_SMALL
|
#ifdef MKSH_SMALL
|
||||||
@ -1705,7 +1705,7 @@ simplify_path(char *p)
|
|||||||
case 0:
|
case 0:
|
||||||
return;
|
return;
|
||||||
case '/':
|
case '/':
|
||||||
#ifdef __OS2__
|
#ifdef MKSH_DOSPATH
|
||||||
case '\\':
|
case '\\':
|
||||||
#endif
|
#endif
|
||||||
/* exactly two leading slashes? (SUSv4 3.266) */
|
/* exactly two leading slashes? (SUSv4 3.266) */
|
||||||
|
25
sh.h
25
sh.h
@ -175,7 +175,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.798 2017/03/26 00:10:25 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.799 2017/04/02 13:08:07 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R54 2017/03/25"
|
#define MKSH_VERSION "R54 2017/03/25"
|
||||||
|
|
||||||
@ -392,13 +392,21 @@ struct rusage {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
|
#define MKSH_UNIXROOT "/@unixroot"
|
||||||
|
#define MKSH_DOSPATH
|
||||||
|
#else
|
||||||
|
#define MKSH_UNIXROOT ""
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MKSH_DOSPATH
|
||||||
|
#ifndef __GNUC__
|
||||||
|
# error GCC extensions needed later on
|
||||||
|
#endif
|
||||||
#define MKSH_PATHSEPS ";"
|
#define MKSH_PATHSEPS ";"
|
||||||
#define MKSH_PATHSEPC ';'
|
#define MKSH_PATHSEPC ';'
|
||||||
#define MKSH_UNIXROOT "/@unixroot"
|
|
||||||
#else
|
#else
|
||||||
#define MKSH_PATHSEPS ":"
|
#define MKSH_PATHSEPS ":"
|
||||||
#define MKSH_PATHSEPC ':'
|
#define MKSH_PATHSEPC ':'
|
||||||
#define MKSH_UNIXROOT ""
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !HAVE_FLOCK_DECL
|
#if !HAVE_FLOCK_DECL
|
||||||
@ -2405,9 +2413,6 @@ EXTERN bool tty_hasstate; /* true if tty_state is valid */
|
|||||||
extern int tty_init_fd(void); /* initialise tty_fd, tty_devtty */
|
extern int tty_init_fd(void); /* initialise tty_fd, tty_devtty */
|
||||||
|
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
#ifndef __GNUC__
|
|
||||||
# error oops?
|
|
||||||
#endif
|
|
||||||
#define binopen2(path,flags) __extension__({ \
|
#define binopen2(path,flags) __extension__({ \
|
||||||
int binopen2_fd = open((path), (flags) | O_BINARY); \
|
int binopen2_fd = open((path), (flags) | O_BINARY); \
|
||||||
if (binopen2_fd >= 0) \
|
if (binopen2_fd >= 0) \
|
||||||
@ -2420,6 +2425,12 @@ extern int tty_init_fd(void); /* initialise tty_fd, tty_devtty */
|
|||||||
setmode(binopen3_fd, O_BINARY); \
|
setmode(binopen3_fd, O_BINARY); \
|
||||||
(binopen3_fd); \
|
(binopen3_fd); \
|
||||||
})
|
})
|
||||||
|
#else
|
||||||
|
#define binopen2(path,flags) open((path), (flags) | O_BINARY)
|
||||||
|
#define binopen3(path,flags,mode) open((path), (flags) | O_BINARY, (mode))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MKSH_DOSPATH
|
||||||
#define mksh_abspath(s) __extension__({ \
|
#define mksh_abspath(s) __extension__({ \
|
||||||
const char *mksh_abspath_s = (s); \
|
const char *mksh_abspath_s = (s); \
|
||||||
(mksh_cdirsep(mksh_abspath_s[0]) || \
|
(mksh_cdirsep(mksh_abspath_s[0]) || \
|
||||||
@ -2436,8 +2447,6 @@ extern int tty_init_fd(void); /* initialise tty_fd, tty_devtty */
|
|||||||
* can merge this upstream, but good job so far @komh, thanks!
|
* can merge this upstream, but good job so far @komh, thanks!
|
||||||
*/
|
*/
|
||||||
#else
|
#else
|
||||||
#define binopen2(path,flags) open((path), (flags) | O_BINARY)
|
|
||||||
#define binopen3(path,flags,mode) open((path), (flags) | O_BINARY, (mode))
|
|
||||||
#define mksh_abspath(s) ((s)[0] == '/')
|
#define mksh_abspath(s) ((s)[0] == '/')
|
||||||
#define mksh_cdirsep(c) ((c) == '/')
|
#define mksh_cdirsep(c) ((c) == '/')
|
||||||
#define mksh_sdirsep(s) strchr((s), '/')
|
#define mksh_sdirsep(s) strchr((s), '/')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user