=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/tmux.h,v retrieving revision 1.72 retrieving revision 1.73 diff -c -r1.72 -r1.73 *** src/usr.bin/tmux/tmux.h 2009/08/08 15:57:49 1.72 --- src/usr.bin/tmux/tmux.h 2009/08/08 21:52:43 1.73 *************** *** 1,4 **** ! /* $OpenBSD: tmux.h,v 1.72 2009/08/08 15:57:49 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: tmux.h,v 1.73 2009/08/08 21:52:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 39,44 **** --- 39,45 ---- #include "array.h" extern char *__progname; + extern char **environ; /* Default configuration files. */ #define DEFAULT_CFG ".tmux.conf" *************** *** 69,74 **** --- 70,76 ---- #define COMMAND_LENGTH 2048 /* packed argv size */ #define TERMINAL_LENGTH 128 /* length of TERM environment variable */ #define PRINT_LENGTH 512 /* printed error/message size */ + #define ENVIRON_LENGTH 1024 /* environment variable length */ /* Fatal errors. */ #define fatal(msg) log_fatal("%s: %s", __func__, msg); *************** *** 302,307 **** --- 304,310 ---- MSG_SUSPEND, MSG_UNLOCK, MSG_WAKEUP, + MSG_ENVIRON }; /* *************** *** 356,361 **** --- 359,368 ---- char pass[PASS_MAX]; }; + struct msg_environ_data { + char var[ENVIRON_LENGTH]; + }; + /* Mode key commands. */ enum mode_key_cmd { MODEKEY_NONE, *************** *** 765,770 **** --- 772,786 ---- }; ARRAY_DECL(paste_stack, struct paste_buffer *); + /* Environment variable. */ + struct environ_entry { + char *name; + char *value; + + RB_ENTRY(environ_entry) entry; + }; + RB_HEAD(environ, environ_entry); + /* Client session. */ struct session_alert { struct winlink *wl; *************** *** 792,797 **** --- 808,815 ---- #define SESSION_UNATTACHED 0x1 /* not attached to any clients */ int flags; + + struct environ environ; }; ARRAY_DECL(sessions, struct session *); *************** *** 894,899 **** --- 912,919 ---- struct buffer *in; struct buffer *out; + struct environ environ; + char *title; char *cwd; *************** *** 992,997 **** --- 1012,1018 ---- #define CMD_CANTNEST 0x2 #define CMD_ARG1 0x4 #define CMD_ARG01 0x8 + #define CMD_SENDENVIRON 0x10 int flags; #define CMD_CHFLAG(flag) \ *************** *** 1074,1079 **** --- 1095,1101 ---- extern volatile sig_atomic_t sigusr2; extern struct options global_s_options; extern struct options global_w_options; + extern struct environ global_environ; extern char *cfg_file; extern int server_locked; extern u_int password_failures; *************** *** 1123,1128 **** --- 1145,1162 ---- void options_set_number(struct options *, const char *, long long); long long options_get_number(struct options *, const char *); + /* environ.c */ + int environ_cmp(struct environ_entry *, struct environ_entry *); + RB_PROTOTYPE(environ, environ_entry, entry, environ_cmp); + void environ_init(struct environ *); + void environ_free(struct environ *); + void environ_copy(struct environ *, struct environ *); + struct environ_entry *environ_find(struct environ *, const char *); + void environ_set(struct environ *, const char *, const char *); + void environ_put(struct environ *, const char *); + void environ_unset(struct environ *, const char *); + void environ_update(const char *, struct environ *, struct environ *); + /* tty.c */ u_char tty_get_acs(struct tty *, u_char); void tty_reset(struct tty *); *************** *** 1285,1294 **** --- 1319,1330 ---- extern const struct cmd_entry cmd_send_prefix_entry; extern const struct cmd_entry cmd_server_info_entry; extern const struct cmd_entry cmd_set_buffer_entry; + extern const struct cmd_entry cmd_set_environment_entry; extern const struct cmd_entry cmd_set_option_entry; extern const struct cmd_entry cmd_set_password_entry; extern const struct cmd_entry cmd_set_window_option_entry; extern const struct cmd_entry cmd_show_buffer_entry; + extern const struct cmd_entry cmd_show_environment_entry; extern const struct cmd_entry cmd_show_options_entry; extern const struct cmd_entry cmd_show_window_options_entry; extern const struct cmd_entry cmd_source_file_entry; *************** *** 1384,1390 **** int server_msg_dispatch(struct client *); /* server-fn.c */ ! const char **server_fill_environ(struct session *); void server_write_error(struct client *, const char *); void server_write_client( struct client *, enum msgtype, const void *, size_t); --- 1420,1426 ---- int server_msg_dispatch(struct client *); /* server-fn.c */ ! void server_fill_environ(struct session *, struct environ *); void server_write_error(struct client *, const char *); void server_write_client( struct client *, enum msgtype, const void *, size_t); *************** *** 1554,1561 **** void winlink_stack_remove(struct winlink_stack *, struct winlink *); int window_index(struct window *, u_int *); struct window *window_create1(u_int, u_int); ! struct window *window_create(const char *, const char *, ! const char *, const char **, u_int, u_int, u_int, char **); void window_destroy(struct window *); void window_set_active_pane(struct window *, struct window_pane *); struct window_pane *window_add_pane(struct window *, u_int); --- 1590,1597 ---- void winlink_stack_remove(struct winlink_stack *, struct winlink *); int window_index(struct window *, u_int *); struct window *window_create1(u_int, u_int); ! struct window *window_create(const char *, const char *, const char *, ! struct environ *, u_int, u_int, u_int, char **); void window_destroy(struct window *); void window_set_active_pane(struct window *, struct window_pane *); struct window_pane *window_add_pane(struct window *, u_int); *************** *** 1568,1574 **** struct window_pane *window_pane_create(struct window *, u_int, u_int, u_int); void window_pane_destroy(struct window_pane *); int window_pane_spawn(struct window_pane *, ! const char *, const char *, const char **, char **); void window_pane_resize(struct window_pane *, u_int, u_int); int window_pane_set_mode( struct window_pane *, const struct window_mode *); --- 1604,1610 ---- struct window_pane *window_pane_create(struct window *, u_int, u_int, u_int); void window_pane_destroy(struct window_pane *); int window_pane_spawn(struct window_pane *, ! const char *, const char *, struct environ *, char **); void window_pane_resize(struct window_pane *, u_int, u_int); int window_pane_set_mode( struct window_pane *, const struct window_mode *); *************** *** 1648,1654 **** int session_alert_has_window(struct session *, struct window *, int); struct session *session_find(const char *); struct session *session_create(const char *, const char *, ! const char *, u_int, u_int, char **); void session_destroy(struct session *); int session_index(struct session *, u_int *); struct winlink *session_new(struct session *, --- 1684,1690 ---- int session_alert_has_window(struct session *, struct window *, int); struct session *session_find(const char *); struct session *session_create(const char *, const char *, ! const char *, struct environ *, u_int, u_int, char **); void session_destroy(struct session *); int session_index(struct session *, u_int *); struct winlink *session_new(struct session *,