summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client.c7
-rw-r--r--cmd-attach-session.c3
-rw-r--r--cmd-new-session.c39
-rw-r--r--tmux.h31
4 files changed, 41 insertions, 39 deletions
diff --git a/client.c b/client.c
index 0c8657eb..0101fc0b 100644
--- a/client.c
+++ b/client.c
@@ -179,7 +179,7 @@ client_main(int argc, char **argv, int flags)
cmdflags = CMD_STARTSERVER;
} else if (argc == 0) {
msg = MSG_COMMAND;
- cmdflags = CMD_STARTSERVER|CMD_SENDENVIRON|CMD_CANTNEST;
+ cmdflags = CMD_STARTSERVER|CMD_CANTNEST;
} else {
msg = MSG_COMMAND;
@@ -197,8 +197,6 @@ client_main(int argc, char **argv, int flags)
TAILQ_FOREACH(cmd, &cmdlist->list, qentry) {
if (cmd->entry->flags & CMD_STARTSERVER)
cmdflags |= CMD_STARTSERVER;
- if (cmd->entry->flags & CMD_SENDENVIRON)
- cmdflags |= CMD_SENDENVIRON;
if (cmd->entry->flags & CMD_CANTNEST)
cmdflags |= CMD_CANTNEST;
}
@@ -258,8 +256,7 @@ client_main(int argc, char **argv, int flags)
set_signals(client_signal);
/* Send initial environment. */
- if (cmdflags & CMD_SENDENVIRON)
- client_send_environ();
+ client_send_environ();
client_send_identify(flags);
/* Send first command. */
diff --git a/cmd-attach-session.c b/cmd-attach-session.c
index f5f2778d..70fea988 100644
--- a/cmd-attach-session.c
+++ b/cmd-attach-session.c
@@ -32,8 +32,7 @@ const struct cmd_entry cmd_attach_session_entry = {
"attach-session", "attach",
"drt:", 0, 0,
"[-dr] " CMD_TARGET_SESSION_USAGE,
- CMD_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON,
- NULL,
+ CMD_CANTNEST|CMD_STARTSERVER,
NULL,
cmd_attach_session_exec
};
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 653db876..7c6ede62 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -30,29 +30,20 @@
* 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 *);
const struct cmd_entry cmd_new_session_entry = {
"new-session", "new",
- "AdDF:n:Ps:t:x:y:", 0, 1,
- "[-AdDP] [-F format] [-n window-name] [-s session-name] "
- CMD_TARGET_SESSION_USAGE " [-x width] [-y height] [command]",
- CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON,
+ "Ac:dDF:n:Ps:t:x:y:", 0, 1,
+ "[-AdDP] [-c start-directory] [-F format] [-n window-name] "
+ "[-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] [-y height] "
+ "[command]",
+ CMD_STARTSERVER|CMD_CANTNEST,
NULL,
- cmd_new_session_check,
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
cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
{
struct args *args = self->args;
@@ -62,14 +53,19 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
struct environ env;
struct termios tio, *tiop;
struct passwd *pw;
- const char *newname, *target, *update, *cwd, *errstr;
- const char *template;
+ const char *newname, *target, *update, *base, *cwd;
+ const char *errstr, *template;
char *cmd, *cause, *cp;
int detached, idx;
u_int sx, sy;
int already_attached;
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');
if (newname != NULL) {
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. */
if (c != NULL && c->cwd != NULL)
- cwd = c->cwd;
+ base = c->cwd;
else {
pw = getpwuid(getuid());
if (pw->pw_dir != NULL && *pw->pw_dir != '\0')
- cwd = pw->pw_dir;
+ base = pw->pw_dir;
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. */
if (c != NULL) {
diff --git a/tmux.h b/tmux.h
index 21be2bd6..891f6233 100644
--- a/tmux.h
+++ b/tmux.h
@@ -151,7 +151,7 @@ extern char **environ;
"[layout #{window_layout}] #{window_id}" \
"#{?window_active, (active),}";
#define LIST_WINDOWS_WITH_SESSION_TEMPLATE \
- "#{session_name}: " \
+ "#{session_name}:" \
"#{window_index}: #{window_name}#{window_flags} " \
"(#{window_panes} panes) " \
"[#{window_width}x#{window_height}] "
@@ -1008,6 +1008,7 @@ struct window {
#define WINDOW_REDRAW 0x4
#define WINDOW_SILENCE 0x8
#define WINDOW_ZOOMED 0x10
+#define WINDOW_ALERTFLAGS (WINDOW_BELL|WINDOW_ACTIVITY|WINDOW_SILENCE)
struct options options;
@@ -1449,12 +1450,10 @@ struct cmd_entry {
#define CMD_STARTSERVER 0x1
#define CMD_CANTNEST 0x2
-#define CMD_SENDENVIRON 0x4
-#define CMD_READONLY 0x8
+#define CMD_READONLY 0x4
int flags;
void (*key_binding)(struct cmd *, int);
- int (*check)(struct args *);
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);
struct format_tree *format_create(void);
void format_free(struct format_tree *);
-void printflike3 format_add(
- struct format_tree *, const char *, const char *, ...);
+void printflike3 format_add(struct format_tree *, const char *, const char *,
+ ...);
const char *format_find(struct format_tree *, const char *);
char *format_expand(struct format_tree *, const char *);
void format_session(struct format_tree *, struct session *);
void format_client(struct format_tree *, struct client *);
-void format_winlink(
- struct format_tree *, struct session *, struct winlink *);
-void format_window_pane(struct format_tree *, struct window_pane *);
-void format_paste_buffer(struct format_tree *, struct paste_buffer *);
+void format_window(struct format_tree *, struct window *);
+void format_winlink(struct format_tree *, struct session *,
+ struct winlink *);
+void format_window_pane(struct format_tree *,
+ struct window_pane *);
+void format_paste_buffer(struct format_tree *,
+ struct paste_buffer *);
/* mode-key.c */
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 window_pane **);
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_attach_session_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 *);
int cmdq_continue(struct cmd_q *);
void cmdq_flush(struct cmd_q *);
+const char *cmdq_default_path(struct cmd_q *, const char *);
/* cmd-string.c */
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);
/* names.c */
-void queue_window_name(struct window *);
-char *default_window_name(struct window *);
+void queue_window_name(struct window *);
+char *default_window_name(struct window *);
+char *format_window_name(struct window *);
+char *parse_window_name(const char *);
/* signal.c */
void set_signals(void(*)(int, short, void *));