[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.1

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