Remove CMD_SENDENVIRON.

pull/1/head
nicm 2013-10-10 12:09:34 +00:00
parent d2160e3f83
commit 6c093010e0
4 changed files with 41 additions and 39 deletions

View File

@ -179,7 +179,7 @@ client_main(int argc, char **argv, int flags)
cmdflags = CMD_STARTSERVER; cmdflags = CMD_STARTSERVER;
} else if (argc == 0) { } else if (argc == 0) {
msg = MSG_COMMAND; msg = MSG_COMMAND;
cmdflags = CMD_STARTSERVER|CMD_SENDENVIRON|CMD_CANTNEST; cmdflags = CMD_STARTSERVER|CMD_CANTNEST;
} else { } else {
msg = MSG_COMMAND; msg = MSG_COMMAND;
@ -197,8 +197,6 @@ client_main(int argc, char **argv, int flags)
TAILQ_FOREACH(cmd, &cmdlist->list, qentry) { TAILQ_FOREACH(cmd, &cmdlist->list, qentry) {
if (cmd->entry->flags & CMD_STARTSERVER) if (cmd->entry->flags & CMD_STARTSERVER)
cmdflags |= CMD_STARTSERVER; cmdflags |= CMD_STARTSERVER;
if (cmd->entry->flags & CMD_SENDENVIRON)
cmdflags |= CMD_SENDENVIRON;
if (cmd->entry->flags & CMD_CANTNEST) if (cmd->entry->flags & CMD_CANTNEST)
cmdflags |= CMD_CANTNEST; cmdflags |= CMD_CANTNEST;
} }
@ -258,8 +256,7 @@ client_main(int argc, char **argv, int flags)
set_signals(client_signal); set_signals(client_signal);
/* Send initial environment. */ /* Send initial environment. */
if (cmdflags & CMD_SENDENVIRON) client_send_environ();
client_send_environ();
client_send_identify(flags); client_send_identify(flags);
/* Send first command. */ /* Send first command. */

View File

@ -32,8 +32,7 @@ const struct cmd_entry cmd_attach_session_entry = {
"attach-session", "attach", "attach-session", "attach",
"drt:", 0, 0, "drt:", 0, 0,
"[-dr] " CMD_TARGET_SESSION_USAGE, "[-dr] " CMD_TARGET_SESSION_USAGE,
CMD_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON, CMD_CANTNEST|CMD_STARTSERVER,
NULL,
NULL, NULL,
cmd_attach_session_exec cmd_attach_session_exec
}; };

View File

