=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/window.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- src/usr.bin/tmux/window.c 2009/08/08 21:52:43 1.18 +++ src/usr.bin/tmux/window.c 2009/08/11 21:28:11 1.19 @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.18 2009/08/08 21:52:43 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.19 2009/08/11 21:28:11 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -61,18 +61,29 @@ const char * window_default_command(void) { - const char *shell; + const char *shell, *ptr; struct passwd *pw; shell = getenv("SHELL"); if (shell != NULL && *shell != '\0') - return (shell); + goto found; pw = getpwuid(getuid()); - if (pw != NULL && pw->pw_shell != NULL && *pw->pw_shell != '\0') - return (pw->pw_shell); + if (pw != NULL && pw->pw_shell != NULL && *pw->pw_shell != '\0') { + shell = pw->pw_shell; + goto found; + } return (_PATH_BSHELL); + +found: + if ((ptr = strrchr(shell, '/')) != NULL) + ptr++; + else + ptr = shell; + if (strcmp(ptr, __progname) == 0) + return (_PATH_BSHELL); + return (shell); } int