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

Diff for /src/usr.bin/tmux/cmd-show-environment.c between version 1.6 and 1.7

version 1.6, 2012/07/11 07:10:15 version 1.7, 2013/03/24 09:54:10
Line 27 
Line 27 
  * Show environment.   * Show environment.
  */   */
   
 enum cmd_retval  cmd_show_environment_exec(struct cmd *, struct cmd_ctx *);  enum cmd_retval  cmd_show_environment_exec(struct cmd *, struct cmd_q *);
   
 const struct cmd_entry cmd_show_environment_entry = {  const struct cmd_entry cmd_show_environment_entry = {
         "show-environment", "showenv",          "show-environment", "showenv",
Line 40 
Line 40 
 };  };
   
 enum cmd_retval  enum cmd_retval
 cmd_show_environment_exec(struct cmd *self, struct cmd_ctx *ctx)  cmd_show_environment_exec(struct cmd *self, struct cmd_q *cmdq)
 {  {
         struct args             *args = self->args;          struct args             *args = self->args;
         struct session          *s;          struct session          *s;
Line 50 
Line 50 
         if (args_has(self->args, 'g'))          if (args_has(self->args, 'g'))
                 env = &global_environ;                  env = &global_environ;
         else {          else {
                 if ((s = cmd_find_session(ctx, args_get(args, 't'), 0)) == NULL)                  if ((s = cmd_find_session(cmdq, args_get(args, 't'), 0)) == NULL)
                         return (CMD_RETURN_ERROR);                          return (CMD_RETURN_ERROR);
                 env = &s->environ;                  env = &s->environ;
         }          }
Line 58 
Line 58 
         if (args->argc != 0) {          if (args->argc != 0) {
                 envent = environ_find(env, args->argv[0]);                  envent = environ_find(env, args->argv[0]);
                 if (envent == NULL) {                  if (envent == NULL) {
                         ctx->error(ctx, "unknown variable: %s", args->argv[0]);                          cmdq_error(cmdq, "unknown variable: %s", args->argv[0]);
                         return (CMD_RETURN_ERROR);                          return (CMD_RETURN_ERROR);
                 }                  }
                 if (envent->value != NULL)                  if (envent->value != NULL)
                         ctx->print(ctx, "%s=%s", envent->name, envent->value);                          cmdq_print(cmdq, "%s=%s", envent->name, envent->value);
                 else                  else
                         ctx->print(ctx, "-%s", envent->name);                          cmdq_print(cmdq, "-%s", envent->name);
                 return (CMD_RETURN_NORMAL);                  return (CMD_RETURN_NORMAL);
         }          }
   
         RB_FOREACH(envent, environ, env) {          RB_FOREACH(envent, environ, env) {
                 if (envent->value != NULL)                  if (envent->value != NULL)
                         ctx->print(ctx, "%s=%s", envent->name, envent->value);                          cmdq_print(cmdq, "%s=%s", envent->name, envent->value);
                 else                  else
                         ctx->print(ctx, "-%s", envent->name);                          cmdq_print(cmdq, "-%s", envent->name);
         }          }
   
         return (CMD_RETURN_NORMAL);          return (CMD_RETURN_NORMAL);

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