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

Diff for /src/usr.bin/tmux/tmux.c between version 1.44 and 1.45

version 1.44, 2009/09/22 12:38:10 version 1.45, 2009/09/23 06:18:48
Line 46 
Line 46 
 struct options   global_w_options;      /* window options */  struct options   global_w_options;      /* window options */
 struct environ   global_environ;  struct environ   global_environ;
   
 int              server_locked;  
 struct passwd   *server_locked_pw;  
 u_int            password_failures;  
 time_t           password_backoff;  
 char            *server_password;  
 time_t           server_activity;  time_t           server_activity;
   
 int              debug_level;  int              debug_level;
Line 61 
Line 56 
   
 __dead void      usage(void);  __dead void      usage(void);
 char            *makesockpath(const char *);  char            *makesockpath(const char *);
 int              prepare_unlock(enum msgtype *, void **, size_t *, int);  
 int              prepare_cmd(enum msgtype *, void **, size_t *, int, char **);  int              prepare_cmd(enum msgtype *, void **, size_t *, int, char **);
 int              dispatch_imsg(struct client_ctx *, int *);  int              dispatch_imsg(struct client_ctx *, int *);
   
Line 69 
Line 63 
 usage(void)  usage(void)
 {  {
         fprintf(stderr,          fprintf(stderr,
             "usage: %s [-28dlqUuv] [-f file] [-L socket-name]\n"              "usage: %s [-28dlquv] [-f file] [-L socket-name]\n"
             "            [-S socket-path] [command [flags]]\n",              "            [-S socket-path] [command [flags]]\n",
             __progname);              __progname);
         exit(1);          exit(1);
Line 251 
Line 245 
 }  }
   
 int  int
 prepare_unlock(enum msgtype *msg, void **buf, size_t *len, int argc)  
 {  
         static struct msg_unlock_data    unlockdata;  
         char                            *pass;  
   
         if (argc != 0) {  
                 log_warnx("can't specify a command when unlocking");  
                 return (-1);  
         }  
   
         if ((pass = getpass("Password:")) == NULL)  
                 return (-1);  
   
         if (strlen(pass) >= sizeof unlockdata.pass) {  
                 log_warnx("password too long");  
                 return (-1);  
         }  
   
         strlcpy(unlockdata.pass, pass, sizeof unlockdata.pass);  
         memset(pass, 0, strlen(pass));  
   
         *buf = &unlockdata;  
         *len = sizeof unlockdata;  
   
         *msg = MSG_UNLOCK;  
         return (0);  
 }  
   
 int  
 prepare_cmd(enum msgtype *msg, void **buf, size_t *len, int argc, char **argv)  prepare_cmd(enum msgtype *msg, void **buf, size_t *len, int argc, char **argv)
 {  {
         static struct msg_command_data   cmddata;          static struct msg_command_data   cmddata;
Line 314 
Line 279 
         char                     cwd[MAXPATHLEN];          char                     cwd[MAXPATHLEN];
         void                    *buf;          void                    *buf;
         size_t                   len;          size_t                   len;
         int                      retcode, opt, flags, unlock, cmdflags = 0;          int                      retcode, opt, flags, cmdflags = 0;
         int                      nfds;          int                      nfds;
   
         unlock = flags = 0;          flags = 0;
         label = path = NULL;          label = path = NULL;
         login_shell = (**argv == '-');          login_shell = (**argv == '-');
         while ((opt = getopt(argc, argv, "28df:lL:qS:uUv")) != -1) {          while ((opt = getopt(argc, argv, "28df:lL:qS:uUv")) != -1) {
Line 357 
Line 322 
                 case 'u':                  case 'u':
                         flags |= IDENTIFY_UTF8;                          flags |= IDENTIFY_UTF8;
                         break;                          break;
                 case 'U':  
                         unlock = 1;  
                         break;  
                 case 'v':                  case 'v':
                         debug_level++;                          debug_level++;
                         break;                          break;
Line 407 
Line 369 
         options_set_number(so, "display-time", 750);          options_set_number(so, "display-time", 750);
         options_set_number(so, "history-limit", 2000);          options_set_number(so, "history-limit", 2000);
         options_set_number(so, "lock-after-time", 0);          options_set_number(so, "lock-after-time", 0);
           options_set_string(so, "lock-command", "lock -np");
         options_set_number(so, "message-attr", 0);          options_set_number(so, "message-attr", 0);
         options_set_number(so, "message-bg", 3);          options_set_number(so, "message-bg", 3);
         options_set_number(so, "message-fg", 0);          options_set_number(so, "message-fg", 0);
Line 514 
Line 477 
         }          }
         xfree(label);          xfree(label);
   
         if (unlock) {          if (prepare_cmd(&msg, &buf, &len, argc, argv) != 0)
                 if (prepare_unlock(&msg, &buf, &len, argc) != 0)                  exit(1);
                         exit(1);  
         } else {  
                 if (prepare_cmd(&msg, &buf, &len, argc, argv) != 0)  
                         exit(1);  
         }  
   
         if (unlock)          if (argc == 0)  /* new-session is the default */
                 cmdflags &= ~CMD_STARTSERVER;  
         else if (argc == 0)     /* new-session is the default */  
                 cmdflags |= CMD_STARTSERVER|CMD_SENDENVIRON;                  cmdflags |= CMD_STARTSERVER|CMD_SENDENVIRON;
         else {          else {
                 /*                  /*

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.45