[BACK]Return to tmux.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Annotation of src/usr.bin/tmux/tmux.h, Revision 1.36

1.36    ! nicm        1: /* $OpenBSD: tmux.h,v 1.35 2009/07/17 15:03:11 nicm Exp $ */
1.1       nicm        2:
                      3: /*
                      4:  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
                      5:  *
                      6:  * Permission to use, copy, modify, and distribute this software for any
                      7:  * purpose with or without fee is hereby granted, provided that the above
                      8:  * copyright notice and this permission notice appear in all copies.
                      9:  *
                     10:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     11:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     12:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     13:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     14:  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
                     15:  * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
                     16:  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     17:  */
                     18:
                     19: #ifndef TMUX_H
                     20: #define TMUX_H
                     21:
1.36    ! nicm       22: #define PROTOCOL_VERSION -14
1.1       nicm       23:
                     24: #include <sys/param.h>
                     25: #include <sys/time.h>
                     26: #include <sys/queue.h>
                     27: #include <sys/tree.h>
                     28:
1.6       nicm       29: #include <bitstring.h>
1.1       nicm       30: #include <getopt.h>
                     31: #include <limits.h>
                     32: #include <poll.h>
                     33: #include <signal.h>
                     34: #include <stdarg.h>
                     35: #include <stdint.h>
                     36: #include <stdio.h>
                     37: #include <termios.h>
                     38:
                     39: #include "array.h"
                     40:
                     41: extern const char    *__progname;
                     42:
1.22      nicm       43: /* Default configuration files. */
1.1       nicm       44: #define DEFAULT_CFG ".tmux.conf"
1.22      nicm       45: #define SYSTEM_CFG "/etc/tmux.conf"
1.1       nicm       46:
                     47: /* Default prompt history length. */
                     48: #define PROMPT_HISTORY 100
                     49:
                     50: /* Minimum pane size. */
1.28      nicm       51: #define PANE_MINIMUM 5 /* includes separator line */
1.1       nicm       52:
                     53: /* Automatic name refresh interval, in milliseconds. */
                     54: #define NAME_INTERVAL 500
                     55:
                     56: /* Escape timer period, in milliseconds. */
                     57: #define ESCAPE_PERIOD 250
                     58:
                     59: /* Maximum poll timeout (when attached). */
                     60: #define POLL_TIMEOUT 50
                     61:
                     62: /* Fatal errors. */
                     63: #define fatal(msg) log_fatal("%s: %s", __func__, msg);
                     64: #define fatalx(msg) log_fatalx("%s: %s", __func__, msg);
                     65:
                     66: /* Definition to shut gcc up about unused arguments. */
                     67: #define unused __attribute__ ((unused))
                     68:
                     69: /* Attribute to make gcc check printf-like arguments. */
                     70: #define printflike1 __attribute__ ((format (printf, 1, 2)))
                     71: #define printflike2 __attribute__ ((format (printf, 2, 3)))
                     72: #define printflike3 __attribute__ ((format (printf, 3, 4)))
                     73: #define printflike4 __attribute__ ((format (printf, 4, 5)))
1.4       nicm       74: #define printflike5 __attribute__ ((format (printf, 5, 6)))
1.1       nicm       75:
                     76: /* Number of items in array. */
1.14      nicm       77: #ifndef nitems
1.1       nicm       78: #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
1.14      nicm       79: #endif
1.1       nicm       80:
                     81: /* Buffer macros. */
                     82: #define BUFFER_USED(b) ((b)->size)
                     83: #define BUFFER_FREE(b) ((b)->space - (b)->off - (b)->size)
                     84: #define BUFFER_IN(b) ((b)->base + (b)->off + (b)->size)
                     85: #define BUFFER_OUT(b) ((b)->base + (b)->off)
                     86:
                     87: /* Buffer structure. */
                     88: struct buffer {
                     89:        u_char  *base;          /* buffer start */
                     90:        size_t   space;         /* total size of buffer */
                     91:
                     92:        size_t   size;          /* size of data in buffer */
                     93:        size_t   off;           /* offset of data in buffer */
                     94: };
                     95:
                     96: /* Bell option values. */
                     97: #define BELL_NONE 0
                     98: #define BELL_ANY 1
                     99: #define BELL_CURRENT 2
                    100:
                    101: /* Key codes. ncurses defines KEY_*. Grrr. */
                    102: #define KEYC_NONE    0x00ffff
                    103: #define KEYC_OFFSET  0x010000
                    104: #define KEYC_ESCAPE  0x020000
                    105: #define KEYC_CONTROL 0x080000
                    106: #define KEYC_SHIFT   0x100000
                    107:
                    108: #define KEYC_ADDESC(k) ((k) | KEYC_ESCAPE)
                    109: #define KEYC_REMOVEESC(k) ((k) & ~KEYC_ESCAPE)
                    110: #define KEYC_ISESC(k) ((k) != KEYC_NONE && ((k) & KEYC_ESCAPE))
                    111:
                    112: #define KEYC_ADDCTL(k) ((k) | KEYC_CONTROL)
                    113: #define KEYC_REMOVECTL(k) ((k) & ~KEYC_CONTROL)
                    114: #define KEYC_ISCTL(k) ((k) != KEYC_NONE && ((k) & KEYC_CONTROL))
                    115:
                    116: #define KEYC_ADDSFT(k) ((k) | KEYC_SHIFT)
                    117: #define KEYC_REMOVESFT(k) ((k) & ~KEYC_SHIFT)
                    118: #define KEYC_ISSFT(k) ((k) != KEYC_NONE && ((k) & KEYC_SHIFT))
                    119:
                    120: /* Mouse key. */
                    121: #define KEYC_MOUSE (KEYC_OFFSET + 0x00)
                    122:
                    123: /* Function keys. */
                    124: #define KEYC_F1 (KEYC_OFFSET + 0x01)
                    125: #define KEYC_F2 (KEYC_OFFSET + 0x02)
                    126: #define KEYC_F3 (KEYC_OFFSET + 0x03)
                    127: #define KEYC_F4 (KEYC_OFFSET + 0x04)
                    128: #define KEYC_F5 (KEYC_OFFSET + 0x05)
                    129: #define KEYC_F6 (KEYC_OFFSET + 0x06)
                    130: #define KEYC_F7 (KEYC_OFFSET + 0x07)
                    131: #define KEYC_F8 (KEYC_OFFSET + 0x08)
                    132: #define KEYC_F9 (KEYC_OFFSET + 0x09)
                    133: #define KEYC_F10 (KEYC_OFFSET + 0x10)
                    134: #define KEYC_F11 (KEYC_OFFSET + 0x11)
                    135: #define KEYC_F12 (KEYC_OFFSET + 0x12)
                    136: #define KEYC_F13 (KEYC_OFFSET + 0x13)
                    137: #define KEYC_F14 (KEYC_OFFSET + 0x14)
                    138: #define KEYC_F15 (KEYC_OFFSET + 0x15)
                    139: #define KEYC_F16 (KEYC_OFFSET + 0x16)
                    140: #define KEYC_F17 (KEYC_OFFSET + 0x17)
                    141: #define KEYC_F18 (KEYC_OFFSET + 0x18)
                    142: #define KEYC_F19 (KEYC_OFFSET + 0x19)
                    143: #define KEYC_F20 (KEYC_OFFSET + 0x1a)
                    144: #define KEYC_IC (KEYC_OFFSET + 0x1b)
                    145: #define KEYC_DC (KEYC_OFFSET + 0x1c)
                    146: #define KEYC_HOME (KEYC_OFFSET + 0x1d)
                    147: #define KEYC_END (KEYC_OFFSET + 0x1e)
                    148: #define KEYC_NPAGE (KEYC_OFFSET + 0x1f)
                    149: #define KEYC_PPAGE (KEYC_OFFSET + 0x20)
                    150: #define KEYC_BTAB (KEYC_OFFSET + 0x21)
                    151:
                    152: /* Arrow keys. */
                    153: #define KEYC_UP (KEYC_OFFSET + 0x50)
                    154: #define KEYC_DOWN (KEYC_OFFSET + 0x51)
                    155: #define KEYC_LEFT (KEYC_OFFSET + 0x52)
                    156: #define KEYC_RIGHT (KEYC_OFFSET + 0x53)
                    157:
                    158: /* Numeric keypad. Numbered from top-left, KPY_X. */
                    159: #define KEYC_KP0_1 (KEYC_OFFSET + 0x100)
                    160: #define KEYC_KP0_2 (KEYC_OFFSET + 0x101)
                    161: #define KEYC_KP0_3 (KEYC_OFFSET + 0x102)
                    162: #define KEYC_KP1_0 (KEYC_OFFSET + 0x103)
                    163: #define KEYC_KP1_1 (KEYC_OFFSET + 0x104)
                    164: #define KEYC_KP1_2 (KEYC_OFFSET + 0x105)
                    165: #define KEYC_KP1_3 (KEYC_OFFSET + 0x106)
                    166: #define KEYC_KP2_0 (KEYC_OFFSET + 0x107)
                    167: #define KEYC_KP2_1 (KEYC_OFFSET + 0x108)
                    168: #define KEYC_KP2_2 (KEYC_OFFSET + 0x109)
                    169: #define KEYC_KP3_0 (KEYC_OFFSET + 0x10a)
                    170: #define KEYC_KP3_1 (KEYC_OFFSET + 0x10b)
                    171: #define KEYC_KP3_2 (KEYC_OFFSET + 0x10c)
                    172: #define KEYC_KP3_3 (KEYC_OFFSET + 0x10d)
                    173: #define KEYC_KP4_0 (KEYC_OFFSET + 0x10e)
                    174: #define KEYC_KP4_2 (KEYC_OFFSET + 0x10f)
                    175:
                    176: /* Termcap codes. */
                    177: enum tty_code_code {
                    178:        TTYC_AX = 0,
                    179:        TTYC_ACSC,      /* acs_chars, ac */
                    180:        TTYC_BEL,       /* bell, bl */
                    181:        TTYC_BLINK,     /* enter_blink_mode, mb */
                    182:        TTYC_BOLD,      /* enter_bold_mode, md */
                    183:        TTYC_CIVIS,     /* cursor_invisible, vi */
                    184:        TTYC_CLEAR,     /* clear_screen, cl */
                    185:        TTYC_CNORM,     /* cursor_normal, ve */
                    186:        TTYC_COLORS,    /* max_colors, Co */
                    187:        TTYC_CSR,       /* change_scroll_region, cs */
                    188:        TTYC_CUD,       /* parm_down_cursor, DO */
                    189:        TTYC_CUD1,      /* cursor_down, do */
                    190:        TTYC_CUP,       /* cursor_address, cm */
                    191:        TTYC_DCH,       /* parm_dch, DC */
                    192:        TTYC_DCH1,      /* delete_character, dc */
                    193:        TTYC_DIM,       /* enter_dim_mode, mh */
                    194:        TTYC_DL,        /* parm_delete_line, DL */
                    195:        TTYC_DL1,       /* delete_line, dl */
                    196:        TTYC_EL,        /* clr_eol, ce */
                    197:        TTYC_EL1,       /* clr_bol, cb */
                    198:        TTYC_ENACS,     /* ena_acs, eA */
                    199:        TTYC_ICH,       /* parm_ich, IC */
                    200:        TTYC_ICH1,      /* insert_character, ic */
                    201:        TTYC_IL,        /* parm_insert_line, IL */
                    202:        TTYC_IL1,       /* insert_line, il */
                    203:        TTYC_INVIS,     /* enter_secure_mode, mk */
                    204:        TTYC_IS1,       /* init_1string, i1 */
                    205:        TTYC_IS2,       /* init_2string, i2 */
                    206:        TTYC_IS3,       /* init_3string, i3 */
                    207:        TTYC_KCBT,      /* key_btab, kB */
                    208:        TTYC_KCUB1,     /* key_left, kl */
                    209:        TTYC_KCUD1,     /* key_down, kd */
                    210:        TTYC_KCUF1,     /* key_right, kr */
                    211:        TTYC_KCUU1,     /* key_up, ku */
                    212:        TTYC_KDCH1,     /* key_dc, kD */
                    213:        TTYC_KEND,      /* key_end, ke */
                    214:        TTYC_KF1,       /* key_f1, k1 */
                    215:        TTYC_KF10,      /* key_f10, k; */
                    216:        TTYC_KF11,      /* key_f11, F1 */
                    217:        TTYC_KF12,      /* key_f12, F2 */
                    218:        TTYC_KF13,      /* key_f13, F3 */
                    219:        TTYC_KF14,      /* key_f14, F4 */
                    220:        TTYC_KF15,      /* key_f15, F5 */
                    221:        TTYC_KF16,      /* key_f16, F6 */
                    222:        TTYC_KF17,      /* key_f17, F7 */
                    223:        TTYC_KF18,      /* key_f18, F8 */
                    224:        TTYC_KF19,      /* key_f19, F9 */
                    225:        TTYC_KF20,      /* key_f20, F10 */
                    226:        TTYC_KF2,       /* key_f2, k2 */
                    227:        TTYC_KF3,       /* key_f3, k3 */
                    228:        TTYC_KF4,       /* key_f4, k4 */
                    229:        TTYC_KF5,       /* key_f5, k5 */
                    230:        TTYC_KF6,       /* key_f6, k6 */
                    231:        TTYC_KF7,       /* key_f7, k7 */
                    232:        TTYC_KF8,       /* key_f8, k8 */
                    233:        TTYC_KF9,       /* key_f9, k9 */
                    234:        TTYC_KHOME,     /* key_home, kh */
                    235:        TTYC_KICH1,     /* key_ic, kI */
                    236:        TTYC_KMOUS,     /* key_mouse, Km */
                    237:        TTYC_KNP,       /* key_npage, kN */
                    238:        TTYC_KPP,       /* key_ppage, kP */
                    239:        TTYC_OP,        /* orig_pair, op */
                    240:        TTYC_REV,       /* enter_reverse_mode, mr */
                    241:        TTYC_RI,        /* scroll_reverse, sr */
                    242:        TTYC_RMACS,     /* exit_alt_charset_mode */
                    243:        TTYC_RMCUP,     /* exit_ca_mode, te */
                    244:        TTYC_RMIR,      /* exit_insert_mode, ei */
                    245:        TTYC_RMKX,      /* keypad_local, ke */
                    246:        TTYC_SETAB,     /* set_a_background, AB */
                    247:        TTYC_SETAF,     /* set_a_foreground, AF */
                    248:        TTYC_SGR0,      /* exit_attribute_mode, me */
                    249:        TTYC_SMACS,     /* enter_alt_charset_mode, as */
                    250:        TTYC_SMCUP,     /* enter_ca_mode, ti */
                    251:        TTYC_SMIR,      /* enter_insert_mode, im */
                    252:        TTYC_SMKX,      /* keypad_xmit, ks */
                    253:        TTYC_SMSO,      /* enter_standout_mode, so */
                    254:        TTYC_SMUL,      /* enter_underline_mode, us */
                    255:        TTYC_XENL,      /* eat_newline_glitch, xn */
                    256: };
                    257: #define NTTYCODE (TTYC_XENL + 1)
                    258:
                    259: /* Termcap types. */
                    260: enum tty_code_type {
                    261:        TTYCODE_NONE = 0,
                    262:        TTYCODE_STRING,
                    263:        TTYCODE_NUMBER,
                    264:        TTYCODE_FLAG,
                    265: };
                    266:
                    267: /* Termcap code. */
                    268: struct tty_code {
                    269:        enum tty_code_type      type;
                    270:        union {
                    271:                char           *string;
                    272:                int             number;
                    273:                int             flag;
                    274:        } value;
                    275: };
                    276:
                    277: /* Entry in terminal code table. */
                    278: struct tty_term_code_entry {
                    279:        enum tty_code_code      code;
                    280:        enum tty_code_type      type;
                    281:        const char             *name;
                    282: };
                    283:
                    284: /* Output commands. */
                    285: enum tty_cmd {
1.5       nicm      286:        TTY_ALIGNMENTTEST,
1.1       nicm      287:        TTY_CELL,
                    288:        TTY_CLEARENDOFLINE,
                    289:        TTY_CLEARENDOFSCREEN,
                    290:        TTY_CLEARLINE,
                    291:        TTY_CLEARSCREEN,
                    292:        TTY_CLEARSTARTOFLINE,
                    293:        TTY_CLEARSTARTOFSCREEN,
                    294:        TTY_DELETECHARACTER,
                    295:        TTY_DELETELINE,
                    296:        TTY_INSERTCHARACTER,
                    297:        TTY_INSERTLINE,
                    298:        TTY_LINEFEED,
                    299:        TTY_RAW,
                    300:        TTY_REVERSEINDEX,
                    301: };
                    302:
                    303: /* Message codes. */
                    304: enum hdrtype {
                    305:        MSG_COMMAND,
                    306:        MSG_DETACH,
                    307:        MSG_ERROR,
                    308:        MSG_EXIT,
                    309:        MSG_EXITED,
                    310:        MSG_EXITING,
                    311:        MSG_IDENTIFY,
                    312:        MSG_PRINT,
                    313:        MSG_READY,
                    314:        MSG_RESIZE,
                    315:        MSG_SHUTDOWN,
                    316:        MSG_SUSPEND,
                    317:        MSG_UNLOCK,
                    318:        MSG_WAKEUP,
                    319: };
                    320:
                    321: /* Message header structure. */
                    322: struct hdr {
                    323:        enum hdrtype    type;
                    324:        size_t          size;
                    325: };
                    326:
                    327: struct msg_command_data {
                    328:        pid_t           pid;                    /* pid from $TMUX or -1 */
                    329:        u_int           idx;                    /* index from $TMUX */
                    330:
                    331:        size_t          namelen;
                    332: };
                    333:
                    334: struct msg_identify_data {
                    335:        char            tty[TTY_NAME_MAX];
                    336:        int             version;
                    337:
                    338:        char            cwd[MAXPATHLEN];
                    339:
                    340: #define IDENTIFY_UTF8 0x1
                    341: #define IDENTIFY_256COLOURS 0x2
                    342: #define IDENTIFY_88COLOURS 0x4
                    343: #define IDENTIFY_HASDEFAULTS 0x8
                    344:        int             flags;
                    345:
                    346:        u_int           sx;
                    347:        u_int           sy;
                    348:
                    349:        size_t          termlen;
                    350: };
                    351:
                    352: struct msg_resize_data {
                    353:        u_int           sx;
                    354:        u_int           sy;
                    355: };
                    356:
                    357: /* Editing keys. */
                    358: enum mode_key_cmd {
                    359:        MODEKEYCMD_BACKSPACE = 0x1000,
1.23      nicm      360:        MODEKEYCMD_BACKTOINDENTATION,
1.1       nicm      361:        MODEKEYCMD_CHOOSE,
                    362:        MODEKEYCMD_CLEARSELECTION,
                    363:        MODEKEYCMD_COMPLETE,
                    364:        MODEKEYCMD_COPYSELECTION,
                    365:        MODEKEYCMD_DELETE,
                    366:        MODEKEYCMD_DOWN,
                    367:        MODEKEYCMD_ENDOFLINE,
                    368:        MODEKEYCMD_LEFT,
                    369:        MODEKEYCMD_NEXTPAGE,
                    370:        MODEKEYCMD_NEXTWORD,
                    371:        MODEKEYCMD_NONE,
                    372:        MODEKEYCMD_OTHERKEY,
                    373:        MODEKEYCMD_PASTE,
                    374:        MODEKEYCMD_PREVIOUSPAGE,
                    375:        MODEKEYCMD_PREVIOUSWORD,
                    376:        MODEKEYCMD_QUIT,
                    377:        MODEKEYCMD_RIGHT,
                    378:        MODEKEYCMD_STARTOFLINE,
                    379:        MODEKEYCMD_STARTSELECTION,
                    380:        MODEKEYCMD_UP,
                    381: };
                    382:
                    383: struct mode_key_data {
                    384:        int                      type;
                    385:
                    386:        int                      flags;
                    387: #define MODEKEY_EDITMODE 0x1
                    388: #define MODEKEY_CANEDIT 0x2
                    389: #define MODEKEY_CHOOSEMODE 0x4
                    390: };
                    391:
                    392: #define MODEKEY_EMACS 0
                    393: #define MODEKEY_VI 1
                    394:
                    395: /* Modes. */
                    396: #define MODE_CURSOR 0x1
                    397: #define MODE_INSERT 0x2
                    398: #define MODE_KCURSOR 0x4
                    399: #define MODE_KKEYPAD 0x8
                    400: #define MODE_MOUSE 0x10
                    401:
                    402: /* Grid output. */
                    403: #if defined(DEBUG) && \
                    404:     ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
                    405:      (defined(__GNUC__) && __GNUC__ >= 3))
                    406: #define GRID_DEBUG(gd, fmt, ...) log_debug3("%s: (sx=%u, sy=%u, hsize=%u) " \
                    407:     fmt, __func__, (gd)->sx, (gd)->sy, (gd)->hsize, ## __VA_ARGS__)
                    408: #else
                    409: #define GRID_DEBUG(...)
                    410: #endif
                    411:
                    412: /* Grid attributes. */
                    413: #define GRID_ATTR_BRIGHT 0x1
                    414: #define GRID_ATTR_DIM 0x2
                    415: #define GRID_ATTR_UNDERSCORE 0x4
                    416: #define GRID_ATTR_BLINK 0x8
                    417: #define GRID_ATTR_REVERSE 0x10
                    418: #define GRID_ATTR_HIDDEN 0x20
                    419: #define GRID_ATTR_ITALICS 0x40
                    420: #define GRID_ATTR_CHARSET 0x80 /* alternative character set */
                    421:
                    422: /* Grid flags. */
                    423: #define GRID_FLAG_FG256 0x1
                    424: #define GRID_FLAG_BG256 0x2
                    425: #define GRID_FLAG_PADDING 0x4
                    426: #define GRID_FLAG_UTF8 0x8
                    427:
                    428: /* Grid cell data. */
                    429: struct grid_cell {
                    430:        u_char  attr;
                    431:        u_char  flags;
                    432:        u_char  fg;
                    433:        u_char  bg;
                    434:        u_char  data;
                    435: } __packed;
                    436:
                    437: /* Grid cell UTF-8 data. Used instead of data in grid_cell for UTF-8 cells. */
                    438: #define UTF8_SIZE 8
                    439: struct grid_utf8 {
                    440:        u_char  width;
                    441:        u_char  data[UTF8_SIZE];
                    442: } __packed;
                    443:
                    444: /* Entire grid of cells. */
                    445: struct grid {
1.25      nicm      446:        int     flags;
                    447: #define GRID_HISTORY 0x1       /* scroll lines into history */
                    448:
1.1       nicm      449:        u_int   sx;
                    450:        u_int   sy;
                    451:
                    452:        u_int   hsize;
                    453:        u_int   hlimit;
                    454:
                    455:        u_int  *size;
                    456:        struct grid_cell **data;
                    457:
                    458:        u_int  *usize;
                    459:        struct grid_utf8 **udata;
                    460: };
                    461:
                    462: /* Option data structures. */
                    463: struct options_entry {
                    464:        char            *name;
                    465:
                    466:        enum {
                    467:                OPTIONS_STRING,
                    468:                OPTIONS_NUMBER,
                    469:                OPTIONS_KEY,
                    470:        } type;
                    471:        union {
                    472:                char    *string;
                    473:                long long number;
                    474:                int      key;
                    475:        } value;
                    476:
                    477:        SPLAY_ENTRY(options_entry) entry;
                    478: };
                    479:
                    480: struct options {
                    481:        SPLAY_HEAD(options_tree, options_entry) tree;
                    482:        struct options  *parent;
                    483: };
                    484:
                    485: /* Screen selection. */
                    486: struct screen_sel {
                    487:        int              flag;
                    488:
                    489:        u_int            sx;
                    490:        u_int            sy;
                    491:
                    492:        u_int            ex;
                    493:        u_int            ey;
                    494:
                    495:        struct grid_cell cell;
                    496: };
                    497:
                    498: /* Virtual screen. */
                    499: struct screen {
                    500:        char            *title;
                    501:
                    502:        struct grid     *grid;          /* grid data */
                    503:
                    504:        u_int            cx;            /* cursor x */
                    505:        u_int            cy;            /* cursor y */
                    506:
                    507:        u_int            old_cx;
                    508:        u_int            old_cy;
                    509:
                    510:        u_int            rupper;        /* scroll region top */
                    511:        u_int            rlower;        /* scroll region bottom */
                    512:
                    513:        u_int            old_rupper;
                    514:        u_int            old_rlower;
                    515:
                    516:        int              mode;
                    517:
1.6       nicm      518:        bitstr_t        *tabs;
                    519:
1.1       nicm      520:        struct screen_sel sel;
                    521: };
                    522:
                    523: /* Screen write context. */
                    524: struct screen_write_ctx {
                    525:        struct window_pane *wp;
                    526:        struct screen   *s;
                    527: };
                    528:
                    529: /* Screen size. */
                    530: #define screen_size_x(s) ((s)->grid->sx)
                    531: #define screen_size_y(s) ((s)->grid->sy)
                    532: #define screen_hsize(s) ((s)->grid->hsize)
                    533: #define screen_hlimit(s) ((s)->grid->hlimit)
                    534:
                    535: /* Input parser sequence argument. */
                    536: struct input_arg {
                    537:        u_char           data[64];
                    538:        size_t           used;
                    539: };
                    540:
                    541: /* Input parser context. */
                    542: struct input_ctx {
                    543:        struct window_pane *wp;
                    544:        struct screen_write_ctx ctx;
                    545:
                    546:        u_char          *buf;
                    547:        size_t           len;
                    548:        size_t           off;
                    549:
                    550:        struct grid_cell cell;
                    551:
                    552:
                    553:        struct grid_cell saved_cell;
                    554:        u_int            saved_cx;
                    555:        u_int            saved_cy;
                    556:
                    557: #define MAXSTRINGLEN   1024
                    558:        u_char          *string_buf;
                    559:        size_t           string_len;
                    560:        int              string_type;
                    561: #define STRING_SYSTEM 0
                    562: #define STRING_APPLICATION 1
                    563: #define STRING_NAME 2
                    564:
                    565:        u_char           utf8_buf[4];
                    566:        u_int            utf8_len;
                    567:        u_int            utf8_off;
                    568:
                    569:        u_char           intermediate;
                    570:        void            *(*state)(u_char, struct input_ctx *);
                    571:
                    572:        u_char           private;
                    573:        ARRAY_DECL(, struct input_arg) args;
                    574: };
                    575:
                    576: /*
                    577:  * Window mode. Windows can be in several modes and this is used to call the
                    578:  * right function to handle input and output.
                    579:  */
                    580: struct client;
                    581: struct window;
                    582: struct window_mode {
                    583:        struct screen *(*init)(struct window_pane *);
                    584:        void    (*free)(struct window_pane *);
                    585:        void    (*resize)(struct window_pane *, u_int, u_int);
                    586:        void    (*key)(struct window_pane *, struct client *, int);
                    587:        void    (*mouse)(struct window_pane *,
                    588:                    struct client *, u_char, u_char, u_char);
                    589:        void    (*timer)(struct window_pane *);
                    590: };
                    591:
                    592: /* Child window structure. */
                    593: struct window_pane {
                    594:        struct window   *window;
                    595:
                    596:        u_int            sx;
                    597:        u_int            sy;
                    598:
                    599:        u_int            xoff;
                    600:        u_int            yoff;
                    601:
                    602:        int              flags;
1.28      nicm      603: #define PANE_REDRAW 0x1
1.1       nicm      604:
                    605:        char            *cmd;
                    606:        char            *cwd;
                    607:
                    608:        pid_t            pid;
                    609:        int              fd;
                    610:        char             tty[TTY_NAME_MAX];
                    611:        struct buffer   *in;
                    612:        struct buffer   *out;
                    613:
                    614:        struct input_ctx ictx;
                    615:
                    616:        struct screen   *screen;
                    617:        struct screen    base;
                    618:
1.25      nicm      619:        /* Saved in alternative screen mode. */
                    620:        u_int            saved_cx;
                    621:        u_int            saved_cy;
                    622:        struct grid     *saved_grid;
                    623:
1.1       nicm      624:        const struct window_mode *mode;
                    625:        void            *modedata;
                    626:
                    627:        TAILQ_ENTRY(window_pane) entry;
                    628: };
                    629: TAILQ_HEAD(window_panes, window_pane);
                    630:
                    631: /* Window structure. */
                    632: struct window {
                    633:        char            *name;
                    634:        struct timeval   name_timer;
                    635:
                    636:        struct window_pane *active;
                    637:        struct window_panes panes;
                    638:        u_int            layout;
                    639:
                    640:        u_int            sx;
                    641:        u_int            sy;
                    642:
                    643:        int              flags;
                    644: #define WINDOW_BELL 0x1
                    645: #define WINDOW_HIDDEN 0x2
                    646: #define WINDOW_ACTIVITY 0x4
                    647: #define WINDOW_CONTENT 0x6
                    648: #define WINDOW_REDRAW 0x8
                    649:
                    650:        struct options   options;
                    651:
                    652:        u_int            references;
                    653: };
                    654: ARRAY_DECL(windows, struct window *);
                    655:
                    656: /* Entry on local window list. */
                    657: struct winlink {
                    658:        int              idx;
                    659:        struct window   *window;
                    660:
                    661:        RB_ENTRY(winlink) entry;
                    662:        SLIST_ENTRY(winlink) sentry;
                    663: };
                    664: RB_HEAD(winlinks, winlink);
                    665: SLIST_HEAD(winlink_stack, winlink);
                    666:
                    667: /* Paste buffer. */
                    668: struct paste_buffer {
                    669:        char            *data;
                    670:        struct timeval   tv;
                    671: };
                    672: ARRAY_DECL(paste_stack, struct paste_buffer *);
                    673:
                    674: /* Client session. */
                    675: struct session_alert {
                    676:        struct winlink  *wl;
                    677:        int              type;
                    678:
                    679:        SLIST_ENTRY(session_alert) entry;
                    680: };
                    681:
                    682: struct session {
                    683:        char            *name;
                    684:        struct timeval   tv;
                    685:
                    686:        u_int            sx;
                    687:        u_int            sy;
                    688:
                    689:        struct winlink  *curw;
                    690:        struct winlink_stack lastw;
                    691:        struct winlinks  windows;
                    692:
                    693:        struct options   options;
                    694:
                    695:        struct paste_stack buffers;
                    696:
                    697:        SLIST_HEAD(, session_alert) alerts;
                    698:
                    699: #define SESSION_UNATTACHED 0x1 /* not attached to any clients */
                    700:        int              flags;
                    701: };
                    702: ARRAY_DECL(sessions, struct session *);
                    703:
                    704: /* TTY information. */
                    705: struct tty_key {
                    706:        int              key;
                    707:        char            *string;
                    708:
                    709:        int              flags;
                    710: #define TTYKEY_CTRL 0x1
                    711: #define TTYKEY_RAW 0x2
                    712:
                    713:        RB_ENTRY(tty_key) entry;
                    714: };
                    715:
                    716: struct tty_term {
                    717:        char            *name;
                    718:        u_int            references;
                    719:
                    720:        struct tty_code  codes[NTTYCODE];
                    721:
                    722: #define TERM_HASDEFAULTS 0x1
                    723: #define TERM_256COLOURS 0x2
                    724: #define TERM_88COLOURS 0x4
                    725: #define TERM_EARLYWRAP 0x8
                    726:        int              flags;
                    727:
                    728:        SLIST_ENTRY(tty_term) entry;
                    729: };
                    730: SLIST_HEAD(tty_terms, tty_term);
                    731:
                    732: struct tty {
                    733:        char            *path;
                    734:
                    735:         u_int            sx;
                    736:         u_int            sy;
                    737:
                    738:        u_int            cx;
                    739:        u_int            cy;
                    740:
                    741:        int              mode;
                    742:
                    743:        u_int            rlower;
                    744:        u_int            rupper;
                    745:
                    746:        char            *termname;
                    747:        struct tty_term *term;
                    748:
                    749:        int              fd;
                    750:        struct buffer   *in;
                    751:        struct buffer   *out;
                    752:
                    753:        int              log_fd;
                    754:
                    755:        struct termios   tio;
                    756:
                    757:        struct grid_cell cell;
                    758:
                    759:        u_char           acs[UCHAR_MAX + 1];
                    760:
                    761: #define TTY_NOCURSOR 0x1
                    762: #define TTY_FREEZE 0x2
                    763: #define TTY_ESCAPE 0x4
                    764: #define TTY_UTF8 0x8
                    765:        int              flags;
                    766:
                    767:        int              term_flags;
                    768:
                    769:        struct timeval   key_timer;
                    770:
                    771:        size_t           ksize; /* maximum key size */
                    772:        RB_HEAD(tty_keys, tty_key) ktree;
                    773: };
                    774:
                    775: /* Client connection. */
                    776: struct client {
                    777:        int              fd;
                    778:        struct buffer   *in;
                    779:        struct buffer   *out;
                    780:
                    781:        char            *title;
                    782:        char            *cwd;
                    783:
                    784:        struct tty       tty;
                    785:        struct timeval   status_timer;
                    786:        struct timeval   repeat_timer;
                    787:
                    788:        struct screen    status;
                    789:
                    790: #define CLIENT_TERMINAL 0x1
                    791: #define CLIENT_PREFIX 0x2
                    792: #define CLIENT_MOUSE 0x4
                    793: #define CLIENT_REDRAW 0x8
                    794: #define CLIENT_STATUS 0x10
                    795: #define CLIENT_REPEAT 0x20     /* allow command to repeat within repeat time */
                    796: #define CLIENT_SUSPENDED 0x40
                    797:        int              flags;
                    798:
                    799:        char            *message_string;
                    800:        struct timeval   message_timer;
                    801:
                    802:        char            *prompt_string;
                    803:        char            *prompt_buffer;
                    804:        size_t           prompt_index;
1.33      nicm      805:        int              (*prompt_callbackfn)(void *, const char *);
                    806:        void             (*prompt_freefn)(void *);
1.1       nicm      807:        void            *prompt_data;
                    808:
                    809: #define PROMPT_HIDDEN 0x1
                    810: #define PROMPT_SINGLE 0x2
                    811:        int              prompt_flags;
                    812:
                    813:        u_int            prompt_hindex;
                    814:        ARRAY_DECL(, char *) prompt_hdata;
                    815:
                    816:        struct mode_key_data prompt_mdata;
                    817:
                    818:        struct session  *session;
                    819: };
                    820: ARRAY_DECL(clients, struct client *);
                    821:
                    822: /* Client context. */
                    823: struct client_ctx {
                    824:        int              srv_fd;
                    825:        struct buffer   *srv_in;
                    826:        struct buffer   *srv_out;
                    827:
                    828: #define CCTX_DETACH 0x1
                    829: #define CCTX_EXIT 0x2
                    830: #define CCTX_SHUTDOWN 0x4
                    831:        int              flags;
                    832: };
                    833:
                    834: /* Key/command line command. */
                    835: struct cmd_ctx {
                    836:        struct client  *cmdclient;
                    837:
1.35      nicm      838:        /*
                    839:         * curclient is the client where this command was executed if inside
                    840:         * tmux. This is NULL if the command came from the command-line.
                    841:         *
                    842:         * cmdclient is the client which sent the MSG_COMMAND to the server, if
                    843:         * any. This is NULL unless the command came from the command-line.
                    844:         *
                    845:         * One of curclient or cmdclient is always NULL and the other not.
                    846:         */
1.1       nicm      847:        struct client  *curclient;
                    848:        struct session *cursession;
1.35      nicm      849:
1.1       nicm      850:        struct msg_command_data *msgdata;
                    851:
                    852:        void            (*print)(struct cmd_ctx *, const char *, ...);
                    853:        void            (*info)(struct cmd_ctx *, const char *, ...);
                    854:        void            (*error)(struct cmd_ctx *, const char *, ...);
                    855: };
                    856:
                    857: struct cmd {
                    858:        const struct cmd_entry *entry;
                    859:        void            *data;
                    860:
                    861:        TAILQ_ENTRY(cmd) qentry;
                    862: };
                    863: TAILQ_HEAD(cmd_list, cmd);
                    864:
                    865: struct cmd_entry {
                    866:        const char      *name;
                    867:        const char      *alias;
                    868:        const char      *usage;
                    869:
                    870: #define CMD_STARTSERVER 0x1
                    871: #define CMD_CANTNEST 0x2
                    872: #define CMD_ARG1 0x4
                    873: #define CMD_ARG01 0x8
1.27      nicm      874:        int              flags;
1.1       nicm      875:
1.27      nicm      876: #define CMD_CHFLAG(flag) \
                    877:        ((flag) >= 'a' && (flag) <= 'z' ? 1ULL << ((flag) - 'a') :      \
                    878:        (flag) >= 'A' && (flag) <= 'Z' ? 1ULL << (26 + (flag) - 'A') : 0)
                    879:        uint64_t         chflags;
1.1       nicm      880:
                    881:        void             (*init)(struct cmd *, int);
                    882:        int              (*parse)(struct cmd *, int, char **, char **);
                    883:        int              (*exec)(struct cmd *, struct cmd_ctx *);
                    884:        void             (*send)(struct cmd *, struct buffer *);
                    885:        void             (*recv)(struct cmd *, struct buffer *);
                    886:        void             (*free)(struct cmd *);
                    887:        size_t           (*print)(struct cmd *, char *, size_t);
                    888: };
                    889:
                    890: /* Generic command data. */
                    891: struct cmd_target_data {
1.27      nicm      892:        uint64_t chflags;
1.1       nicm      893:        char    *target;
                    894:        char    *arg;
                    895: };
                    896:
                    897: struct cmd_srcdst_data {
1.27      nicm      898:        uint64_t chflags;
1.1       nicm      899:        char    *src;
                    900:        char    *dst;
                    901:        char    *arg;
                    902: };
                    903:
                    904: struct cmd_buffer_data {
1.27      nicm      905:        uint64_t chflags;
1.1       nicm      906:        char    *target;
                    907:        int      buffer;
                    908:        char    *arg;
                    909: };
                    910:
                    911: struct cmd_option_data {
1.27      nicm      912:        uint64_t chflags;
1.1       nicm      913:        char    *target;
                    914:        char    *option;
                    915:        char    *value;
                    916: };
                    917:
                    918: struct cmd_pane_data {
1.27      nicm      919:        uint64_t chflags;
1.1       nicm      920:        char    *target;
                    921:        char    *arg;
                    922:        int      pane;
                    923: };
                    924:
                    925: /* Key binding. */
                    926: struct key_binding {
                    927:        int              key;
                    928:        struct cmd_list *cmdlist;
                    929:        int              can_repeat;
                    930:
                    931:        SPLAY_ENTRY(key_binding) entry;
                    932: };
                    933: SPLAY_HEAD(key_bindings, key_binding);
                    934:
                    935: /* Set/display option data. */
                    936: struct set_option_entry {
                    937:        const char      *name;
                    938:        enum {
                    939:                SET_OPTION_STRING,
                    940:                SET_OPTION_NUMBER,
                    941:                SET_OPTION_KEY,
                    942:                SET_OPTION_COLOUR,
                    943:                SET_OPTION_ATTRIBUTES,
                    944:                SET_OPTION_FLAG,
                    945:                SET_OPTION_CHOICE
                    946:        } type;
                    947:
                    948:        u_int            minimum;
                    949:        u_int            maximum;
                    950:
                    951:        const char     **choices;
                    952: };
                    953: extern const struct set_option_entry set_option_table[];
                    954: extern const struct set_option_entry set_window_option_table[];
                    955:
                    956: /* tmux.c */
                    957: extern volatile sig_atomic_t sigwinch;
                    958: extern volatile sig_atomic_t sigterm;
                    959: extern volatile sig_atomic_t sigcont;
                    960: extern volatile sig_atomic_t sigchld;
                    961: extern volatile sig_atomic_t sigusr1;
                    962: extern volatile sig_atomic_t sigusr2;
