Commit 0e5be8d4 authored by rswindell's avatar rswindell
Browse files

Added new macro (OS_CMD_SHELL_ENV_VAR) and function (os_cmdshell)

for getting the current OS command processor/shell filename.
parent 1d1a6548
......@@ -371,6 +371,22 @@ char* DLLCALL os_version(char *str)
return(str);
}
char* DLLCALL os_cmdshell(void)
{
char* shell=getenv(OS_CMD_SHELL_ENV_VAR);
#if !defined(__unix__)
if(shell==NULL)
#ifdef _PATH_BSHELL
shell=_PATH_BSHELL;
#else
shell="/bin/sh";
#endif
#endif
return(shell);
}
#if !defined(__unix__)
/****************************************************************************/
......
......@@ -271,6 +271,13 @@ DLLEXPORT int DLLCALL get_errno(void);
#endif
/* Command processor/shell environment variable name */
#ifdef __unix__
#define OS_CMD_SHELL_ENV_VAR "SHELL"
#else /* DOS/Windows/OS2 */
#define OS_CMD_SHELL_ENV_VAR "COMSPEC"
#endif
/* Win32 implementations of recursive (thread-safe) std C time functions on Unix */
#if !defined(__unix__)
......@@ -296,6 +303,7 @@ DLLEXPORT int DLLCALL xp_random(int);
DLLEXPORT long double DLLCALL xp_timer(void);
DLLEXPORT char* DLLCALL os_version(char *str);
DLLEXPORT char* DLLCALL os_cmdshell(void);
DLLEXPORT char* DLLCALL lastchar(const char* str);
DLLEXPORT int DLLCALL safe_snprintf(char *dst, size_t size, const char *fmt, ...);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment