mirror of
https://github.com/tmux/tmux.git
synced 2024-11-05 10:28:48 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
a3bce7a322
@ -93,6 +93,24 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag,
|
||||
session_set_current(s, wl);
|
||||
}
|
||||
|
||||
if (cflag != NULL) {
|
||||
ft = format_create();
|
||||
format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s,
|
||||
NULL, NULL);
|
||||
cp = format_expand(ft, cflag);
|
||||
format_free(ft);
|
||||
|
||||
fd = open(cp, O_RDONLY|O_DIRECTORY);
|
||||
free(cp);
|
||||
if (fd == -1) {
|
||||
cmdq_error(cmdq, "bad working directory: %s",
|
||||
strerror(errno));
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
close(s->cwd);
|
||||
s->cwd = fd;
|
||||
}
|
||||
|
||||
if (c->session != NULL) {
|
||||
if (dflag) {
|
||||
/*
|
||||
@ -108,24 +126,6 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag,
|
||||
}
|
||||
}
|
||||
|
||||
if (cflag != NULL) {
|
||||
ft = format_create();
|
||||
format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s,
|
||||
NULL, NULL);
|
||||
cp = format_expand(ft, cflag);
|
||||
format_free(ft);
|
||||
|
||||
fd = open(cp, O_RDONLY|O_DIRECTORY);
|
||||
free(cp);
|
||||
if (fd == -1) {
|
||||
cmdq_error(cmdq, "bad working directory: %s",
|
||||
strerror(errno));
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
close(s->cwd);
|
||||
s->cwd = fd;
|
||||
}
|
||||
|
||||
if (!Eflag) {
|
||||
update = options_get_string(&s->options,
|
||||
"update-environment");
|
||||
@ -146,24 +146,6 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag,
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
|
||||
if (cflag != NULL) {
|
||||
ft = format_create();
|
||||
format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s,
|
||||
NULL, NULL);
|
||||
cp = format_expand(ft, cflag);
|
||||
format_free(ft);
|
||||
|
||||
fd = open(cp, O_RDONLY|O_DIRECTORY);
|
||||
free(cp);
|
||||
if (fd == -1) {
|
||||
cmdq_error(cmdq, "bad working directory: %s",
|
||||
strerror(errno));
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
close(s->cwd);
|
||||
s->cwd = fd;
|
||||
}
|
||||
|
||||
if (rflag)
|
||||
c->flags |= CLIENT_READONLY;
|
||||
|
||||
|
@ -143,7 +143,7 @@ cmd_if_shell_callback(struct job *job)
|
||||
struct cmd_list *cmdlist;
|
||||
char *cause, *cmd;
|
||||
|
||||
if (cmdq->dead)
|
||||
if (cmdq->flags & CMD_Q_DEAD)
|
||||
return;
|
||||
|
||||
if (!WIFEXITED(job->status) || WEXITSTATUS(job->status) != 0)
|
||||
|
@ -41,16 +41,16 @@ enum cmd_retval
|
||||
cmd_kill_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct session *s, *s2, *s3;
|
||||
struct session *s, *sloop, *stmp;
|
||||
|
||||
if ((s = cmd_find_session(cmdq, args_get(args, 't'), 0)) == NULL)
|
||||
return (CMD_RETURN_ERROR);
|
||||
|
||||
if (args_has(args, 'a')) {
|
||||
RB_FOREACH_SAFE(s2, sessions, &sessions, s3) {
|
||||
if (s != s2) {
|
||||
server_destroy_session(s2);
|
||||
session_destroy(s2);
|
||||
RB_FOREACH_SAFE(sloop, sessions, &sessions, stmp) {
|
||||
if (sloop != s) {
|
||||
server_destroy_session(sloop);
|
||||
session_destroy(sloop);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
@ -30,10 +29,10 @@
|
||||
enum cmd_retval cmd_list_panes_exec(struct cmd *, struct cmd_q *);
|
||||
|
||||
void cmd_list_panes_server(struct cmd *, struct cmd_q *);
|
||||
void cmd_list_panes_session(
|
||||
struct cmd *, struct session *, struct cmd_q *, int);
|
||||
void cmd_list_panes_window(struct cmd *,
|
||||
struct session *, struct winlink *, struct cmd_q *, int);
|
||||
void cmd_list_panes_session(struct cmd *, struct session *, struct cmd_q *,
|
||||
int);
|
||||
void cmd_list_panes_window(struct cmd *, struct session *, struct winlink *,
|
||||
struct cmd_q *, int);
|
||||
|
||||
const struct cmd_entry cmd_list_panes_entry = {
|
||||
"list-panes", "lsp",
|
||||
@ -77,8 +76,8 @@ cmd_list_panes_server(struct cmd *self, struct cmd_q *cmdq)
|
||||
}
|
||||
|
||||
void
|
||||
cmd_list_panes_session(
|
||||
struct cmd *self, struct session *s, struct cmd_q *cmdq, int type)
|
||||
cmd_list_panes_session(struct cmd *self, struct session *s, struct cmd_q *cmdq,
|
||||
int type)
|
||||
{
|
||||
struct winlink *wl;
|
||||
|
||||
@ -87,8 +86,8 @@ cmd_list_panes_session(
|
||||
}
|
||||
|
||||
void
|
||||
cmd_list_panes_window(struct cmd *self,
|
||||
struct session *s, struct winlink *wl, struct cmd_q *cmdq, int type)
|
||||
cmd_list_panes_window(struct cmd *self, struct session *s, struct winlink *wl,
|
||||
struct cmd_q *cmdq, int type)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct window_pane *wp;
|
||||
@ -115,9 +114,9 @@ cmd_list_panes_window(struct cmd *self,
|
||||
"#{?pane_active, (active),}#{?pane_dead, (dead),}";
|
||||
break;
|
||||
case 2:
|
||||
template = "#{session_name}:#{window_index}.#{pane_index}: "
|
||||
"[#{pane_width}x#{pane_height}] [history "
|
||||
"#{history_size}/#{history_limit}, "
|
||||
template = "#{session_name}:#{window_index}."
|
||||
"#{pane_index}: [#{pane_width}x#{pane_height}] "
|
||||
"[history #{history_size}/#{history_limit}, "
|
||||
"#{history_bytes} bytes] #{pane_id}"
|
||||
"#{?pane_active, (active),}#{?pane_dead, (dead),}";
|
||||
break;
|
||||
|
13
cmd-queue.c
13
cmd-queue.c
@ -35,7 +35,7 @@ cmdq_new(struct client *c)
|
||||
|
||||
cmdq = xcalloc(1, sizeof *cmdq);
|
||||
cmdq->references = 1;
|
||||
cmdq->dead = 0;
|
||||
cmdq->flags = 0;
|
||||
|
||||
cmdq->client = c;
|
||||
cmdq->client_exit = -1;
|
||||
@ -51,8 +51,11 @@ cmdq_new(struct client *c)
|
||||
int
|
||||
cmdq_free(struct cmd_q *cmdq)
|
||||
{
|
||||
if (--cmdq->references != 0)
|
||||
return (cmdq->dead);
|
||||
if (--cmdq->references != 0) {
|
||||
if (cmdq->flags & CMD_Q_DEAD)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
cmdq_flush(cmdq);
|
||||
free(cmdq);
|
||||
@ -192,6 +195,7 @@ cmdq_continue_one(struct cmd_q *cmdq)
|
||||
int
|
||||
cmdq_continue(struct cmd_q *cmdq)
|
||||
{
|
||||
struct client *c = cmdq->client;
|
||||
struct cmd_q_item *next;
|
||||
enum cmd_retval retval;
|
||||
int empty;
|
||||
@ -199,6 +203,9 @@ cmdq_continue(struct cmd_q *cmdq)
|
||||
cmdq->references++;
|
||||
notify_disable();
|
||||
|
||||
log_debug("continuing cmdq %p: flags=%#x, client=%d", cmdq, cmdq->flags,
|
||||
c != NULL ? c->ibuf.fd : -1);
|
||||
|
||||
empty = TAILQ_EMPTY(&cmdq->queue);
|
||||
if (empty)
|
||||
goto empty;
|
||||
|
@ -131,7 +131,7 @@ cmd_run_shell_callback(struct job *job)
|
||||
int retcode;
|
||||
u_int lines;
|
||||
|
||||
if (cmdq->dead)
|
||||
if (cmdq->flags & CMD_Q_DEAD)
|
||||
return;
|
||||
cmd = cdata->cmd;
|
||||
|
||||
|
@ -213,7 +213,7 @@ server_client_lost(struct client *c)
|
||||
free(c->prompt_string);
|
||||
free(c->prompt_buffer);
|
||||
|
||||
c->cmdq->dead = 1;
|
||||
c->cmdq->flags |= CMD_Q_DEAD;
|
||||
cmdq_free(c->cmdq);
|
||||
c->cmdq = NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user