1.16      nicm      963: extern struct options global_s_options;
                    964: extern struct options global_w_options;
1.1       nicm      965: extern char    *cfg_file;
                    966: extern int      server_locked;
                    967: extern char    *server_password;
                    968: extern time_t   server_activity;
                    969: extern int      debug_level;
                    970: extern int      be_quiet;
                    971: extern time_t   start_time;
                    972: extern char    *socket_path;
                    973: void            logfile(const char *);
                    974: void            siginit(void);
                    975: void            sigreset(void);
                    976: void            sighandler(int);
                    977:
                    978: /* cfg.c */
                    979: int             load_cfg(const char *, char **x);
                    980:
                    981: /* mode-key.c */
                    982: void            mode_key_init(struct mode_key_data *, int, int);
                    983: void            mode_key_free(struct mode_key_data *);
                    984: enum mode_key_cmd mode_key_lookup(struct mode_key_data *, int);
                    985:
                    986: /* options.c */
                    987: int    options_cmp(struct options_entry *, struct options_entry *);
                    988: SPLAY_PROTOTYPE(options_tree, options_entry, entry, options_cmp);
                    989: void   options_init(struct options *, struct options *);
                    990: void   options_free(struct options *);
                    991: struct options_entry *options_find1(struct options *, const char *);
                    992: struct options_entry *options_find(struct options *, const char *);
                    993: int    options_remove(struct options *, const char *);
                    994: void printflike3 options_set_string(
                    995:            struct options *, const char *, const char *, ...);
                    996: char   *options_get_string(struct options *, const char *);
                    997: void   options_set_number(struct options *, const char *, long long);
                    998: long long options_get_number(struct options *, const char *);
                    999:
                   1000: /* tty.c */
                   1001: u_char          tty_get_acs(struct tty *, u_char);
                   1002: void            tty_emulate_repeat(struct tty *,
                   1003:                     enum tty_code_code, enum tty_code_code, u_int);
                   1004: void            tty_reset(struct tty *);
                   1005: void            tty_region(struct tty *, u_int, u_int, u_int);
                   1006: void            tty_cursor(struct tty *, u_int, u_int, u_int, u_int);
                   1007: void            tty_cell(struct tty *,
                   1008:                     const struct grid_cell *, const struct grid_utf8 *);
                   1009: void            tty_putcode(struct tty *, enum tty_code_code);
                   1010: void            tty_putcode1(struct tty *, enum tty_code_code, int);
                   1011: void            tty_putcode2(struct tty *, enum tty_code_code, int, int);
                   1012: void            tty_puts(struct tty *, const char *);
                   1013: void            tty_putc(struct tty *, u_char);
1.8       nicm     1014: void            tty_pututf8(struct tty *, const struct grid_utf8 *);
1.1       nicm     1015: void            tty_init(struct tty *, char *, char *);
                   1016: void            tty_start_tty(struct tty *);
                   1017: void            tty_stop_tty(struct tty *);
                   1018: void            tty_detect_utf8(struct tty *);
                   1019: void            tty_set_title(struct tty *, const char *);
                   1020: void            tty_update_mode(struct tty *, int);
                   1021: void            tty_draw_line(
                   1022:                     struct tty *, struct screen *, u_int, u_int, u_int);
                   1023: void            tty_redraw_region(struct tty *, struct window_pane *);
                   1024: int             tty_open(struct tty *, char **);
                   1025: void            tty_close(struct tty *, int);
                   1026: void            tty_free(struct tty *, int);
                   1027: void            tty_vwrite(
                   1028:                     struct tty *, struct window_pane *, enum tty_cmd, va_list);
                   1029:
                   1030: /* tty-term.c */
                   1031: extern struct tty_terms tty_terms;
                   1032: extern struct tty_term_code_entry tty_term_codes[NTTYCODE];
                   1033: struct tty_term *tty_term_find(char *, int, char **);
                   1034: void            tty_term_free(struct tty_term *);
                   1035: int             tty_term_has(struct tty_term *, enum tty_code_code);
                   1036: const char     *tty_term_string(struct tty_term *, enum tty_code_code);
                   1037: const char     *tty_term_string1(struct tty_term *, enum tty_code_code, int);
                   1038: const char     *tty_term_string2(
                   1039:                     struct tty_term *, enum tty_code_code, int, int);
                   1040: int             tty_term_number(struct tty_term *, enum tty_code_code);
                   1041: int             tty_term_flag(struct tty_term *, enum tty_code_code);
                   1042:
                   1043: /* tty-keys.c */
                   1044: int             tty_keys_cmp(struct tty_key *, struct tty_key *);
                   1045: RB_PROTOTYPE(tty_keys, tty_key, entry, tty_keys_cmp);
                   1046: void            tty_keys_init(struct tty *);
                   1047: void            tty_keys_free(struct tty *);
                   1048: int             tty_keys_next(struct tty *, int *, u_char *);
                   1049:
                   1050: /* tty-write.c */
                   1051: void            tty_write_cmd(struct window_pane *, enum tty_cmd, ...);
                   1052:
                   1053: /* options-cmd.c */
                   1054: void   set_option_string(struct cmd_ctx *,
                   1055:            struct options *, const struct set_option_entry *, char *);
                   1056: void   set_option_number(struct cmd_ctx *,
                   1057:            struct options *, const struct set_option_entry *, char *);
                   1058: void   set_option_key(struct cmd_ctx *,
                   1059:            struct options *, const struct set_option_entry *, char *);
                   1060: void   set_option_colour(struct cmd_ctx *,
                   1061:            struct options *, const struct set_option_entry *, char *);
                   1062: void   set_option_attributes(struct cmd_ctx *,
                   1063:            struct options *, const struct set_option_entry *, char *);
                   1064: void   set_option_flag(struct cmd_ctx *,
                   1065:            struct options *, const struct set_option_entry *, char *);
                   1066: void   set_option_choice(struct cmd_ctx *,
                   1067:            struct options *, const struct set_option_entry *, char *);
                   1068:
                   1069: /* paste.c */
                   1070: void            paste_init_stack(struct paste_stack *);
                   1071: void            paste_free_stack(struct paste_stack *);
                   1072: struct paste_buffer *paste_walk_stack(struct paste_stack *, uint *);
                   1073: struct paste_buffer *paste_get_top(struct paste_stack *);
                   1074: struct paste_buffer *paste_get_index(struct paste_stack *, u_int);
                   1075: int             paste_free_top(struct paste_stack *);
                   1076: int             paste_free_index(struct paste_stack *, u_int);
                   1077: void            paste_add(struct paste_stack *, char *, u_int);
                   1078: int             paste_replace(struct paste_stack *, u_int, char *);
                   1079:
                   1080: /* clock.c */
                   1081: void            clock_draw(struct screen_write_ctx *, u_int, int);
                   1082:
                   1083: /* cmd.c */
                   1084: struct cmd     *cmd_parse(int, char **, char **);
                   1085: int             cmd_exec(struct cmd *, struct cmd_ctx *);
                   1086: void            cmd_send(struct cmd *, struct buffer *);
                   1087: struct cmd     *cmd_recv(struct buffer *);
                   1088: void            cmd_free(struct cmd *);
                   1089: size_t          cmd_print(struct cmd *, char *, size_t);
                   1090: void            cmd_send_string(struct buffer *, const char *);
                   1091: char           *cmd_recv_string(struct buffer *);
                   1092: struct session *cmd_current_session(struct cmd_ctx *);
                   1093: struct client  *cmd_find_client(struct cmd_ctx *, const char *);
                   1094: struct session *cmd_find_session(struct cmd_ctx *, const char *);
                   1095: struct winlink *cmd_find_window(
1.26      nicm     1096:                     struct cmd_ctx *, const char *, struct session **);
                   1097: int             cmd_find_index(
                   1098:                     struct cmd_ctx *, const char *, struct session **);
1.1       nicm     1099: extern const struct cmd_entry *cmd_table[];
                   1100: extern const struct cmd_entry cmd_attach_session_entry;
                   1101: extern const struct cmd_entry cmd_bind_key_entry;
                   1102: extern const struct cmd_entry cmd_break_pane_entry;
                   1103: extern const struct cmd_entry cmd_choose_session_entry;
                   1104: extern const struct cmd_entry cmd_choose_window_entry;
                   1105: extern const struct cmd_entry cmd_clear_history_entry;
                   1106: extern const struct cmd_entry cmd_clock_mode_entry;
                   1107: extern const struct cmd_entry cmd_command_prompt_entry;
                   1108: extern const struct cmd_entry cmd_confirm_before_entry;
                   1109: extern const struct cmd_entry cmd_copy_buffer_entry;
                   1110: extern const struct cmd_entry cmd_copy_mode_entry;
                   1111: extern const struct cmd_entry cmd_delete_buffer_entry;
                   1112: extern const struct cmd_entry cmd_detach_client_entry;
1.36    ! nicm     1113: extern const struct cmd_entry cmd_display_message_entry;
1.1       nicm     1114: extern const struct cmd_entry cmd_down_pane_entry;
                   1115: extern const struct cmd_entry cmd_find_window_entry;
                   1116: extern const struct cmd_entry cmd_has_session_entry;
1.19      nicm     1117: extern const struct cmd_entry cmd_if_shell_entry;
1.1       nicm     1118: extern const struct cmd_entry cmd_kill_pane_entry;
                   1119: extern const struct cmd_entry cmd_kill_server_entry;
                   1120: extern const struct cmd_entry cmd_kill_session_entry;
                   1121: extern const struct cmd_entry cmd_kill_window_entry;
                   1122: extern const struct cmd_entry cmd_last_window_entry;
                   1123: extern const struct cmd_entry cmd_link_window_entry;
                   1124: extern const struct cmd_entry cmd_list_buffers_entry;
                   1125: extern const struct cmd_entry cmd_list_clients_entry;
                   1126: extern const struct cmd_entry cmd_list_commands_entry;
                   1127: extern const struct cmd_entry cmd_list_keys_entry;
                   1128: extern const struct cmd_entry cmd_list_sessions_entry;
                   1129: extern const struct cmd_entry cmd_list_windows_entry;
                   1130: extern const struct cmd_entry cmd_load_buffer_entry;
                   1131: extern const struct cmd_entry cmd_lock_server_entry;
                   1132: extern const struct cmd_entry cmd_move_window_entry;
                   1133: extern const struct cmd_entry cmd_new_session_entry;
                   1134: extern const struct cmd_entry cmd_new_window_entry;
                   1135: extern const struct cmd_entry cmd_next_layout_entry;
                   1136: extern const struct cmd_entry cmd_next_window_entry;
                   1137: extern const struct cmd_entry cmd_paste_buffer_entry;
                   1138: extern const struct cmd_entry cmd_previous_layout_entry;
                   1139: extern const struct cmd_entry cmd_previous_window_entry;
                   1140: extern const struct cmd_entry cmd_refresh_client_entry;
                   1141: extern const struct cmd_entry cmd_rename_session_entry;
                   1142: extern const struct cmd_entry cmd_rename_window_entry;
                   1143: extern const struct cmd_entry cmd_resize_pane_entry;
                   1144: extern const struct cmd_entry cmd_respawn_window_entry;
                   1145: extern const struct cmd_entry cmd_rotate_window_entry;
                   1146: extern const struct cmd_entry cmd_save_buffer_entry;
                   1147: extern const struct cmd_entry cmd_scroll_mode_entry;
                   1148: extern const struct cmd_entry cmd_select_layout_entry;
                   1149: extern const struct cmd_entry cmd_select_pane_entry;
                   1150: extern const struct cmd_entry cmd_select_prompt_entry;
                   1151: extern const struct cmd_entry cmd_select_window_entry;
                   1152: extern const struct cmd_entry cmd_send_keys_entry;
                   1153: extern const struct cmd_entry cmd_send_prefix_entry;
                   1154: extern const struct cmd_entry cmd_server_info_entry;
                   1155: extern const struct cmd_entry cmd_set_buffer_entry;
                   1156: extern const struct cmd_entry cmd_set_option_entry;
                   1157: extern const struct cmd_entry cmd_set_password_entry;
                   1158: extern const struct cmd_entry cmd_set_window_option_entry;
                   1159: extern const struct cmd_entry cmd_show_buffer_entry;
                   1160: extern const struct cmd_entry cmd_show_options_entry;
                   1161: extern const struct cmd_entry cmd_show_window_options_entry;
                   1162: extern const struct cmd_entry cmd_source_file_entry;
                   1163: extern const struct cmd_entry cmd_split_window_entry;
                   1164: extern const struct cmd_entry cmd_start_server_entry;
                   1165: extern const struct cmd_entry cmd_suspend_client_entry;
                   1166: extern const struct cmd_entry cmd_swap_pane_entry;
                   1167: extern const struct cmd_entry cmd_swap_window_entry;
                   1168: extern const struct cmd_entry cmd_switch_client_entry;
                   1169: extern const struct cmd_entry cmd_unbind_key_entry;
                   1170: extern const struct cmd_entry cmd_unlink_window_entry;
                   1171: extern const struct cmd_entry cmd_up_pane_entry;
                   1172:
                   1173: /* cmd-list.c */
                   1174: struct cmd_list        *cmd_list_parse(int, char **, char **);
                   1175: int             cmd_list_exec(struct cmd_list *, struct cmd_ctx *);
                   1176: void            cmd_list_send(struct cmd_list *, struct buffer *);
                   1177: struct cmd_list        *cmd_list_recv(struct buffer *);
                   1178: void            cmd_list_free(struct cmd_list *);
                   1179: size_t          cmd_list_print(struct cmd_list *, char *, size_t);
                   1180:
                   1181: /* cmd-string.c */
                   1182: int    cmd_string_parse(const char *, struct cmd_list **, char **);
                   1183:
                   1184: /* cmd-generic.c */
                   1185: size_t  cmd_prarg(char *, size_t, const char *, char *);
                   1186: #define CMD_TARGET_WINDOW_USAGE "[-t target-window]"
                   1187: #define CMD_TARGET_SESSION_USAGE "[-t target-session]"
                   1188: #define CMD_TARGET_CLIENT_USAGE "[-t target-client]"
                   1189: void   cmd_target_init(struct cmd *, int);
                   1190: int    cmd_target_parse(struct cmd *, int, char **, char **);
                   1191: void   cmd_target_send(struct cmd *, struct buffer *);
                   1192: void   cmd_target_recv(struct cmd *, struct buffer *);
                   1193: void   cmd_target_free(struct cmd *);
                   1194: size_t cmd_target_print(struct cmd *, char *, size_t);
                   1195: #define CMD_SRCDST_WINDOW_USAGE "[-s src-window] [-t dst-window]"
                   1196: #define CMD_SRCDST_SESSION_USAGE "[-s src-session] [-t dst-session]"
                   1197: #define CMD_SRCDST_CLIENT_USAGE "[-s src-client] [-t dst-client]"
                   1198: void   cmd_srcdst_init(struct cmd *, int);
                   1199: int    cmd_srcdst_parse(struct cmd *, int, char **, char **);
                   1200: void   cmd_srcdst_send(struct cmd *, struct buffer *);
                   1201: void   cmd_srcdst_recv(struct cmd *, struct buffer *);
                   1202: void   cmd_srcdst_free(struct cmd *);
                   1203: size_t cmd_srcdst_print(struct cmd *, char *, size_t);
                   1204: #define CMD_BUFFER_WINDOW_USAGE "[-b buffer-index] [-t target-window]"
                   1205: #define CMD_BUFFER_SESSION_USAGE "[-b buffer-index] [-t target-session]"
                   1206: #define CMD_BUFFER_CLIENT_USAGE "[-b buffer-index] [-t target-client]"
                   1207: void   cmd_buffer_init(struct cmd *, int);
                   1208: int    cmd_buffer_parse(struct cmd *, int, char **, char **);
                   1209: void   cmd_buffer_send(struct cmd *, struct buffer *);
                   1210: void   cmd_buffer_recv(struct cmd *, struct buffer *);
                   1211: void   cmd_buffer_free(struct cmd *);
                   1212: size_t cmd_buffer_print(struct cmd *, char *, size_t);
                   1213: #define CMD_OPTION_WINDOW_USAGE "[-gu] [-t target-window] option [value]"
                   1214: #define CMD_OPTION_SESSION_USAGE "[-gu] [-t target-session] option [value]"
                   1215: #define CMD_OPTION_CLIENT_USAGE "[-gu] [-t target-client] option [value]"
                   1216: void   cmd_option_init(struct cmd *, int);
                   1217: int    cmd_option_parse(struct cmd *, int, char **, char **);
                   1218: void   cmd_option_send(struct cmd *, struct buffer *);
                   1219: void   cmd_option_recv(struct cmd *, struct buffer *);
                   1220: void   cmd_option_free(struct cmd *);
                   1221: size_t cmd_option_print(struct cmd *, char *, size_t);
                   1222: #define CMD_PANE_WINDOW_USAGE "[-t target-window] [-p pane-index]"
                   1223: #define CMD_PANE_SESSION_USAGE "[-t target-session] [-p pane-index]"
                   1224: #define CMD_PANE_CLIENT_USAGE "[-t target-client] [-p pane-index]"
                   1225: void   cmd_pane_init(struct cmd *, int);
                   1226: int    cmd_pane_parse(struct cmd *, int, char **, char **);
                   1227: void   cmd_pane_send(struct cmd *, struct buffer *);
                   1228: void   cmd_pane_recv(struct cmd *, struct buffer *);
                   1229: void   cmd_pane_free(struct cmd *);
                   1230: size_t cmd_pane_print(struct cmd *, char *, size_t);
                   1231:
                   1232: /* client.c */
                   1233: int     client_init(char *, struct client_ctx *, int, int);
                   1234: int     client_main(struct client_ctx *);
                   1235:
                   1236: /* client-msg.c */
                   1237: int     client_msg_dispatch(struct client_ctx *, char **);
                   1238:
                   1239: /* client-fn.c */
                   1240: void    client_write_server(struct client_ctx *, enum hdrtype, void *, size_t);
                   1241: void    client_write_server2(
                   1242:             struct client_ctx *, enum hdrtype, void *, size_t, void *, size_t);
                   1243: void    client_fill_session(struct msg_command_data *);
                   1244:
                   1245: /* key-bindings.c */
                   1246: extern struct key_bindings key_bindings;
                   1247: int     key_bindings_cmp(struct key_binding *, struct key_binding *);
                   1248: SPLAY_PROTOTYPE(key_bindings, key_binding, entry, key_bindings_cmp);
                   1249: struct key_binding *key_bindings_lookup(int);
                   1250: void    key_bindings_add(int, int, struct cmd_list *);
                   1251: void    key_bindings_remove(int);
1.24      nicm     1252: void    key_bindings_clean(void);
1.1       nicm     1253: void    key_bindings_init(void);
                   1254: void    key_bindings_free(void);
                   1255: void    key_bindings_dispatch(struct key_binding *, struct client *);
                   1256: void printflike2 key_bindings_error(struct cmd_ctx *, const char *, ...);
                   1257: void printflike2 key_bindings_print(struct cmd_ctx *, const char *, ...);
                   1258: void printflike2 key_bindings_info(struct cmd_ctx *, const char *, ...);
                   1259:
                   1260: /* key-string.c */
                   1261: int     key_string_lookup_string(const char *);
                   1262: const char *key_string_lookup_key(int);
                   1263:
                   1264: /* server.c */
                   1265: extern struct clients clients;
                   1266: struct client *server_create_client(int);
                   1267: int     server_client_index(struct client *);
                   1268: int     server_start(char *);
                   1269:
                   1270: /* server-msg.c */
                   1271: int     server_msg_dispatch(struct client *);
                   1272:
                   1273: /* server-fn.c */
                   1274: const char **server_fill_environ(struct session *);
                   1275: void    server_write_client(
                   1276:              struct client *, enum hdrtype, const void *, size_t);
                   1277: void    server_write_session(
                   1278:              struct session *, enum hdrtype, const void *, size_t);
                   1279: void    server_redraw_client(struct client *);
                   1280: void    server_status_client(struct client *);
                   1281: void    server_redraw_session(struct session *);
                   1282: void    server_status_session(struct session *);
                   1283: void    server_redraw_window(struct window *);
                   1284: void    server_status_window(struct window *);
                   1285: void    server_lock(void);
                   1286: int     server_unlock(const char *);
                   1287:
                   1288: /* status.c */
                   1289: int     status_redraw(struct client *);
1.36    ! nicm     1290: char   *status_replace(struct session *, const char *, time_t);
1.32      nicm     1291: void printflike2 status_message_set(struct client *, const char *, ...);
1.1       nicm     1292: void    status_message_clear(struct client *);
                   1293: int     status_message_redraw(struct client *);
1.33      nicm     1294: void    status_prompt_set(struct client *, const char *,
                   1295:             int (*)(void *, const char *), void (*)(void *), void *, int);
1.1       nicm     1296: void    status_prompt_clear(struct client *);
                   1297: int     status_prompt_redraw(struct client *);
                   1298: void    status_prompt_key(struct client *, int);
                   1299:
                   1300: /* resize.c */
                   1301: void    recalculate_sizes(void);
                   1302:
                   1303: /* input.c */
                   1304: void    input_init(struct window_pane *);
                   1305: void    input_free(struct window_pane *);
                   1306: void    input_parse(struct window_pane *);
                   1307:
                   1308: /* input-key.c */
                   1309: void    input_key(struct window_pane *, int);
                   1310: void    input_mouse(struct window_pane *, u_char, u_char, u_char);
                   1311:
                   1312: /* colour.c */
                   1313: const char *colour_tostring(u_char);
                   1314: int     colour_fromstring(const char *);
                   1315: u_char  colour_256to16(u_char);
                   1316: u_char  colour_256to88(u_char);
                   1317:
                   1318: /* attributes.c */
                   1319: const char *attributes_tostring(u_char);
                   1320: int     attributes_fromstring(const char *);
                   1321:
                   1322: /* grid.c */
                   1323: extern const struct grid_cell grid_default_cell;
                   1324: struct grid *grid_create(u_int, u_int, u_int);
                   1325: void    grid_destroy(struct grid *);
                   1326: int     grid_compare(struct grid *, struct grid *);
                   1327: void    grid_reduce_line(struct grid *, u_int, u_int);
                   1328: void    grid_expand_line(struct grid *, u_int, u_int);
                   1329: void    grid_expand_line_utf8(struct grid *, u_int, u_int);
                   1330: void    grid_scroll_line(struct grid *);
                   1331: const struct grid_cell *grid_peek_cell(struct grid *, u_int, u_int);
                   1332: struct grid_cell *grid_get_cell(struct grid *, u_int, u_int);
                   1333: void    grid_set_cell(struct grid *, u_int, u_int, const struct grid_cell *);
                   1334: const struct grid_utf8 *grid_peek_utf8(struct grid *, u_int, u_int);
                   1335: struct grid_utf8 *grid_get_utf8(struct grid *, u_int, u_int);
                   1336: void    grid_set_utf8(struct grid *, u_int, u_int, const struct grid_utf8 *);
                   1337: void    grid_clear(struct grid *, u_int, u_int, u_int, u_int);
                   1338: void    grid_clear_lines(struct grid *, u_int, u_int);
                   1339: void    grid_move_lines(struct grid *, u_int, u_int, u_int);
                   1340: void    grid_move_cells(struct grid *, u_int, u_int, u_int, u_int);
1.9       nicm     1341: char   *grid_string_cells(struct grid *, u_int, u_int, u_int);
1.25      nicm     1342: void    grid_duplicate_lines(
                   1343:             struct grid *, u_int, struct grid *, u_int, u_int);
1.1       nicm     1344:
                   1345: /* grid-view.c */
                   1346: const struct grid_cell *grid_view_peek_cell(struct grid *, u_int, u_int);
                   1347: struct grid_cell *grid_view_get_cell(struct grid *, u_int, u_int);
                   1348: void    grid_view_set_cell(
                   1349:             struct grid *, u_int, u_int, const struct grid_cell *);
                   1350: const struct grid_utf8 *grid_view_peek_utf8(struct grid *, u_int, u_int);
                   1351: struct grid_utf8 *grid_view_get_utf8(struct grid *, u_int, u_int);
                   1352: void    grid_view_set_utf8(
                   1353:             struct grid *, u_int, u_int, const struct grid_utf8 *);
                   1354: void    grid_view_clear(struct grid *, u_int, u_int, u_int, u_int);
                   1355: void    grid_view_scroll_region_up(struct grid *, u_int, u_int);
                   1356: void    grid_view_scroll_region_down(struct grid *, u_int, u_int);
                   1357: void    grid_view_insert_lines(struct grid *, u_int, u_int);
1.18      nicm     1358: void    grid_view_insert_lines_region(struct grid *, u_int, u_int, u_int);
1.1       nicm     1359: void    grid_view_delete_lines(struct grid *, u_int, u_int);
1.18      nicm     1360: void    grid_view_delete_lines_region(struct grid *, u_int, u_int, u_int);
1.1       nicm     1361: void    grid_view_insert_cells(struct grid *, u_int, u_int, u_int);
                   1362: void    grid_view_delete_cells(struct grid *, u_int, u_int, u_int);
1.9       nicm     1363: char   *grid_view_string_cells(struct grid *, u_int, u_int, u_int);
1.1       nicm     1364:
                   1365: /* screen-write.c */
                   1366: void    screen_write_start(
                   1367:             struct screen_write_ctx *, struct window_pane *, struct screen *);
                   1368: void    screen_write_stop(struct screen_write_ctx *);
1.4       nicm     1369: size_t printflike2 screen_write_strlen(int, const char *, ...);
1.3       nicm     1370: void printflike3 screen_write_puts(struct screen_write_ctx *,
                   1371:             struct grid_cell *, const char *, ...);
1.4       nicm     1372: void printflike5 screen_write_nputs(struct screen_write_ctx *,
                   1373:     ssize_t, struct grid_cell *, int, const char *, ...);
1.3       nicm     1374: void    screen_write_vnputs(struct screen_write_ctx *,
1.4       nicm     1375:             ssize_t, struct grid_cell *, int, const char *, va_list);
1.1       nicm     1376: void    screen_write_putc(
                   1377:             struct screen_write_ctx *, struct grid_cell *, u_char);
                   1378: void    screen_write_copy(struct screen_write_ctx *,
                   1379:             struct screen *, u_int, u_int, u_int, u_int);
                   1380: void    screen_write_cursorup(struct screen_write_ctx *, u_int);
                   1381: void    screen_write_cursordown(struct screen_write_ctx *, u_int);
                   1382: void    screen_write_cursorright(struct screen_write_ctx *, u_int);
                   1383: void    screen_write_cursorleft(struct screen_write_ctx *, u_int);
1.5       nicm     1384: void    screen_write_alignmenttest(struct screen_write_ctx *);
1.1       nicm     1385: void    screen_write_insertcharacter(struct screen_write_ctx *, u_int);
                   1386: void    screen_write_deletecharacter(struct screen_write_ctx *, u_int);
                   1387: void    screen_write_insertline(struct screen_write_ctx *, u_int);
                   1388: void    screen_write_deleteline(struct screen_write_ctx *, u_int);
                   1389: void    screen_write_clearline(struct screen_write_ctx *);
                   1390: void    screen_write_clearendofline(struct screen_write_ctx *);
                   1391: void    screen_write_clearstartofline(struct screen_write_ctx *);
                   1392: void    screen_write_cursormove(struct screen_write_ctx *, u_int, u_int);
                   1393: void    screen_write_cursormode(struct screen_write_ctx *, int);
                   1394: void    screen_write_reverseindex(struct screen_write_ctx *);
                   1395: void    screen_write_scrollregion(struct screen_write_ctx *, u_int, u_int);
                   1396: void    screen_write_insertmode(struct screen_write_ctx *, int);
                   1397: void    screen_write_mousemode(struct screen_write_ctx *, int);
                   1398: void    screen_write_linefeed(struct screen_write_ctx *);
                   1399: void    screen_write_carriagereturn(struct screen_write_ctx *);
                   1400: void    screen_write_kcursormode(struct screen_write_ctx *, int);
                   1401: void    screen_write_kkeypadmode(struct screen_write_ctx *, int);
                   1402: void    screen_write_clearendofscreen(struct screen_write_ctx *);
                   1403: void    screen_write_clearstartofscreen(struct screen_write_ctx *);
                   1404: void    screen_write_clearscreen(struct screen_write_ctx *);
                   1405: void    screen_write_cell(
                   1406:             struct screen_write_ctx *, const struct grid_cell *, u_char *);
                   1407:
                   1408: /* screen-redraw.c */
1.29      nicm     1409: void    screen_redraw_screen(struct client *, int);
1.1       nicm     1410: void    screen_redraw_pane(struct client *, struct window_pane *);
                   1411:
                   1412: /* screen.c */
                   1413: void    screen_init(struct screen *, u_int, u_int, u_int);
                   1414: void    screen_reinit(struct screen *);
                   1415: void    screen_free(struct screen *);
1.6       nicm     1416: void    screen_reset_tabs(struct screen *);
1.1       nicm     1417: void    screen_set_title(struct screen *, const char *);
                   1418: void    screen_resize(struct screen *, u_int, u_int);
                   1419: void    screen_set_selection(
                   1420:             struct screen *, u_int, u_int, u_int, u_int, struct grid_cell *);
                   1421: void    screen_clear_selection(struct screen *);
                   1422: int     screen_check_selection(struct screen *, u_int, u_int);
                   1423:
                   1424: /* window.c */
                   1425: extern struct windows windows;
1.17      nicm     1426: const char     *window_default_command(void);
1.1       nicm     1427: int             window_cmp(struct window *, struct window *);
                   1428: int             winlink_cmp(struct winlink *, struct winlink *);
                   1429: RB_PROTOTYPE(windows, window, entry, window_cmp);
                   1430: RB_PROTOTYPE(winlinks, winlink, entry, winlink_cmp);
                   1431: struct winlink *winlink_find_by_index(struct winlinks *, int);
                   1432: struct winlink         *winlink_find_by_window(struct winlinks *, struct window *);
                   1433: int             winlink_next_index(struct winlinks *);
                   1434: u_int           winlink_count(struct winlinks *);
                   1435: struct winlink *winlink_add(struct winlinks *, struct window *, int);
                   1436: void            winlink_remove(struct winlinks *, struct winlink *);
                   1437: struct winlink *winlink_next(struct winlinks *, struct winlink *);
                   1438: struct winlink *winlink_previous(struct winlinks *, struct winlink *);
                   1439: void            winlink_stack_push(struct winlink_stack *, struct winlink *);
                   1440: void            winlink_stack_remove(struct winlink_stack *, struct winlink *);
                   1441: int             window_index(struct window *, u_int *);
                   1442: struct window  *window_create1(u_int, u_int);
                   1443: struct window  *window_create(const char *, const char *,
                   1444:                     const char *, const char **, u_int, u_int, u_int, char **);
                   1445: void            window_destroy(struct window *);
                   1446: int             window_resize(struct window *, u_int, u_int);
                   1447: void            window_set_active_pane(struct window *, struct window_pane *);
                   1448: struct window_pane *window_add_pane(struct window *, int,
                   1449:                     const char *, const char *, const char **, u_int, char **);
                   1450: void            window_remove_pane(struct window *, struct window_pane *);
                   1451: struct window_pane *window_pane_at_index(struct window *, u_int);
1.36    ! nicm     1452: u_int           window_pane_index(struct window *, struct window_pane *);
1.1       nicm     1453: u_int           window_count_panes(struct window *);
                   1454: void            window_destroy_panes(struct window *);
                   1455: struct window_pane *window_pane_create(struct window *, u_int, u_int, u_int);
                   1456: void            window_pane_destroy(struct window_pane *);
                   1457: int             window_pane_spawn(struct window_pane *,
                   1458:                     const char *, const char *, const char **, char **);
                   1459: int             window_pane_resize(struct window_pane *, u_int, u_int);
                   1460: int             window_pane_set_mode(
                   1461:                     struct window_pane *, const struct window_mode *);
                   1462: void            window_pane_reset_mode(struct window_pane *);
                   1463: void            window_pane_parse(struct window_pane *);
                   1464: void            window_pane_key(struct window_pane *, struct client *, int);
                   1465: void            window_pane_mouse(struct window_pane *,
                   1466:                     struct client *, u_char, u_char, u_char);
1.28      nicm     1467: int             window_pane_visible(struct window_pane *);
1.10      nicm     1468: char           *window_pane_search(
                   1469:                     struct window_pane *, const char *, u_int *);
1.1       nicm     1470:
                   1471: /* layout.c */
                   1472: const char *    layout_name(struct window *);
                   1473: int             layout_lookup(const char *);
                   1474: void            layout_refresh(struct window *, int);
                   1475: int             layout_resize(struct window_pane *, int);
                   1476: int             layout_select(struct window *, u_int);
                   1477: void            layout_next(struct window *);
                   1478: void            layout_previous(struct window *);
                   1479:
                   1480: /* layout-manual.c */
                   1481: void            layout_manual_v_refresh(struct window *, int);
                   1482: void            layout_manual_v_resize(struct window_pane *, int);
                   1483:
                   1484: /* window-clock.c */
                   1485: extern const struct window_mode window_clock_mode;
                   1486:
                   1487: /* window-copy.c */
                   1488: extern const struct window_mode window_copy_mode;
                   1489: void            window_copy_pageup(struct window_pane *);
                   1490:
                   1491: /* window-scroll.c */
                   1492: extern const struct window_mode window_scroll_mode;
                   1493: void            window_scroll_pageup(struct window_pane *);
                   1494:
                   1495: /* window-more.c */
                   1496: extern const struct window_mode window_more_mode;
                   1497: void            window_more_vadd(struct window_pane *, const char *, va_list);
                   1498:
                   1499: /* window-choose.c */
                   1500: extern const struct window_mode window_choose_mode;
                   1501: void            window_choose_vadd(
                   1502:                     struct window_pane *, int, const char *, va_list);
                   1503: void printflike3 window_choose_add(
                   1504:                     struct window_pane *, int, const char *, ...);
                   1505: void            window_choose_ready(struct window_pane *,
1.34      nicm     1506:                     u_int, void (*)(void *, int), void (*)(void *), void *);
1.1       nicm     1507:
                   1508: /* names.c */
                   1509: void            set_window_names(void);
                   1510: char           *default_window_name(struct window *);
                   1511:
                   1512: /* session.c */
                   1513: extern struct sessions sessions;
                   1514: void    session_alert_add(struct session *, struct window *, int);
                   1515: void    session_alert_cancel(struct session *, struct winlink *);
                   1516: int     session_alert_has(struct session *, struct winlink *, int);
                   1517: int     session_alert_has_window(struct session *, struct window *, int);
                   1518: struct session *session_find(const char *);
                   1519: struct session *session_create(const char *, const char *,
                   1520:                     const char *, u_int, u_int, char **);
                   1521: void            session_destroy(struct session *);
                   1522: int             session_index(struct session *, u_int *);
                   1523: struct winlink *session_new(struct session *,
                   1524:                     const char *, const char *, const char *, int, char **);
                   1525: struct winlink *session_attach(
                   1526:                     struct session *, struct window *, int, char **);
                   1527: int             session_detach(struct session *, struct winlink *);
                   1528: int             session_has(struct session *, struct window *);
                   1529: int             session_next(struct session *, int);
                   1530: int             session_previous(struct session *, int);
                   1531: int             session_select(struct session *, int);
                   1532: int             session_last(struct session *);
                   1533:
                   1534: /* utf8.c */
                   1535: void   utf8_build(void);
1.7       nicm     1536: int    utf8_width(const u_char *);
1.1       nicm     1537:
                   1538: /* procname.c */
                   1539: char   *get_proc_name(int, char *);
                   1540:
                   1541: /* buffer.c */
                   1542: struct buffer  *buffer_create(size_t);
                   1543: void            buffer_destroy(struct buffer *);
                   1544: void            buffer_ensure(struct buffer *, size_t);
                   1545: void            buffer_add(struct buffer *, size_t);
                   1546: void            buffer_remove(struct buffer *, size_t);
                   1547: void            buffer_write(struct buffer *, const void *, size_t);
                   1548: void            buffer_read(struct buffer *, void *, size_t);
                   1549: void            buffer_write8(struct buffer *, uint8_t);
                   1550: uint8_t                 buffer_read8(struct buffer *);
                   1551:
                   1552: /* buffer-poll.c */
                   1553: int             buffer_poll(struct pollfd *, struct buffer *, struct buffer *);
                   1554:
                   1555: /* log.c */
                   1556: void            log_open_tty(int);
                   1557: void            log_open_file(int, const char *);
                   1558: void            log_close(void);
                   1559: void printflike1 log_warn(const char *, ...);
                   1560: void printflike1 log_warnx(const char *, ...);
                   1561: void printflike1 log_info(const char *, ...);
                   1562: void printflike1 log_debug(const char *, ...);
                   1563: void printflike1 log_debug2(const char *, ...);
                   1564: void printflike1 log_debug3(const char *, ...);
                   1565: __dead void     log_fatal(const char *, ...);
                   1566: __dead void     log_fatalx(const char *, ...);
                   1567:
                   1568: /* xmalloc.c */
                   1569: char           *xstrdup(const char *);
                   1570: void           *xcalloc(size_t, size_t);
                   1571: void           *xmalloc(size_t);
                   1572: void           *xrealloc(void *, size_t, size_t);
                   1573: void            xfree(void *);
                   1574: int printflike2         xasprintf(char **, const char *, ...);
                   1575: int             xvasprintf(char **, const char *, va_list);
                   1576: int printflike3         xsnprintf(char *, size_t, const char *, ...);
                   1577: int             xvsnprintf(char *, size_t, const char *, va_list);
                   1578:
                   1579: #endif /* TMUX_H */