tmux  3.2a
About: tmux is a terminal multiplexer that lets you switch easily between several programs in one terminal.
  Fossies Dox: tmux-3.2a.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

options.c File Reference
#include <sys/types.h>
#include <ctype.h>
#include <fnmatch.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "tmux.h"
Include dependency graph for options.c:

Go to the source code of this file.

Data Structures

struct  options_array_item
struct  options_entry
struct  options




static int options_array_cmp (struct options_array_item *a1, struct options_array_item *a2)
 RB_GENERATE_STATIC (options_array, options_array_item, entry, options_array_cmp)
static struct options_entryoptions_add (struct options *, const char *)
static void options_remove (struct options_entry *)
static int options_cmp (struct options_entry *, struct options_entry *)
 RB_GENERATE_STATIC (options_tree, options_entry, entry, options_cmp)
static const char * options_map_name (const char *name)
static const struct options_table_entryoptions_parent_table_entry (struct options *oo, const char *s)
static void options_value_free (struct options_entry *o, union options_value *ov)
static char * options_value_to_string (struct options_entry *o, union options_value *ov, int numeric)
struct optionsoptions_create (struct options *parent)
void options_free (struct options *oo)
struct optionsoptions_get_parent (struct options *oo)
void options_set_parent (struct options *oo, struct options *parent)
struct options_entryoptions_first (struct options *oo)
struct options_entryoptions_next (struct options_entry *o)
struct options_entryoptions_get_only (struct options *oo, const char *name)
struct options_entryoptions_get (struct options *oo, const char *name)
struct options_entryoptions_empty (struct options *oo, const struct options_table_entry *oe)
struct options_entryoptions_default (struct options *oo, const struct options_table_entry *oe)
char * options_default_to_string (const struct options_table_entry *oe)
const char * options_name (struct options_entry *o)
struct optionsoptions_owner (struct options_entry *o)
const struct options_table_entryoptions_table_entry (struct options_entry *o)
static struct options_array_itemoptions_array_item (struct options_entry *o, u_int idx)
static struct options_array_itemoptions_array_new (struct options_entry *o, u_int idx)
static void options_array_free (struct options_entry *o, struct options_array_item *a)
void options_array_clear (struct options_entry *o)
union options_valueoptions_array_get (struct options_entry *o, u_int idx)
int options_array_set (struct options_entry *o, u_int idx, const char *value, int append, char **cause)
int options_array_assign (struct options_entry *o, const char *s, char **cause)
struct options_array_itemoptions_array_first (struct options_entry *o)
struct options_array_itemoptions_array_next (struct options_array_item *a)
u_int options_array_item_index (struct options_array_item *a)
union options_valueoptions_array_item_value (struct options_array_item *a)
int options_is_array (struct options_entry *o)
int options_is_string (struct options_entry *o)
char * options_to_string (struct options_entry *o, int idx, int numeric)
char * options_parse (const char *name, int *idx)
struct options_entryoptions_parse_get (struct options *oo, const char *s, int *idx, int only)
char * options_match (const char *s, int *idx, int *ambiguous)
struct options_entryoptions_match_get (struct options *oo, const char *s, int *idx, int only, int *ambiguous)
const char * options_get_string (struct options *oo, const char *name)
long long options_get_number (struct options *oo, const char *name)
struct options_entryoptions_set_string (struct options *oo, const char *name, int append, const char *fmt,...)
struct options_entryoptions_set_number (struct options *oo, const char *name, long long value)
int options_scope_from_name (struct args *args, int window, const char *name, struct cmd_find_state *fs, struct options **oo, char **cause)
int options_scope_from_flags (struct args *args, int window, struct cmd_find_state *fs, struct options **oo, char **cause)
struct styleoptions_string_to_style (struct options *oo, const char *name, struct format_tree *ft)
static int options_from_string_check (const struct options_table_entry *oe, const char *value, char **cause)
static int options_from_string_flag (struct options *oo, const char *name, const char *value, char **cause)
static int options_from_string_choice (const struct options_table_entry *oe, struct options *oo, const char *name, const char *value, char **cause)
int options_from_string (struct options *oo, const struct options_table_entry *oe, const char *name, const char *value, int append, char **cause)
void options_push_changes (const char *name)
int options_remove_or_default (struct options_entry *o, int idx, char **cause)

Macro Definition Documentation


#define OPTIONS_IS_ARRAY (   o)
((o)->tableentry != NULL && \
((o)->tableentry->flags & OPTIONS_TABLE_IS_ARRAY))
Definition: tmux.h:1826

Definition at line 85 of file options.c.


#define OPTIONS_IS_COMMAND (   o)
((o)->tableentry != NULL && \
(o)->tableentry->type == OPTIONS_TABLE_COMMAND)
Definition: tmux.h:1817

Definition at line 81 of file options.c.


#define OPTIONS_IS_NUMBER (   o)
((o)->tableentry != NULL && \
((o)->tableentry->type == OPTIONS_TABLE_NUMBER || \
(o)->tableentry->type == OPTIONS_TABLE_KEY || \
(o)->tableentry->type == OPTIONS_TABLE_COLOUR || \
(o)->tableentry->type == OPTIONS_TABLE_FLAG || \
(o)->tableentry->type == OPTIONS_TABLE_CHOICE))
Definition: tmux.h:1816
Definition: tmux.h:1813
Definition: tmux.h:1812
Definition: tmux.h:1814
Definition: tmux.h:1815

Definition at line 74 of file options.c.


#define OPTIONS_IS_STRING (   o)
((o)->tableentry == NULL || \
(o)->tableentry->type == OPTIONS_TABLE_STRING)
Definition: tmux.h:1811

Definition at line 71 of file options.c.

Function Documentation

◆ options_add()

static struct options_entry * options_add ( struct options oo,
const char *  name 

◆ options_array_assign()

int options_array_assign ( struct options_entry o,
const char *  s,
char **  cause 

◆ options_array_clear()

void options_array_clear ( struct options_entry o)

Definition at line 397 of file options.c.

References options_value::array, options_array_free(), OPTIONS_IS_ARRAY, and options_entry::value.

Referenced by options_remove().

◆ options_array_cmp()

static int options_array_cmp ( struct options_array_item a1,
struct options_array_item a2 

Definition at line 40 of file options.c.

References options_array_item::index.

◆ options_array_first()

◆ options_array_free()

static void options_array_free ( struct options_entry o,
struct options_array_item a 

◆ options_array_get()

union options_value* options_array_get ( struct options_entry o,
u_int  idx 

◆ options_array_item()

◆ options_array_item_index()

u_int options_array_item_index ( struct options_array_item a)

◆ options_array_item_value()

◆ options_array_new()

static struct options_array_item* options_array_new ( struct options_entry o,
u_int  idx 

Definition at line 378 of file options.c.

References options_value::array, options_array_item::index, options_entry::value, and xcalloc().

Referenced by options_array_set().

◆ options_array_next()

◆ options_array_set()

◆ options_cmp()

static int options_cmp ( struct options_entry lhs,
struct options_entry rhs 

Definition at line 93 of file options.c.

References options_entry::name.

◆ options_create()

struct options* options_create ( struct options parent)

Definition at line 171 of file options.c.

References xcalloc().

Referenced by LLVMFuzzerInitialize(), main(), window_create(), and window_pane_create().

◆ options_default()

◆ options_default_to_string()

◆ options_empty()

◆ options_first()

struct options_entry* options_first ( struct options oo)

◆ options_free()

void options_free ( struct options oo)

Definition at line 182 of file options.c.

References options_remove().

Referenced by client_main(), session_free(), window_destroy(), and window_pane_destroy().

◆ options_from_string()

◆ options_from_string_check()

static int options_from_string_check ( const struct options_table_entry oe,
const char *  value,
char **  cause 

◆ options_from_string_choice()

static int options_from_string_choice ( const struct options_table_entry oe,
struct options oo,
const char *  name,
const char *  value,
char **  cause 

◆ options_from_string_flag()

static int options_from_string_flag ( struct options oo,
const char *  name,
const char *  value,
char **  cause 

Definition at line 958 of file options.c.

References name, options_get_number(), options_set_number(), and xasprintf().

Referenced by options_from_string().

◆ options_get()

◆ options_get_number()

long long options_get_number ( struct options oo,
const char *  name 

Definition at line 699 of file options.c.

References fatalx(), name, options_value::number, options_get(), OPTIONS_IS_NUMBER, and options_entry::value.

Referenced by alerts_action_applies(), alerts_check_activity(), alerts_check_bell(), alerts_check_silence(), alerts_enabled(), alerts_reset(), alerts_set_message(), check_window_name(), cmd_display_menu_exec(), cmd_display_panes_draw_pane(), cmd_list_keys_commands(), default_window_size(), format_cb_pane_at_bottom(), format_cb_pane_at_top(), format_cb_pane_synchronized(), input_csi_dispatch(), input_exit_rename(), input_key(), input_osc_52(), layout_fix_panes(), layout_resize_check(), layout_split_pane(), layout_spread_cell(), options_from_string_choice(), options_from_string_flag(), options_push_changes(), paste_add(), recalculate_size(), screen_redraw_set_context(), screen_redraw_update(), screen_reinit(), screen_write_alternateoff(), screen_write_alternateon(), server_add_message(), server_check_unattached(), server_client_assume_paste(), server_client_check_redraw(), server_client_key_callback(), server_client_loop(), server_client_reset_state(), server_destroy_pane(), server_destroy_session(), server_link_window(), server_loop(), server_renumber_session(), session_renumber_windows(), session_update_activity(), spawn_pane(), spawn_window(), status_line_size(), status_message_set(), status_prompt_complete_list_menu(), status_prompt_complete_window_menu(), status_prompt_key(), status_redraw(), status_timer_callback(), status_timer_start(), status_update_cache(), tty_keys_next(), tty_update_features(), window_copy_append_selection(), window_copy_command(), window_copy_common_init(), window_copy_copy_buffer(), window_copy_cursor_next_word_end(), window_copy_cursor_next_word_end_pos(), window_copy_get_selection(), window_copy_key_table(), window_copy_search(), window_copy_update_style(), window_customize_draw_option(), window_customize_set_option(), window_find_string(), window_pane_at_index(), window_pane_copy_key(), window_pane_find_down(), window_pane_find_up(), window_pane_index(), window_pane_key(), window_tree_draw_session(), and window_tree_draw_window().

◆ options_get_only()

◆ options_get_parent()

struct options* options_get_parent ( struct options oo)

Definition at line 192 of file options.c.

Referenced by window_customize_draw_option(), and window_customize_reset_option().

◆ options_get_string()

◆ options_is_array()

int options_is_array ( struct options_entry o)

Definition at line 555 of file options.c.


Referenced by cmd_show_options_all().

◆ options_is_string()

int options_is_string ( struct options_entry o)

Definition at line 561 of file options.c.


Referenced by cmd_show_options_all().

◆ options_map_name()

static const char* options_map_name ( const char *  name)

Definition at line 99 of file options.c.

References options_name_map::from, name, options_other_names, and options_name_map::to.

Referenced by options_get_only(), and options_match().

◆ options_match()

char* options_match ( const char *  s,
int *  idx,
int *  ambiguous 

◆ options_match_get()

struct options_entry* options_match_get ( struct options oo,
const char *  s,
int *  idx,
int  only,
int *  ambiguous 

Definition at line 667 of file options.c.

References name, options_get(), options_get_only(), and options_match().

◆ options_name()

◆ options_next()

struct options_entry* options_next ( struct options_entry o)

◆ options_owner()

◆ options_parent_table_entry()

static const struct options_table_entry* options_parent_table_entry ( struct options oo,
const char *  s 

Definition at line 111 of file options.c.

References fatalx(), options_get(), and options_entry::tableentry.

Referenced by options_set_number(), and options_set_string().

◆ options_parse()

char* options_parse ( const char *  name,
int *  idx 

Definition at line 583 of file options.c.

References name, and xstrdup().

Referenced by options_match(), and options_parse_get().

◆ options_parse_get()

struct options_entry* options_parse_get ( struct options oo,
const char *  s,
int *  idx,
int  only 

Definition at line 608 of file options.c.

References name, options_get(), options_get_only(), and options_parse().

Referenced by format_find().

◆ options_push_changes()

◆ options_remove()

static void options_remove ( struct options_entry o)

◆ options_remove_or_default()

◆ options_scope_from_flags()

◆ options_scope_from_name()

◆ options_set_number()

◆ options_set_parent()

void options_set_parent ( struct options oo,
struct options parent 

Definition at line 198 of file options.c.

◆ options_set_string()

struct options_entry* options_set_string ( struct options oo,
const char *  name,
int  append,
const char *  fmt,

◆ options_string_to_style()

struct style* options_string_to_style ( struct options oo,
const char *  name,
struct format_tree ft 

◆ options_table_entry()

◆ options_to_string()

◆ options_value_free()

static void options_value_free ( struct options_entry o,
union options_value ov 

◆ options_value_to_string()


RB_GENERATE_STATIC ( options_array  ,
options_array_item  ,
entry  ,


RB_GENERATE_STATIC ( options_tree  ,
options_entry  ,
entry  ,