Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2013-05-31 21:44:42 +01:00
commit 399d7380a5
6 changed files with 240 additions and 214 deletions

View File

@ -23,6 +23,21 @@
#include "tmux.h" #include "tmux.h"
/*
* Manipulate command arguments.
*/
struct args_entry *args_find(struct args *, u_char);
RB_GENERATE(args_tree, args_entry, entry, args_cmp);
/* Arguments tree comparison function. */
int
args_cmp(struct args_entry *a1, struct args_entry *a2)
{
return (a1->flag - a2->flag);
}
/* Create an arguments set with no flags. */ /* Create an arguments set with no flags. */
struct args * struct args *
args_create(int argc, ...) args_create(int argc, ...)
@ -32,8 +47,6 @@ args_create(int argc, ...)
int i; int i;
args = xcalloc(1, sizeof *args); args = xcalloc(1, sizeof *args);
if ((args->flags = bit_alloc(SCHAR_MAX)) == NULL)
fatal("bit_alloc failed");
args->argc = argc; args->argc = argc;
if (argc == 0) if (argc == 0)
@ -49,6 +62,16 @@ args_create(int argc, ...)
return (args); return (args);
} }
/* Find a flag in the arguments tree. */
struct args_entry *
args_find(struct args *args, u_char ch)
{
struct args_entry entry;
entry.flag = ch;
return (RB_FIND(args_tree, &args->tree, &entry));
}
/* Parse an argv and argc into a new argument set. */ /* Parse an argv and argc into a new argument set. */
struct args * struct args *
args_parse(const char *template, int argc, char **argv) args_parse(const char *template, int argc, char **argv)
@ -58,26 +81,18 @@ args_parse(const char *template, int argc, char **argv)
int opt; int opt;
args = xcalloc(1, sizeof *args); args = xcalloc(1, sizeof *args);
if ((args->flags = bit_alloc(SCHAR_MAX)) == NULL)
fatal("bit_alloc failed");
optreset = 1; optreset = 1;
optind = 1; optind = 1;
while ((opt = getopt(argc, argv, template)) != -1) { while ((opt = getopt(argc, argv, template)) != -1) {
if (opt < 0 || opt >= SCHAR_MAX) if (opt < 0)
continue; continue;
if (opt == '?' || (ptr = strchr(template, opt)) == NULL) { if (opt == '?' || (ptr = strchr(template, opt)) == NULL) {
free(args->flags); args_free(args);
free(args);
return (NULL); return (NULL);
} }
args_set(args, opt, optarg);
bit_set(args->flags, opt);
if (ptr[1] == ':') {
free(args->values[opt]);
args->values[opt] = xstrdup(optarg);
}
} }
argc -= optind; argc -= optind;
argv += optind; argv += optind;
@ -92,14 +107,17 @@ args_parse(const char *template, int argc, char **argv)
void void
args_free(struct args *args) args_free(struct args *args)
{ {
u_int i; struct args_entry *entry;
struct args_entry *entry1;
cmd_free_argv(args->argc, args->argv); cmd_free_argv(args->argc, args->argv);
for (i = 0; i < SCHAR_MAX; i++) RB_FOREACH_SAFE(entry, args_tree, &args->tree, entry1) {
free(args->values[i]); RB_REMOVE(args_tree, &args->tree, entry);
free(entry->value);
free(entry);
}
free(args->flags);
free(args); free(args);
} }
@ -107,9 +125,10 @@ args_free(struct args *args)
size_t size_t
args_print(struct args *args, char *buf, size_t len) args_print(struct args *args, char *buf, size_t len)
{ {
size_t off; size_t off;
int i; int i;
const char *quotes; const char *quotes;
struct args_entry *entry;
/* There must be at least one byte at the start. */ /* There must be at least one byte at the start. */
if (len == 0) if (len == 0)
@ -118,23 +137,23 @@ args_print(struct args *args, char *buf, size_t len)
/* Process the flags first. */ /* Process the flags first. */
buf[off++] = '-'; buf[off++] = '-';
for (i = 0; i < SCHAR_MAX; i++) { RB_FOREACH(entry, args_tree, &args->tree) {
if (!bit_test(args->flags, i) || args->values[i] != NULL) if (entry->value != NULL)
continue; continue;
if (off == len - 1) { if (off == len - 1) {
buf[off] = '\0'; buf[off] = '\0';
return (len); return (len);
} }
buf[off++] = i; buf[off++] = entry->flag;
buf[off] = '\0'; buf[off] = '\0';
} }
if (off == 1) if (off == 1)
buf[--off] = '\0'; buf[--off] = '\0';
/* Then the flags with arguments. */ /* Then the flags with arguments. */
for (i = 0; i < SCHAR_MAX; i++) { RB_FOREACH(entry, args_tree, &args->tree) {
if (!bit_test(args->flags, i) || args->values[i] == NULL) if (entry->value == NULL)
continue; continue;
if (off >= len) { if (off >= len) {
@ -142,12 +161,13 @@ args_print(struct args *args, char *buf, size_t len)
return (len); return (len);
} }
if (strchr(args->values[i], ' ') != NULL) if (strchr(entry->value, ' ') != NULL)
quotes = "\""; quotes = "\"";
else else
quotes = ""; quotes = "";
off += xsnprintf(buf + off, len - off, "%s-%c %s%s%s", off += xsnprintf(buf + off, len - off, "%s-%c %s%s%s",
off != 0 ? " " : "", i, quotes, args->values[i], quotes); off != 0 ? " " : "", entry->flag, quotes, entry->value,
quotes);
} }
/* And finally the argument vector. */ /* And finally the argument vector. */
@ -172,42 +192,59 @@ args_print(struct args *args, char *buf, size_t len)
int int
args_has(struct args *args, u_char ch) args_has(struct args *args, u_char ch)
{ {
return (bit_test(args->flags, ch)); return (args_find(args, ch) == NULL ? 0 : 1);
} }
/* Set argument value. */ /* Set argument value in the arguments tree. */
void void
args_set(struct args *args, u_char ch, const char *value) args_set(struct args *args, u_char ch, const char *value)
{ {
free(args->values[ch]); struct args_entry *entry;
/* Replace existing argument. */
if ((entry = args_find(args, ch)) != NULL) {
free(entry->value);
if (value != NULL)
entry->value = xstrdup(value);
else
entry->value = NULL;
return;
}
entry = xcalloc(1, sizeof *entry);
entry->flag = ch;
if (value != NULL) if (value != NULL)
args->values[ch] = xstrdup(value); entry->value = xstrdup(value);
else
args->values[ch] = NULL; RB_INSERT(args_tree, &args->tree, entry);
bit_set(args->flags, ch);
} }
/* Get argument value. Will be NULL if it isn't present. */ /* Get argument value. Will be NULL if it isn't present. */
const char * const char *
args_get(struct args *args, u_char ch) args_get(struct args *args, u_char ch)
{ {
return (args->values[ch]); struct args_entry *entry;
if ((entry = args_find(args, ch)) == NULL)
return (NULL);
return (entry->value);
} }
/* Convert an argument value to a number. */ /* Convert an argument value to a number. */
long long long long
args_strtonum(struct args *args, args_strtonum(struct args *args, u_char ch, long long minval, long long maxval,
u_char ch, long long minval, long long maxval, char **cause) char **cause)
{ {
const char *errstr; const char *errstr;
long long ll; long long ll;
struct args_entry *entry;
if (!args_has(args, ch)) { if ((entry = args_find(args, ch)) == NULL) {
*cause = xstrdup("missing"); *cause = xstrdup("missing");
return (0); return (0);
} }
ll = strtonum(args->values[ch], minval, maxval, &errstr); ll = strtonum(entry->value, minval, maxval, &errstr);
if (errstr != NULL) { if (errstr != NULL) {
*cause = xstrdup(errstr); *cause = xstrdup(errstr);
return (0); return (0);

View File

@ -56,7 +56,7 @@ cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq)
struct window_pane *wp; struct window_pane *wp;
struct session *s; struct session *s;
struct input_ctx *ictx; struct input_ctx *ictx;
const char *str; const u_char *str;
int i, key; int i, key;
if (cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp) == NULL) if (cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp) == NULL)

View File

@ -46,8 +46,8 @@ format_cmp(struct format_entry *fe1, struct format_entry *fe2)
return (strcmp(fe1->key, fe2->key)); return (strcmp(fe1->key, fe2->key));
} }
/* Single-character aliases. */ /* Single-character uppercase aliases. */
const char *format_aliases[26] = { const char *format_upper[] = {
NULL, /* A */ NULL, /* A */
NULL, /* B */ NULL, /* B */
NULL, /* C */ NULL, /* C */
@ -76,18 +76,52 @@ const char *format_aliases[26] = {
NULL /* Z */ NULL /* Z */
}; };
/* Single-character lowercase aliases. */
const char *format_lower[] = {
NULL, /* a */
NULL, /* b */
NULL, /* c */
NULL, /* d */
NULL, /* e */
NULL, /* f */
NULL, /* g */
"host_short", /* h */
NULL, /* i */
NULL, /* j */
NULL, /* k */
NULL, /* l */
NULL, /* m */
NULL, /* n */
NULL, /* o */
NULL, /* p */
NULL, /* q */
NULL, /* r */
NULL, /* s */
NULL, /* t */
NULL, /* u */
NULL, /* v */
NULL, /* w */
NULL, /* x */
NULL, /* y */
NULL /* z */
};
/* Create a new tree. */ /* Create a new tree. */
struct format_tree * struct format_tree *
format_create(void) format_create(void)
{ {
struct format_tree *ft; struct format_tree *ft;
char host[MAXHOSTNAMELEN]; char host[MAXHOSTNAMELEN], *ptr;
ft = xmalloc(sizeof *ft); ft = xmalloc(sizeof *ft);
RB_INIT(ft); RB_INIT(ft);
if (gethostname(host, sizeof host) == 0) if (gethostname(host, sizeof host) == 0) {
format_add(ft, "host", "%s", host); format_add(ft, "host", "%s", host);
if ((ptr = strrchr(host, '.')) != NULL)
*ptr = '\0';
format_add(ft, "host_short", "%s", host);
}
return (ft); return (ft);
} }
@ -109,7 +143,7 @@ format_free(struct format_tree *ft)
free(fe); free(fe);
} }
free (ft); free(ft);
} }
/* Add a key-value pair. */ /* Add a key-value pair. */
@ -230,6 +264,7 @@ format_expand(struct format_tree *ft, const char *fmt)
fmt++; fmt++;
ch = (u_char) *fmt++; ch = (u_char) *fmt++;
switch (ch) { switch (ch) {
case '{': case '{':
ptr = strchr(fmt, '}'); ptr = strchr(fmt, '}');
@ -242,22 +277,23 @@ format_expand(struct format_tree *ft, const char *fmt)
fmt += n + 1; fmt += n + 1;
continue; continue;
default: default:
if (ch >= 'A' && ch <= 'Z') { s = NULL;
s = format_aliases[ch - 'A']; if (ch >= 'A' && ch <= 'Z')
if (s != NULL) { s = format_upper[ch - 'A'];
n = strlen(s); else if (ch >= 'a' && ch <= 'z')
if (format_replace ( s = format_lower[ch - 'a'];
ft, s, n, &buf, &len, &off) != 0) if (s == NULL) {
break; while (len - off < 3) {
continue; buf = xrealloc(buf, 2, len);
len *= 2;
} }
buf[off++] = '#';
buf[off++] = ch;
continue;
} }
while (len - off < 3) { n = strlen(s);
buf = xrealloc(buf, 2, len); if (format_replace(ft, s, n, &buf, &len, &off) != 0)
len *= 2; break;
}
buf[off++] = '#';
buf[off++] = ch;
continue; continue;
} }

View File

@ -38,8 +38,7 @@ void status_job_free(void *);
void status_job_callback(struct job *); void status_job_callback(struct job *);
char *status_print( char *status_print(
struct client *, struct winlink *, time_t, struct grid_cell *); struct client *, struct winlink *, time_t, struct grid_cell *);
void status_replace1(struct client *, struct session *, struct winlink *, void status_replace1(struct client *, char **, char **, char *, size_t, int);
struct window_pane *, char **, char **, char *, size_t, int);
void status_message_callback(int, short, void *); void status_message_callback(int, short, void *);
const char *status_prompt_up_history(u_int *); const char *status_prompt_up_history(u_int *);
@ -384,14 +383,12 @@ out:
/* Replace a single special sequence (prefixed by #). */ /* Replace a single special sequence (prefixed by #). */
void void
status_replace1(struct client *c, struct session *s, struct winlink *wl, status_replace1(struct client *c, char **iptr, char **optr, char *out,
struct window_pane *wp, char **iptr, char **optr, char *out,
size_t outsize, int jobsflag) size_t outsize, int jobsflag)
{ {
char ch, tmp[256], *ptr, *endptr, *freeptr; char ch, tmp[256], *ptr, *endptr;
size_t ptrlen; size_t ptrlen;
long limit; long limit;
u_int idx;
errno = 0; errno = 0;
limit = strtol(*iptr, &endptr, 10); limit = strtol(*iptr, &endptr, 10);
@ -403,8 +400,6 @@ status_replace1(struct client *c, struct session *s, struct winlink *wl,
if (limit <= 0) if (limit <= 0)
limit = LONG_MAX; limit = LONG_MAX;
freeptr = NULL;
switch (*(*iptr)++) { switch (*(*iptr)++) {
case '(': case '(':
if (!jobsflag) { if (!jobsflag) {
@ -414,45 +409,6 @@ status_replace1(struct client *c, struct session *s, struct winlink *wl,
if ((ptr = status_find_job(c, iptr)) == NULL) if ((ptr = status_find_job(c, iptr)) == NULL)
return; return;
goto do_replace; goto do_replace;
case 'D':
xsnprintf(tmp, sizeof tmp, "%%%u", wp->id);
ptr = tmp;
goto do_replace;
case 'H':
if (gethostname(tmp, sizeof tmp) != 0)
fatal("gethostname failed");
ptr = tmp;
goto do_replace;
case 'h':
if (gethostname(tmp, sizeof tmp) != 0)
fatal("gethostname failed");
if ((ptr = strchr(tmp, '.')) != NULL)
*ptr = '\0';
ptr = tmp;
goto do_replace;
case 'I':
xsnprintf(tmp, sizeof tmp, "%d", wl->idx);
ptr = tmp;
goto do_replace;
case 'P':
if (window_pane_index(wp, &idx) != 0)
fatalx("index not found");
xsnprintf(tmp, sizeof tmp, "%u", idx);
ptr = tmp;
goto do_replace;
case 'S':
ptr = s->name;
goto do_replace;
case 'T':
ptr = wp->base.title;
goto do_replace;
case 'W':
ptr = wl->window->name;
goto do_replace;
case 'F':
ptr = window_printable_flags(s, wl);
freeptr = ptr;
goto do_replace;
case '[': case '[':
/* /*
* Embedded style, handled at display time. Leave present and * Embedded style, handled at display time. Leave present and
@ -466,6 +422,10 @@ status_replace1(struct client *c, struct session *s, struct winlink *wl,
case '#': case '#':
*(*optr)++ = '#'; *(*optr)++ = '#';
break; break;
default:
xsnprintf(tmp, sizeof tmp, "#%c", *(*iptr - 1));
ptr = tmp;
goto do_replace;
} }
return; return;
@ -476,14 +436,12 @@ do_replace:
ptrlen = limit; ptrlen = limit;
if (*optr + ptrlen >= out + outsize - 1) if (*optr + ptrlen >= out + outsize - 1)
goto out; return;
while (ptrlen > 0 && *ptr != '\0') { while (ptrlen > 0 && *ptr != '\0') {
*(*optr)++ = *ptr++; *(*optr)++ = *ptr++;
ptrlen--; ptrlen--;
} }
out:
free(freeptr);
return; return;
skip_to: skip_to:
@ -532,8 +490,7 @@ status_replace(struct client *c, struct session *s, struct winlink *wl,
*optr++ = ch; *optr++ = ch;
continue; continue;
} }
status_replace1( status_replace1(c, &iptr, &optr, out, sizeof out, jobsflag);
c, s, wl, wp, &iptr, &optr, out, sizeof out, jobsflag);
} }
*optr = '\0'; *optr = '\0';

179
tmux.1
View File

@ -2442,27 +2442,18 @@ environment variables are set and contain the string
.It Ic status-left Ar string .It Ic status-left Ar string
Display Display
.Ar string .Ar string
to the left of the status bar. (by default the session name) to the left of the status bar.
.Ar string .Ar string
will be passed through will be passed through
.Xr strftime 3 .Xr strftime 3
before being used. and formats (see
By default, the session name is shown. .Sx FORMATS Ns )
.Ar string will be expanded.
may contain any of the following special character sequences: It may also contain any of the following special character sequences:
.Bl -column "Character pair" "Replaced with" -offset indent .Bl -column "Character pair" "Replaced with" -offset indent
.It Sy "Character pair" Ta Sy "Replaced with" .It Sy "Character pair" Ta Sy "Replaced with"
.It Li "#(shell-command)" Ta "First line of the command's output" .It Li "#(shell-command)" Ta "First line of the command's output"
.It Li "#[attributes]" Ta "Colour or attribute change" .It Li "#[attributes]" Ta "Colour or attribute change"
.It Li "#H" Ta "Hostname of local host"
.It Li "#h" Ta "Hostname of local host without the domain name"
.It Li "#F" Ta "Current window flag"
.It Li "#I" Ta "Current window index"
.It Li "#D" Ta "Current pane unique identifier"
.It Li "#P" Ta "Current pane index"
.It Li "#S" Ta "Session name"
.It Li "#T" Ta "Current pane title"
.It Li "#W" Ta "Current window name"
.It Li "##" Ta "A literal" Ql # .It Li "##" Ta "A literal" Ql #
.El .El
.Pp .Pp
@ -3007,16 +2998,13 @@ flag with a
.Ar format .Ar format
argument. argument.
This is a string which controls the output format of the command. This is a string which controls the output format of the command.
Special character sequences are replaced as documented under the
.Ic status-left
option and an additional long form is accepted.
Replacement variables are enclosed in Replacement variables are enclosed in
.Ql #{ .Ql #{
and and
.Ql } , .Ql } ,
for example for example
.Ql #{session_name} .Ql #{session_name} .
is equivalent to Some variables also have an shorter alias such as
.Ql #S . .Ql #S .
Conditionals are also accepted by prefixing with Conditionals are also accepted by prefixing with
.Ql \&? .Ql \&?
@ -3032,82 +3020,83 @@ if the session is attached and the string
if it is unattached. if it is unattached.
.Pp .Pp
The following variables are available, where appropriate: The following variables are available, where appropriate:
.Bl -column "session_created_string" "Replaced with" -offset indent .Bl -column "XXXXXXXXXXXXXXXXXXX" "XXXXX"
.It Sy "Variable name" Ta Sy "Replaced with" .It Sy "Variable name" Ta Sy "Alias" Ta Sy "Replaced with"
.It Li "alternate_on" Ta "If pane is in alternate screen" .It Li "alternate_on" Ta "" Ta "If pane is in alternate screen"
.It Li "alternate_saved_x" Ta "Saved cursor X in alternate screen" .It Li "alternate_saved_x" Ta "" Ta "Saved cursor X in alternate screen"
.It Li "alternate_saved_y" Ta "Saved cursor Y in alternate screen" .It Li "alternate_saved_y" Ta "" Ta "Saved cursor Y in alternate screen"
.It Li "buffer_sample" Ta "First 50 characters from the specified buffer" .It Li "buffer_sample" Ta "" Ta "First 50 characters from buffer"
.It Li "buffer_size" Ta "Size of the specified buffer in bytes" .It Li "buffer_size" Ta "" Ta "Size of the specified buffer in bytes"
.It Li "client_activity" Ta "Integer time client last had activity" .It Li "client_activity" Ta "" Ta "Integer time client last had activity"
.It Li "client_activity_string" Ta "String time client last had activity" .It Li "client_activity_string" Ta "" Ta "String time client last had activity"
.It Li "client_created" Ta "Integer time client created" .It Li "client_created" Ta "" Ta "Integer time client created"
.It Li "client_created_string" Ta "String time client created" .It Li "client_created_string" Ta "" Ta "String time client created"
.It Li "client_cwd" Ta "Working directory of client" .It Li "client_cwd" Ta "" Ta "Working directory of client"
.It Li "client_height" Ta "Height of client" .It Li "client_height" Ta "" Ta "Height of client"
.It Li "client_last_session" Ta "Name of the client's last session" .It Li "client_last_session" Ta "" Ta "Name of the client's last session"
.It Li "client_prefix" Ta "1 if prefix key has been pressed" .It Li "client_prefix" Ta "" Ta "1 if prefix key has been pressed"
.It Li "client_readonly" Ta "1 if client is readonly" .It Li "client_readonly" Ta "" Ta "1 if client is readonly"
.It Li "client_session" Ta "Name of the client's session" .It Li "client_session" Ta "" Ta "Name of the client's session"
.It Li "client_termname" Ta "Terminal name of client" .It Li "client_termname" Ta "" Ta "Terminal name of client"
.It Li "client_tty" Ta "Pseudo terminal of client" .It Li "client_tty" Ta "" Ta "Pseudo terminal of client"
.It Li "client_utf8" Ta "1 if client supports utf8" .It Li "client_utf8" Ta "" Ta "1 if client supports utf8"
.It Li "client_width" Ta "Width of client" .It Li "client_width" Ta "" Ta "Width of client"
.It Li "cursor_flag" Ta "Pane cursor flag" .It Li "cursor_flag" Ta "" Ta "Pane cursor flag"
.It Li "cursor_x" Ta "Cursor X position in pane" .It Li "cursor_x" Ta "" Ta "Cursor X position in pane"
.It Li "cursor_y" Ta "Cursor Y position in pane" .It Li "cursor_y" Ta "" Ta "Cursor Y position in pane"
.It Li "history_bytes" Ta "Number of bytes in window history" .It Li "history_bytes" Ta "" Ta "Number of bytes in window history"
.It Li "history_limit" Ta "Maximum window history lines" .It Li "history_limit" Ta "" Ta "Maximum window history lines"
.It Li "history_size" Ta "Size of history in bytes" .It Li "history_size" Ta "" Ta "Size of history in bytes"
.It Li "host" Ta "Hostname of local host" .It Li "host" Ta "#H" Ta "Hostname of local host"
.It Li "insert_flag" Ta "Pane insert flag" .It Li "host_short" Ta "#h" Ta "Hostname of local host (no domain name)"
.It Li "keypad_cursor_flag" Ta "Pane keypad cursor flag" .It Li "insert_flag" Ta "" Ta "Pane insert flag"
.It Li "keypad_flag" Ta "Pane keypad flag" .It Li "keypad_cursor_flag" Ta "" Ta "Pane keypad cursor flag"
.It Li "line" Ta "Line number in the list" .It Li "keypad_flag" Ta "" Ta "Pane keypad flag"
.It Li "mouse_any_flag" Ta "Pane mouse any flag" .It Li "line" Ta "" Ta "Line number in the list"
.It Li "mouse_button_flag" Ta "Pane mouse button flag" .It Li "mouse_any_flag" Ta "" Ta "Pane mouse any flag"
.It Li "mouse_standard_flag" Ta "Pane mouse standard flag" .It Li "mouse_button_flag" Ta "" Ta "Pane mouse button flag"
.It Li "mouse_utf8_flag" Ta "Pane mouse UTF-8 flag" .It Li "mouse_standard_flag" Ta "" Ta "Pane mouse standard flag"
.It Li "pane_active" Ta "1 if active pane" .It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag"
.It Li "pane_current_command" Ta "Current command if available" .It Li "pane_active" Ta "" Ta "1 if active pane"
.It Li "pane_current_path" Ta "Current path if available" .It Li "pane_current_command" Ta "" Ta "Current command if available"
.It Li "pane_dead" Ta "1 if pane is dead" .It Li "pane_current_path" Ta "" Ta "Current path if available"
.It Li "pane_height" Ta "Height of pane" .It Li "pane_dead" Ta "" Ta "1 if pane is dead"
.It Li "pane_id" Ta "Unique pane ID" .It Li "pane_height" Ta "" Ta "Height of pane"
.It Li "pane_in_mode" Ta "If pane is in a mode" .It Li "pane_id" Ta "#D" Ta "Unique pane ID"
.It Li "pane_index" Ta "Index of pane" .It Li "pane_in_mode" Ta "" Ta "If pane is in a mode"
.It Li "pane_pid" Ta "PID of first process in pane" .It Li "pane_index" Ta "#P" Ta "Index of pane"
.It Li "pane_start_command" Ta "Command pane started with" .It Li "pane_pid" Ta "" Ta "PID of first process in pane"
.It Li "pane_start_path" Ta "Path pane started with" .It Li "pane_start_command" Ta "" Ta "Command pane started with"
.It Li "pane_tabs" Ta "Pane tab positions" .It Li "pane_start_path" Ta "" Ta "Path pane started with"
.It Li "pane_title" Ta "Title of pane" .It Li "pane_tabs" Ta "" Ta "Pane tab positions"
.It Li "pane_tty" Ta "Pseudo terminal of pane" .It Li "pane_title" Ta "#T" Ta "Title of pane"
.It Li "pane_width" Ta "Width of pane" .It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane"
.It Li "saved_cursor_x" Ta "Saved cursor X in pane" .It Li "pane_width" Ta "" Ta "Width of pane"
.It Li "saved_cursor_y" Ta "Saved cursor Y in pane" .It Li "saved_cursor_x" Ta "" Ta "Saved cursor X in pane"
.It Li "scroll_region_lower" Ta "Bottom of scroll region in pane" .It Li "saved_cursor_y" Ta "" Ta "Saved cursor Y in pane"
.It Li "scroll_region_upper" Ta "Top of scroll region in pane" .It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
.It Li "session_attached" Ta "1 if session attached" .It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
.It Li "session_created" Ta "Integer time session created" .It Li "session_attached" Ta "" Ta "1 if session attached"
.It Li "session_created_string" Ta "String time session created" .It Li "session_created" Ta "" Ta "Integer time session created"
.It Li "session_group" Ta "Number of session group" .It Li "session_created_string" Ta "" Ta "String time session created"
.It Li "session_grouped" Ta "1 if session in a group" .It Li "session_group" Ta "" Ta "Number of session group"
.It Li "session_height" Ta "Height of session" .It Li "session_grouped" Ta "" Ta "1 if session in a group"
.It Li "session_id" Ta "Unique session ID" .It Li "session_height" Ta "" Ta "Height of session"
.It Li "session_name" Ta "Name of session" .It Li "session_id" Ta "" Ta "Unique session ID"
.It Li "session_width" Ta "Width of session" .It Li "session_name" Ta "#S" Ta "Name of session"
.It Li "session_windows" Ta "Number of windows in session" .It Li "session_width" Ta "" Ta "Width of session"
.It Li "window_active" Ta "1 if window active" .It Li "session_windows" Ta "" Ta "Number of windows in session"
.It Li "window_find_matches" Ta "Matched data from the find-window command if available" .It Li "window_active" Ta "" Ta "1 if window active"
.It Li "window_flags" Ta "Window flags" .It Li "window_find_matches" Ta "" Ta "Matched data from the find-window"
.It Li "window_height" Ta "Height of window" .It Li "window_flags" Ta "#F" Ta "Window flags"
.It Li "window_id" Ta "Unique window ID" .It Li "window_height" Ta "" Ta "Height of window"
.It Li "window_index" Ta "Index of window" .It Li "window_id" Ta "" Ta "Unique window ID"
.It Li "window_layout" Ta "Window layout description" .It Li "window_index" Ta "#I" Ta "Index of window"
.It Li "window_name" Ta "Name of window" .It Li "window_layout" Ta "" Ta "Window layout description"
.It Li "window_panes" Ta "Number of panes in window" .It Li "window_name" Ta "#W" Ta "Name of window"
.It Li "window_width" Ta "Width of window" .It Li "window_panes" Ta "" Ta "Number of panes in window"
.It Li "wrap_flag" Ta "Pane wrap flag" .It Li "window_width" Ta "" Ta "Width of window"
.It Li "wrap_flag" Ta "" Ta "Pane wrap flag"
.El .El
.Sh NAMES AND TITLES .Sh NAMES AND TITLES
.Nm .Nm

19
tmux.h
View File

@ -1357,13 +1357,18 @@ struct client {
}; };
ARRAY_DECL(clients, struct client *); ARRAY_DECL(clients, struct client *);
/* Parsed arguments. */ /* Parsed arguments structures. */
struct args { struct args_entry {
bitstr_t *flags; u_char flag;
char *values[SCHAR_MAX]; /* XXX This is awfully big. */ char *value;
RB_ENTRY(args_entry) entry;
};
RB_HEAD(args_tree, args_entry);
int argc; struct args {
char **argv; struct args_tree tree;
int argc;
char **argv;
}; };
/* Command and list of commands. */ /* Command and list of commands. */
@ -1720,6 +1725,8 @@ extern const char clock_table[14][5][5];
void clock_draw(struct screen_write_ctx *, int, int); void clock_draw(struct screen_write_ctx *, int, int);
/* arguments.c */ /* arguments.c */
int args_cmp(struct args_entry *, struct args_entry *);
RB_PROTOTYPE(args_tree, args_entry, entry, args_cmp);
struct args *args_create(int, ...); struct args *args_create(int, ...);
struct args *args_parse(const char *, int, char **); struct args *args_parse(const char *, int, char **);
void args_free(struct args *); void args_free(struct args *);