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

Diff for /src/usr.bin/tmux/client.c between version 1.110 and 1.111

version 1.110, 2015/11/24 23:01:51 version 1.111, 2015/11/24 23:22:51
Line 53 
Line 53 
 const char      *client_exitsession;  const char      *client_exitsession;
 int              client_attached;  int              client_attached;
   
 __dead void     client_exec(const char *);  __dead void     client_exec(const char *,const char *);
 int             client_get_lock(char *);  int             client_get_lock(char *);
 int             client_connect(struct event_base *, const char *, int);  int             client_connect(struct event_base *, const char *, int);
 void            client_send_identify(const char *, const char *);  void            client_send_identify(const char *, const char *);
Line 62 
Line 62 
 void            client_signal(int);  void            client_signal(int);
 void            client_dispatch(struct imsg *, void *);  void            client_dispatch(struct imsg *, void *);
 void            client_dispatch_attached(struct imsg *);  void            client_dispatch_attached(struct imsg *);
 void            client_dispatch_wait(struct imsg *);  void            client_dispatch_wait(struct imsg *, const char *);
 const char     *client_exit_message(void);  const char     *client_exit_message(void);
   
 /*  /*
Line 213 
Line 213 
   
 /* Client main loop. */  /* Client main loop. */
 int  int
 client_main(struct event_base *base, int argc, char **argv, int flags)  client_main(struct event_base *base, int argc, char **argv, int flags,
       const char *shellcmd)
 {  {
         struct cmd              *cmd;          struct cmd              *cmd;
         struct cmd_list         *cmdlist;          struct cmd_list         *cmdlist;
Line 234 
Line 235 
   
         /* Set up the initial command. */          /* Set up the initial command. */
         cmdflags = 0;          cmdflags = 0;
         if (shell_cmd != NULL) {          if (shellcmd != NULL) {
                 msg = MSG_SHELL;                  msg = MSG_SHELL;
                 cmdflags = CMD_STARTSERVER;                  cmdflags = CMD_STARTSERVER;
         } else if (argc == 0) {          } else if (argc == 0) {
Line 276 
Line 277 
                 }                  }
                 return (1);                  return (1);
         }          }
         client_peer = proc_add_peer(client_proc, fd, client_dispatch, NULL);          client_peer = proc_add_peer(client_proc, fd, client_dispatch,
               (void *)shellcmd);
   
         /* Save these before pledge(). */          /* Save these before pledge(). */
         if ((cwd = getcwd(path, sizeof path)) == NULL) {          if ((cwd = getcwd(path, sizeof path)) == NULL) {
Line 450 
Line 452 
   
 /* Run command in shell; used for -c. */  /* Run command in shell; used for -c. */
 __dead void  __dead void
 client_exec(const char *shell)  client_exec(const char *shell, const char *shellcmd)
 {  {
         const char      *name, *ptr;          const char      *name, *ptr;
         char            *argv0;          char            *argv0;
   
         log_debug("shell %s, command %s", shell, shell_cmd);          log_debug("shell %s, command %s", shell, shellcmd);
   
         ptr = strrchr(shell, '/');          ptr = strrchr(shell, '/');
         if (ptr != NULL && *(ptr + 1) != '\0')          if (ptr != NULL && *(ptr + 1) != '\0')
Line 473 
Line 475 
         setblocking(STDERR_FILENO, 1);          setblocking(STDERR_FILENO, 1);
         closefrom(STDERR_FILENO + 1);          closefrom(STDERR_FILENO + 1);
   
         execl(shell, argv0, "-c", shell_cmd, (char *) NULL);          execl(shell, argv0, "-c", shellcmd, (char *) NULL);
         fatal("execl failed");          fatal("execl failed");
 }  }
   
Line 519 
Line 521 
   
 /* Callback for client read events. */  /* Callback for client read events. */
 void  void
 client_dispatch(struct imsg *imsg, __unused void *arg)  client_dispatch(struct imsg *imsg, void *arg)
 {  {
         if (imsg == NULL) {          if (imsg == NULL) {
                 client_exitreason = CLIENT_EXIT_LOST_SERVER;                  client_exitreason = CLIENT_EXIT_LOST_SERVER;
Line 531 
Line 533 
         if (client_attached)          if (client_attached)
                 client_dispatch_attached(imsg);                  client_dispatch_attached(imsg);
         else          else
                 client_dispatch_wait(imsg);                  client_dispatch_wait(imsg, arg);
 }  }
   
 /* Dispatch imsgs when in wait state (before MSG_READY). */  /* Dispatch imsgs when in wait state (before MSG_READY). */
 void  void
 client_dispatch_wait(struct imsg *imsg)  client_dispatch_wait(struct imsg *imsg, const char *shellcmd)
 {  {
         char                    *data;          char                    *data;
         ssize_t                  datalen;          ssize_t                  datalen;
Line 616 
Line 618 
                         fatalx("bad MSG_SHELL string");                          fatalx("bad MSG_SHELL string");
   
                 clear_signals(0);                  clear_signals(0);
                 client_exec(data);                  client_exec(data, shellcmd);
                 /* NOTREACHED */                  /* NOTREACHED */
         case MSG_DETACH:          case MSG_DETACH:
         case MSG_DETACHKILL:          case MSG_DETACHKILL:

Legend:
Removed from v.1.110  
changed lines
  Added in v.1.111