@ -30,28 +30,19 @@
* Create a new session and attach to the current terminal unless -d is given. * Create a new session and attach to the current terminal unless -d is given.
*/ */
enum cmd_retval cmd_new_session_check(struct args *);
enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmd_q *); enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_new_session_entry = { const struct cmd_entry cmd_new_session_entry = {
"new-session", "new", "new-session", "new",
"AdDF:n:Ps:t:x:y:", 0, 1, "Ac:dDF:n:Ps:t:x:y:", 0, 1,
"[-AdDP] [-F format] [-n window-name] [-s session-name] " "[-AdDP] [-c start-directory] [-F format] [-n window-name] "
CMD_TARGET_SESSION_USAGE " [-x width] [-y height] [command]", "[-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] [-y height] "
CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON, "[command]",
CMD_STARTSERVER|CMD_CANTNEST,
NULL, NULL,
cmd_new_session_check,
cmd_new_session_exec cmd_new_session_exec
}; };
enum cmd_retval
cmd_new_session_check(struct args *args)
{
if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n')))
return (CMD_RETURN_ERROR);
return (CMD_RETURN_NORMAL);
}
enum cmd_retval enum cmd_retval
cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
@ -62,14 +53,19 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
struct environ env; struct environ env;
struct termios tio, *tiop; struct termios tio, *tiop;
struct passwd *pw; struct passwd *pw;
const char *newname, *target, *update, *cwd, *errstr; const char *newname, *target, *update, *base, *cwd;
const char *template; const char *errstr, *template;
char *cmd, *cause, *cp; char *cmd, *cause, *cp;
int detached, idx; int detached, idx;
u_int sx, sy; u_int sx, sy;
int already_attached; int already_attached;
struct format_tree *ft; struct format_tree *ft;
if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n'))) {
cmdq_error(cmdq, "command or window name given with target");
return (CMD_RETURN_ERROR);
}
newname = args_get(args, 's'); newname = args_get(args, 's');
if (newname != NULL) { if (newname != NULL) {
if (!session_check_name(newname)) { if (!session_check_name(newname)) {
@ -131,14 +127,19 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
/* Get the new session working directory. */ /* Get the new session working directory. */
if (c != NULL && c->cwd != NULL) if (c != NULL && c->cwd != NULL)
cwd = c->cwd; base = c->cwd;
else { else {
pw = getpwuid(getuid()); pw = getpwuid(getuid());
if (pw->pw_dir != NULL && *pw->pw_dir != '\0') if (pw->pw_dir != NULL && *pw->pw_dir != '\0')
cwd = pw->pw_dir; base = pw->pw_dir;
else else
cwd = "/"; base = "/";
} }
if (args_has(args, 'c'))
cwd = args_get(args, 'c');
else
cwd = options_get_string(&global_s_options, "default-path");
cwd = cmd_default_path(base, base, cwd);
/* Find new session size. */ /* Find new session size. */
if (c != NULL) { if (c != NULL) {

31
tmux.h
View File

@ -151,7 +151,7 @@ extern char **environ;
"[layout #{window_layout}] #{window_id}" \ "[layout #{window_layout}] #{window_id}" \
"#{?window_active, (active),}"; "#{?window_active, (active),}";
#define LIST_WINDOWS_WITH_SESSION_TEMPLATE \ #define LIST_WINDOWS_WITH_SESSION_TEMPLATE \
"#{session_name}: " \ "#{session_name}:" \
"#{window_index}: #{window_name}#{window_flags} " \ "#{window_index}: #{window_name}#{window_flags} " \
"(#{window_panes} panes) " \ "(#{window_panes} panes) " \
"[#{window_width}x#{window_height}] " "[#{window_width}x#{window_height}] "
@ -1008,6 +1008,7 @@ struct window {
#define WINDOW_REDRAW 0x4 #define WINDOW_REDRAW 0x4
#define WINDOW_SILENCE 0x8 #define WINDOW_SILENCE 0x8
#define WINDOW_ZOOMED 0x10 #define WINDOW_ZOOMED 0x10
#define WINDOW_ALERTFLAGS (WINDOW_BELL|WINDOW_ACTIVITY|WINDOW_SILENCE)
struct options options; struct options options;
@ -1449,12 +1450,10 @@ struct cmd_entry {
#define CMD_STARTSERVER 0x1 #define CMD_STARTSERVER 0x1
#define CMD_CANTNEST 0x2 #define CMD_CANTNEST 0x2
#define CMD_SENDENVIRON 0x4 #define CMD_READONLY 0x4
#define CMD_READONLY 0x8
int flags; int flags;
void (*key_binding)(struct cmd *, int); void (*key_binding)(struct cmd *, int);
int (*check)(struct args *);
enum cmd_retval (*exec)(struct cmd *, struct cmd_q *); enum cmd_retval (*exec)(struct cmd *, struct cmd_q *);
}; };
@ -1552,16 +1551,19 @@ int format_cmp(struct format_entry *, struct format_entry *);
RB_PROTOTYPE(format_tree, format_entry, entry, format_cmp); RB_PROTOTYPE(format_tree, format_entry, entry, format_cmp);
struct format_tree *format_create(void); struct format_tree *format_create(void);
void format_free(struct format_tree *); void format_free(struct format_tree *);
void printflike3 format_add( void printflike3 format_add(struct format_tree *, const char *, const char *,
struct format_tree *, const char *, const char *, ...); ...);
const char *format_find(struct format_tree *, const char *); const char *format_find(struct format_tree *, const char *);
char *format_expand(struct format_tree *, const char *); char *format_expand(struct format_tree *, const char *);
void format_session(struct format_tree *, struct session *); void format_session(struct format_tree *, struct session *);
void format_client(struct format_tree *, struct client *); void format_client(struct format_tree *, struct client *);
void format_winlink( void format_window(struct format_tree *, struct window *);
struct format_tree *, struct session *, struct winlink *); void format_winlink(struct format_tree *, struct session *,
void format_window_pane(struct format_tree *, struct window_pane *); struct winlink *);
void format_paste_buffer(struct format_tree *, struct paste_buffer *); void format_window_pane(struct format_tree *,
struct window_pane *);
void format_paste_buffer(struct format_tree *,
struct paste_buffer *);
/* mode-key.c */ /* mode-key.c */
extern const struct mode_key_table mode_key_tables[]; extern const struct mode_key_table mode_key_tables[];
@ -1767,7 +1769,7 @@ int cmd_find_index(struct cmd_q *, const char *,
struct winlink *cmd_find_pane(struct cmd_q *, const char *, struct session **, struct winlink *cmd_find_pane(struct cmd_q *, const char *, struct session **,
struct window_pane **); struct window_pane **);
char *cmd_template_replace(const char *, const char *, int); char *cmd_template_replace(const char *, const char *, int);
const char *cmd_get_default_path(struct cmd_q *, const char *); const char *cmd_default_path(const char *, const char *, const char *);
extern const struct cmd_entry *cmd_table[]; extern const struct cmd_entry *cmd_table[];
extern const struct cmd_entry cmd_attach_session_entry; extern const struct cmd_entry cmd_attach_session_entry;
extern const struct cmd_entry cmd_bind_key_entry; extern const struct cmd_entry cmd_bind_key_entry;
@ -1876,6 +1878,7 @@ void cmdq_run(struct cmd_q *, struct cmd_list *);
void cmdq_append(struct cmd_q *, struct cmd_list *); void cmdq_append(struct cmd_q *, struct cmd_list *);
int cmdq_continue(struct cmd_q *); int cmdq_continue(struct cmd_q *);
void cmdq_flush(struct cmd_q *); void cmdq_flush(struct cmd_q *);
const char *cmdq_default_path(struct cmd_q *, const char *);
/* cmd-string.c */ /* cmd-string.c */
int cmd_string_parse(const char *, struct cmd_list **, const char *, int cmd_string_parse(const char *, struct cmd_list **, const char *,
@ -2275,8 +2278,10 @@ void window_choose_collapse_all(struct window_pane *);
void window_choose_set_current(struct window_pane *, u_int); void window_choose_set_current(struct window_pane *, u_int);
/* names.c */ /* names.c */
void queue_window_name(struct window *); void queue_window_name(struct window *);
char *default_window_name(struct window *); char *default_window_name(struct window *);
char *format_window_name(struct window *);
char *parse_window_name(const char *);
/* signal.c */ /* signal.c */
void set_signals(void(*)(int, short, void *)); void set_signals(void(*)(int, short, void *));