version 1.18, 2009/08/08 21:52:43 |
version 1.19, 2009/08/11 21:28:11 |
|
|
const char * |
const char * |
window_default_command(void) |
window_default_command(void) |
{ |
{ |
const char *shell; |
const char *shell, *ptr; |
struct passwd *pw; |
struct passwd *pw; |
|
|
shell = getenv("SHELL"); |
shell = getenv("SHELL"); |
if (shell != NULL && *shell != '\0') |
if (shell != NULL && *shell != '\0') |
return (shell); |
goto found; |
|
|
pw = getpwuid(getuid()); |
pw = getpwuid(getuid()); |
if (pw != NULL && pw->pw_shell != NULL && *pw->pw_shell != '\0') |
if (pw != NULL && pw->pw_shell != NULL && *pw->pw_shell != '\0') { |
return (pw->pw_shell); |
shell = pw->pw_shell; |
|
goto found; |
|
} |
|
|
return (_PATH_BSHELL); |
return (_PATH_BSHELL); |
|
|
|
found: |
|
if ((ptr = strrchr(shell, '/')) != NULL) |
|
ptr++; |
|
else |
|
ptr = shell; |
|
if (strcmp(ptr, __progname) == 0) |
|
return (_PATH_BSHELL); |
|
return (shell); |
} |
} |
|
|
int |
int |