|
ascii-chat 0.8.38
Real-time terminal-based video chat with ASCII art conversion
|
Common utilities and helpers for option parsing. More...
Go to the source code of this file.
Data Structures | |
| struct | mode_metadata_t |
| Mode metadata for usage display. More... | |
Functions | |
| const char * | find_similar_option (const char *unknown_opt, const struct option *options) |
| const char * | format_available_modes (option_mode_bitmask_t mode_bitmask) |
| const char * | find_similar_option_with_mode (const char *unknown_opt, const options_config_t *config, option_mode_bitmask_t current_mode_bitmask) |
| int | strtoint_safe (const char *str) |
| char * | get_required_argument (const char *opt_value, char *buffer, size_t buffer_size, const char *option_name, asciichat_mode_t mode) |
| char * | validate_required_argument (const char *optarg, char *argbuf, size_t argbuf_size, const char *option_name, asciichat_mode_t mode) |
| bool | validate_positive_int_opt (const char *value_str, int *out_value, const char *param_name) |
| bool | validate_port_opt (const char *value_str, uint16_t *out_port) |
| bool | validate_fps_opt (const char *value_str, int *out_fps) |
| bool | validate_webcam_index (const char *value_str, unsigned short int *out_index) |
| asciichat_error_t | detect_default_ssh_key (char *key_path, size_t path_size) |
| char * | strip_equals_prefix (const char *opt_value, char *buffer, size_t buffer_size) |
| char * | read_password_from_stdin (const char *prompt) |
| asciichat_error_t | parse_color_mode_option (const char *value_str, options_t *opts) |
| asciichat_error_t | parse_render_mode_option (const char *value_str, options_t *opts) |
| asciichat_error_t | parse_palette_option (const char *value_str, options_t *opts) |
| asciichat_error_t | parse_palette_chars_option (const char *value_str, options_t *opts) |
| asciichat_error_t | parse_width_option (const char *value_str, options_t *opts) |
| asciichat_error_t | parse_height_option (const char *value_str, options_t *opts) |
| asciichat_error_t | parse_webcam_index_option (const char *value_str, options_t *opts) |
| asciichat_error_t | parse_snapshot_delay_option (const char *value_str, options_t *opts) |
| asciichat_error_t | parse_log_level_option (const char *value_str, options_t *opts) |
| const char * | options_get_type_placeholder (option_type_t type) |
| int | options_format_default_value (option_type_t type, const void *default_value, char *buf, size_t bufsize) |
| void | update_dimensions_for_full_height (options_t *opts) |
| void | update_dimensions_to_terminal_size (options_t *opts) |
| void | usage (FILE *desc, asciichat_mode_t mode) |
| asciichat_error_t | validate_options_and_report (const void *config, const void *opts) |
| void | print_project_links (FILE *desc) |
Variables | |
| ASCIICHAT_API bool | auto_width = true |
| ASCIICHAT_API bool | auto_height = true |
| bool | port_explicitly_set_via_flag = false |
| const float | weight_red = 0.2989f |
| const float | weight_green = 0.5866f |
| const float | weight_blue = 0.1145f |
| unsigned short int | RED [256] |
| unsigned short int | GREEN [256] |
| unsigned short int | BLUE [256] |
| unsigned short int | GRAY [256] |
Common utilities and helpers for option parsing.
Shared helper functions, validators, and global variables used by all option parsing modules (client.c, server.c, mirror.c).
Definition in file options/common.c.
| asciichat_error_t detect_default_ssh_key | ( | char * | key_path, |
| size_t | path_size | ||
| ) |
Definition at line 262 of file options/common.c.
References expand_path().
| const char * find_similar_option | ( | const char * | unknown_opt, |
| const struct option * | options | ||
| ) |
Definition at line 38 of file options/common.c.
References levenshtein().
| const char * find_similar_option_with_mode | ( | const char * | unknown_opt, |
| const options_config_t * | config, | ||
| option_mode_bitmask_t | current_mode_bitmask | ||
| ) |
Definition at line 108 of file options/common.c.
References format_available_modes(), levenshtein(), and safe_snprintf().
| const char * format_available_modes | ( | option_mode_bitmask_t | mode_bitmask | ) |
Definition at line 64 of file options/common.c.
References safe_snprintf().
Referenced by find_similar_option_with_mode().
| char * get_required_argument | ( | const char * | opt_value, |
| char * | buffer, | ||
| size_t | buffer_size, | ||
| const char * | option_name, | ||
| asciichat_mode_t | mode | ||
| ) |
Definition at line 312 of file options/common.c.
References buffer_size, and strip_equals_prefix().
Referenced by validate_required_argument().
| int options_format_default_value | ( | option_type_t | type, |
| const void * | default_value, | ||
| char * | buf, | ||
| size_t | bufsize | ||
| ) |
Definition at line 576 of file options/common.c.
References safe_snprintf().
Referenced by format_option_default_value_str(), and manpage_content_generate_options().
| const char * options_get_type_placeholder | ( | option_type_t | type | ) |
Definition at line 558 of file options/common.c.
Referenced by get_option_help_placeholder_str(), and manpage_content_generate_options().
| asciichat_error_t parse_color_mode_option | ( | const char * | value_str, |
| options_t * | opts | ||
| ) |
Definition at line 385 of file options/common.c.
| asciichat_error_t parse_height_option | ( | const char * | value_str, |
| options_t * | opts | ||
| ) |
Definition at line 488 of file options/common.c.
References validate_positive_int_opt().
| asciichat_error_t parse_log_level_option | ( | const char * | value_str, |
| options_t * | opts | ||
| ) |
Definition at line 536 of file options/common.c.
References validate_opt_log_level().
| asciichat_error_t parse_palette_chars_option | ( | const char * | value_str, |
| options_t * | opts | ||
| ) |
Definition at line 453 of file options/common.c.
| asciichat_error_t parse_palette_option | ( | const char * | value_str, |
| options_t * | opts | ||
| ) |
Definition at line 428 of file options/common.c.
| asciichat_error_t parse_render_mode_option | ( | const char * | value_str, |
| options_t * | opts | ||
| ) |
Definition at line 409 of file options/common.c.
| asciichat_error_t parse_snapshot_delay_option | ( | const char * | value_str, |
| options_t * | opts | ||
| ) |
Definition at line 519 of file options/common.c.
| asciichat_error_t parse_webcam_index_option | ( | const char * | value_str, |
| options_t * | opts | ||
| ) |
Definition at line 504 of file options/common.c.
References validate_webcam_index().
| asciichat_error_t parse_width_option | ( | const char * | value_str, |
| options_t * | opts | ||
| ) |
Definition at line 472 of file options/common.c.
References validate_positive_int_opt().
| void print_project_links | ( | FILE * | desc | ) |
Definition at line 740 of file options/common.c.
References colored_string().
Referenced by options_print_help_for_mode().
| char * read_password_from_stdin | ( | const char * | prompt | ) |
Definition at line 341 of file options/common.c.
References prompt_password_simple().
| char * strip_equals_prefix | ( | const char * | opt_value, |
| char * | buffer, | ||
| size_t | buffer_size | ||
| ) |
Definition at line 292 of file options/common.c.
References buffer_size.
Referenced by get_required_argument().
| int strtoint_safe | ( | const char * | str | ) |
Definition at line 164 of file options/common.c.
References parse_int32().
Referenced by validate_fps_opt(), validate_opt_device_index(), validate_opt_reconnect(), and validate_positive_int_opt().
| void update_dimensions_for_full_height | ( | options_t * | opts | ) |
Definition at line 606 of file options/common.c.
References get_terminal_size().
Referenced by options_init().
| void update_dimensions_to_terminal_size | ( | options_t * | opts | ) |
Definition at line 635 of file options/common.c.
References get_terminal_size().
Referenced by options_init().
| void usage | ( | FILE * | desc, |
| asciichat_mode_t | mode | ||
| ) |
Definition at line 683 of file options/common.c.
References mode_metadata_t::description, options_config_destroy(), options_preset_unified(), options_print_help_for_mode(), and mode_metadata_t::program_name.
Referenced by action_help_acds(), action_help_client(), action_help_discovery(), action_help_mirror(), action_help_server(), manpage_content_generate_usage(), manpage_merger_generate_usage(), options_builder_add_usage(), options_config_calculate_max_col_width(), options_init(), and options_print_help_for_mode().
| bool validate_fps_opt | ( | const char * | value_str, |
| int * | out_fps | ||
| ) |
Definition at line 224 of file options/common.c.
References strtoint_safe().
| asciichat_error_t validate_options_and_report | ( | const void * | config, |
| const void * | opts | ||
| ) |
Definition at line 718 of file options/common.c.
References options_config_validate().
Referenced by options_init().
| bool validate_port_opt | ( | const char * | value_str, |
| uint16_t * | out_port | ||
| ) |
Definition at line 209 of file options/common.c.
References parse_port().
| bool validate_positive_int_opt | ( | const char * | value_str, |
| int * | out_value, | ||
| const char * | param_name | ||
| ) |
Definition at line 193 of file options/common.c.
References strtoint_safe().
Referenced by parse_height_option(), and parse_width_option().
| char * validate_required_argument | ( | const char * | optarg, |
| char * | argbuf, | ||
| size_t | argbuf_size, | ||
| const char * | option_name, | ||
| asciichat_mode_t | mode | ||
| ) |
Definition at line 183 of file options/common.c.
References get_required_argument().
| bool validate_webcam_index | ( | const char * | value_str, |
| unsigned short int * | out_index | ||
| ) |
Definition at line 240 of file options/common.c.
References validate_opt_device_index().
Referenced by parse_webcam_index_option().
Definition at line 364 of file options/common.c.
Referenced by threaded_send_terminal_size_with_auto_detect().
Definition at line 364 of file options/common.c.
Referenced by threaded_send_terminal_size_with_auto_detect().
| unsigned short int BLUE[256] |
Definition at line 378 of file options/common.c.
Referenced by precalc_rgb_palettes().
| unsigned short int GRAY[256] |
Definition at line 379 of file options/common.c.
Referenced by precalc_rgb_palettes().
| unsigned short int GREEN[256] |
Definition at line 377 of file options/common.c.
Referenced by precalc_rgb_palettes().
Definition at line 367 of file options/common.c.
| unsigned short int RED[256] |
Definition at line 376 of file options/common.c.
Referenced by precalc_rgb_palettes().
| const float weight_blue = 0.1145f |
Definition at line 372 of file options/common.c.
Referenced by server_main().
| const float weight_green = 0.5866f |
Definition at line 371 of file options/common.c.
Referenced by server_main().
| const float weight_red = 0.2989f |
Definition at line 370 of file options/common.c.
Referenced by server_main().