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

Diff for /src/usr.bin/tmux/Attic/server-msg.c between version 1.5 and 1.6

version 1.5, 2009/07/07 17:24:32 version 1.6, 2009/07/23 21:19:11
Line 26 
Line 26 
   
 #include "tmux.h"  #include "tmux.h"
   
 int     server_msg_fn_command(struct hdr *, struct client *);  void    server_msg_fn_command(struct hdr *, struct client *);
 int     server_msg_fn_identify(struct hdr *, struct client *);  void    server_msg_fn_identify(struct hdr *, struct client *);
 int     server_msg_fn_resize(struct hdr *, struct client *);  void    server_msg_fn_resize(struct hdr *, struct client *);
 int     server_msg_fn_exiting(struct hdr *, struct client *);  void    server_msg_fn_exiting(struct hdr *, struct client *);
 int     server_msg_fn_unlock(struct hdr *, struct client *);  void    server_msg_fn_unlock(struct hdr *, struct client *);
 int     server_msg_fn_wakeup(struct hdr *, struct client *);  void    server_msg_fn_wakeup(struct hdr *, struct client *);
   
 void printflike2 server_msg_fn_command_error(  void printflike2 server_msg_fn_command_error(
             struct cmd_ctx *, const char *, ...);              struct cmd_ctx *, const char *, ...);
Line 42 
Line 42 
   
 struct server_msg {  struct server_msg {
         enum hdrtype    type;          enum hdrtype    type;
         int             (*fn)(struct hdr *, struct client *);          void            (*fn)(struct hdr *, struct client *);
 };  };
 const struct server_msg server_msg_table[] = {  const struct server_msg server_msg_table[] = {
         { MSG_IDENTIFY, server_msg_fn_identify },          { MSG_IDENTIFY, server_msg_fn_identify },
Line 59 
Line 59 
         struct hdr               hdr;          struct hdr               hdr;
         const struct server_msg *msg;          const struct server_msg *msg;
         u_int                    i;          u_int                    i;
         int                      n;  
   
         for (;;) {          for (;;) {
                 if (BUFFER_USED(c->in) < sizeof hdr)                  if (BUFFER_USED(c->in) < sizeof hdr)
Line 72 
Line 71 
                 for (i = 0; i < nitems(server_msg_table); i++) {                  for (i = 0; i < nitems(server_msg_table); i++) {
                         msg = server_msg_table + i;                          msg = server_msg_table + i;
                         if (msg->type == hdr.type) {                          if (msg->type == hdr.type) {
                                 if ((n = msg->fn(&hdr, c)) != 0)                                  msg->fn(&hdr, c);
                                         return (n);  
                                 break;                                  break;
                         }                          }
                 }                  }
Line 127 
Line 125 
         xfree(msg);          xfree(msg);
 }  }
   
 int  void
 server_msg_fn_command(struct hdr *hdr, struct client *c)  server_msg_fn_command(struct hdr *hdr, struct client *c)
 {  {
         struct msg_command_data data;          struct msg_command_data data;
Line 160 
Line 158 
                                     "unset $TMUX to force");                                      "unset $TMUX to force");
                                 cmd_list_free(cmdlist);                                  cmd_list_free(cmdlist);
                                 server_write_client(c, MSG_EXIT, NULL, 0);                                  server_write_client(c, MSG_EXIT, NULL, 0);
                                 return (0);                                  return;
                         }                          }
                 }                  }
         }          }
Line 168 
Line 166 
         if (cmd_list_exec(cmdlist, &ctx) != 1)          if (cmd_list_exec(cmdlist, &ctx) != 1)
                 server_write_client(c, MSG_EXIT, NULL, 0);                  server_write_client(c, MSG_EXIT, NULL, 0);
         cmd_list_free(cmdlist);          cmd_list_free(cmdlist);
         return (0);  
 }  }
   
 int  void
 server_msg_fn_identify(struct hdr *hdr, struct client *c)  server_msg_fn_identify(struct hdr *hdr, struct client *c)
 {  {
         struct msg_identify_data        data;          struct msg_identify_data        data;
Line 190 
Line 187 
                 server_write_client(c, MSG_ERROR, MSG, (sizeof MSG) - 1);                  server_write_client(c, MSG_ERROR, MSG, (sizeof MSG) - 1);
 #undef MSG  #undef MSG
                 server_write_client(c, MSG_EXIT, NULL, 0);                  server_write_client(c, MSG_EXIT, NULL, 0);
                 return (0);                  return;
         }          }
   
         c->tty.sx = data.sx;          c->tty.sx = data.sx;
Line 216 
Line 213 
                 xfree(term);                  xfree(term);
   
         c->flags |= CLIENT_TERMINAL;          c->flags |= CLIENT_TERMINAL;
   
         return (0);  
 }  }
   
 int  void
 server_msg_fn_resize(struct hdr *hdr, struct client *c)  server_msg_fn_resize(struct hdr *hdr, struct client *c)
 {  {
         struct msg_resize_data  data;          struct msg_resize_data  data;
Line 247 
Line 242 
   
         /* Always redraw this client. */          /* Always redraw this client. */
         server_redraw_client(c);          server_redraw_client(c);
   
         return (0);  
 }  }
   
 int  void
 server_msg_fn_exiting(struct hdr *hdr, struct client *c)  server_msg_fn_exiting(struct hdr *hdr, struct client *c)
 {  {
         if (hdr->size != 0)          if (hdr->size != 0)
Line 264 
Line 257 
         tty_close(&c->tty, c->flags & CLIENT_SUSPENDED);          tty_close(&c->tty, c->flags & CLIENT_SUSPENDED);
   
         server_write_client(c, MSG_EXITED, NULL, 0);          server_write_client(c, MSG_EXITED, NULL, 0);
   
         return (0);  
 }  }
   
 int  void
 server_msg_fn_unlock(struct hdr *hdr, struct client *c)  server_msg_fn_unlock(struct hdr *hdr, struct client *c)
 {  {
         char    *pass;          char    *pass;
Line 289 
Line 280 
   
         memset(pass, 0, strlen(pass));          memset(pass, 0, strlen(pass));
         xfree(pass);          xfree(pass);
   
         return (0);  
 }  }
   
 int  void
 server_msg_fn_wakeup(struct hdr *hdr, struct client *c)  server_msg_fn_wakeup(struct hdr *hdr, struct client *c)
 {  {
         if (hdr->size != 0)          if (hdr->size != 0)
Line 304 
Line 293 
         c->flags &= ~CLIENT_SUSPENDED;          c->flags &= ~CLIENT_SUSPENDED;
         tty_start_tty(&c->tty);          tty_start_tty(&c->tty);
         server_redraw_client(c);          server_redraw_client(c);
   
         return (0);  
 }  }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6