[BACK]Return to window.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/window.c between version 1.7 and 1.8

version 1.7, 2009/07/07 19:49:19 version 1.8, 2009/07/08 05:26:45
Line 23 
Line 23 
 #include <fcntl.h>  #include <fcntl.h>
 #include <fnmatch.h>  #include <fnmatch.h>
 #include <paths.h>  #include <paths.h>
   #include <pwd.h>
 #include <signal.h>  #include <signal.h>
 #include <stdint.h>  #include <stdint.h>
 #include <stdlib.h>  #include <stdlib.h>
Line 57 
Line 58 
   
 RB_GENERATE(winlinks, winlink, entry, winlink_cmp);  RB_GENERATE(winlinks, winlink, entry, winlink_cmp);
   
   const char *
   window_default_command(void)
   {
           const char      *shell;
           struct passwd   *pw;
   
           shell = getenv("SHELL");
           if (shell != NULL && *shell != '\0')
                   return (shell);
   
           pw = getpwuid(getuid());
           if (pw != NULL && pw->pw_shell != NULL && *pw->pw_shell != '\0')
                   return (pw->pw_shell);
   
           return (_PATH_BSHELL);
   }
   
 int  int
 winlink_cmp(struct winlink *wl1, struct winlink *wl2)  winlink_cmp(struct winlink *wl1, struct winlink *wl2)
 {  {
Line 424 
Line 442 
 {  {
         struct winsize   ws;          struct winsize   ws;
         int              mode;          int              mode;
         const char     **envq;          const char     **envq, *ptr;
           char            *argv0;
         struct timeval   tv;          struct timeval   tv;
   
         if (wp->fd != -1)          if (wp->fd != -1)
Line 465 
Line 484 
                 sigreset();                  sigreset();
                 log_close();                  log_close();
   
                 execl(_PATH_BSHELL, "sh", "-c", wp->cmd, (char *) NULL);                  if (*wp->cmd != '\0') {
                           execl(_PATH_BSHELL, "sh", "-c", wp->cmd, (char *) NULL);
                           fatal("execl failed");
                   }
   
                   /* No command; fork a login shell. */
                   cmd = window_default_command();
                   if ((ptr = strrchr(cmd, '/')) != NULL && *(ptr + 1) != '\0')
                           xasprintf(&argv0, "-%s", ptr + 1);
                   else
                           xasprintf(&argv0, "-%s", cmd);
                   execl(cmd, argv0, (char *) NULL);
                 fatal("execl failed");                  fatal("execl failed");
         }          }
   

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8