|
C-Menu 0.2.9
A User Interface Toolkit
|
Headder for C-Menu API library, libcm.so. More...
#include "version.h"#include <argp.h>#include <ncursesw/ncurses.h>#include <ncursesw/panel.h>#include <signal.h>#include <stddef.h>#include <stdlib.h>#include <time.h>#include <ui_backend.h>#include <wait.h>#include <stdio.h>Go to the source code of this file.
Data Structures | |
| struct | Arg |
| The Arg structure represents a string argument with a pointer to the string and its allocated length. More... | |
| struct | Argv |
| The Argv structure represents an argument vector, which is an array of Arg structures, along with the number of allocated elements in the array. More... | |
| struct | CCStr |
| complex character objectl with a pointer to the complex character string and its allocated length More... | |
| struct | Chyron |
| struct | ChyronKey |
| struct | ColorPair |
| struct | Date |
| struct | RGB |
| struct | SIO |
| The SIO structure encapsulates various aspects of the terminal's state and configuration, including color management, file pointers, and terminal device information. More... | |
| struct | String |
| The String structure represents a string object with a pointer to the string and its allocated length. More... | |
| struct | Time |
| struct | WCStr |
| wide character string object with a pointer to the wide character string and its allocated length More... | |
Macros | |
| #define | __atexit |
| This macro registers the end_pgm function to be called when the program exits. | |
| #define | _GNU_SOURCE |
| #define | _XOPEN_SOURCE_EXTENDED 1 |
| #define | ABS(x) |
| ABS macro for absolute value, which evaluates the expression once and returns the absolute value. | |
| #define | BG_COLOR 0 |
| #define | BO_COLOR 1 |
| #define | BW_BL L'\x2514' |
| #define | BW_BR L'\x2518' |
| #define | BW_BT L'\x2534' |
| #define | BW_CHK L'\x2611' |
| #define | BW_CR L'\x253C' |
| #define | BW_DA L'\x2193' |
| #define | BW_HO L'\x2500' |
| #define | BW_LA L'\x2190' |
| #define | BW_LAN L'\x276E' |
| #define | BW_LT L'\x251C' |
| #define | BW_RA L'\x2192' |
| #define | BW_RAN L'\x276F' |
| #define | BW_RBL L'\x2570' |
| #define | BW_RBR L'\x256f' |
| #define | BW_RT L'\x2524' |
| #define | BW_RTL L'\x256d' |
| #define | BW_RTR L'\x256e' |
| #define | BW_SP L'\x20' |
| #define | BW_TL L'\x250C' |
| #define | BW_TR L'\x2510' |
| #define | BW_TT L'\x252C' |
| #define | BW_UA L'\x2191' |
| #define | BW_VE L'\x2502' |
| #define | CHYRON_KEY_MAXLEN 64 |
| #define | CHYRON_KEYS 20 |
| #define | COLOR_LEN 8 |
| #define | Ctrl(c) |
| #define | DEFAULTSHELL "/bin/bash" |
| #define | DIV_ROUND_UP(n, d) |
| #define | F_NO_STDERR 1 |
| #define | FG_COLOR 2 |
| #define | KEY_ALTDEL 0x20e |
| #define | KEY_ALTDOWN 0x214 |
| #define | KEY_ALTEND 0x219 |
| #define | KEY_ALTF(n) |
| #define | KEY_ALTF0 0x138 |
| #define | KEY_ALTHOME 0x21e |
| #define | KEY_ALTINS 0x223 |
| #define | KEY_ALTLEFT 0x228 |
| #define | KEY_ALTPGDN 0x22d |
| #define | KEY_ALTPGUP 0x232 |
| #define | KEY_ALTRIGHT 0x237 |
| #define | KEY_ALTUP 0x23d |
| #define | LN_BG_COLOR 7 |
| #define | LN_COLOR 4 |
| #define | MAX(a, b) |
| MIN macro for compatibility with code that uses the same name, while avoiding multiple evaluations of the arguments. | |
| #define | max(a, b) |
| max macro evaluates two expressions, returning greatest result. | |
| #define | MAX_ARGS 64 |
| #define | MAX_DEPTH 3 |
| #define | MAXARGS 64 |
| #define | MAXLEN 256 |
| #define | MAXWIN 30 |
| #define | MAXWIN 30 |
| #define | MIN(x, y) |
| MAX macro for compatibility with code that uses the same name, while avoiding multiple evaluations of the arguments. | |
| #define | min(x, y) |
| min macro evaluates two expressions, returning least result | |
| #define | NCURSES_WIDECHAR 1 |
| #define | nullptr NULL |
| #define | S_QUIET 0x2000 |
| #define | S_TOLOWER(c) |
| #define | S_TOUPPER(c) |
| #define | S_WCOK 0x1000 |
| #define | SCR_COLS 1024 |
| #define | SCREEN_MAX_LINES 100 |
| #define | to_lowercase(c) |
| #define | to_uppercase(c) |
| #define | to_uppercase(c) |
| #define | XTERM_256COLOR |
Typedefs | |
| typedef unsigned char | uchar |
Functions | |
| unsigned long | a_to_ul (const char *) |
| Converts a string to an unsigned long long integer, with support for suffixes K, M, and G for kilobytes, megabytes, and gigabytes respectively. | |
| int | a_toi (char *, bool *) |
| a safer alternative to atoi() for converting ASCII strings to integers. | |
| void | abend (int, char *) |
| Abnormal program termination. | |
| bool | action_disposition (char *eitle, char *action_str) |
| Display a simple action disposition message window or print to stderr. | |
| void | activate_all_chyron_keys (Chyron *) |
| Deactivate chyron key. | |
| void | activate_chyron_key (Chyron *, int) |
| Activate chyron key. | |
| int | answer_yn (char *, char *, char *, char *) |
| Accept a single letter answer. | |
| void | apply_gamma (RGB *) |
| Apply gamma correction to RGB color. | |
| int | bare_box_new (int, int, int, int, char *) |
| Create a new window with optional box and title. | |
| bool | base_name (char *, char *) |
| Returns the base name of a file specification. | |
| int | border_draw (WINDOW *) |
| int | border_hsplit (WINDOW *, int) |
| Draw a box with a separator line around the specified window. | |
| int | border_hsplit_text (WINDOW *, char *, int) |
| Draw a box with a separator line and text around the specified window. | |
| int | border_title (WINDOW *, char *) |
| Draw a box with a title around the specified window. | |
| int | box2_new (int, int, int, int, char *) |
| int | box_hsplit_new (int, int, int, int, int, char *) |
| Create a new window with optional box and title, and a second window inside it, split horizontally. | |
| int | box_new (int, int, int, int, char *) |
| Create a new window with optional box and title. | |
| size_t | canonicalize_file_spec (char *) |
| Removes quotes and trims at first space. | |
| bool | capture_curses_tioctl () |
| capture_curses_tioctl() - capture curses terminal settings | |
| bool | capture_shell_tioctl () |
| capture_shell_tioctl() - capture shell terminal settings | |
| int | cf_accept (WINDOW *, char *, int, int, int) |
| Accepts input for a field in a C-Menu window. | |
| void | check_panels (int) |
| Check and display the panels for a given window index. | |
| bool | chrep (char *, char, char) |
| Replaces all occurrences of old_chr in s with new_chr in place. | |
| int | clr_name_to_idx (char *) |
| Get color index from color name. | |
| void | compile_chyron (Chyron *) |
| construct the chyron string from the chyron structure | |
| bool | construct_file_spec (char *, char *, char *, char *, char *, int) |
| void | curskeys (WINDOW *) |
| void | deactivate_all_chyron_keys (Chyron *) |
| Deactivate all chyron keys. | |
| void | deactivate_chyron_key (Chyron *, int) |
| Deactivate chyron key. | |
| int | destroy_argv (int argc, char **argv) |
| Deallocates memory allocated for argument strings in argv. | |
| void | destroy_box (WINDOW *) |
| Chyron * | destroy_chyron (Chyron *chyron) |
| Destroy Chyron structure. | |
| void | destroy_curses () |
| Gracefully shut down NCurses and restore terminal settings. | |
| void | destroy_win (WINDOW *) |
| char | di_getch () |
| get single character from terminal in raw mode | |
| bool | dir_name (char *, char *) |
| Returns the directory name of a file specification. | |
| void | display_argv_error_msg (char *, char **) |
| void | display_chyron (WINDOW *, Chyron *, int, int) |
| Display chyron on window. | |
| void | display_cmplx_str (WINDOW *, cchar_t *, int, int) |
| Display a complex character string on a window. | |
| int | display_curses_keys () |
| int | display_error (char *, char *, char *, char *) |
| Display an error message window or print to stderr. | |
| int | display_ok_message (char *) |
| void | dump_opts () |
| void | dump_opts_by_use (char *, char *) |
| int | dxwgetch (WINDOW *, WINDOW *, WINDOW *, WINDOW *, WINDOW *, Chyron *, int) |
| Wrapper for wgetch that handles signals, mouse events, checks for clicks on the chyron line, and accepts a sinigle character answer. | |
| int | enter_option () |
| bool | expand_tilde (char *, int) |
| Replaces "~/" in string with the user's home directory. | |
| char * | fdname (int, char *) |
| Retrieves the file path associated with a given file descriptor. | |
| bool | file_spec_name (char *, char *) |
| extracts the file name component of a file specification | |
| bool | file_spec_path (char *, char *) |
| extracts the path component of a file specification | |
| char * | fill_field (char *, char *, char, int) |
| int | fork_detach_execvp (char **) |
| Fork, set new session ID, close files, and execute detached command. | |
| int | fork_exec (char **) |
| Fork and exec a command. | |
| char * | format_local_timestamp (time_t, char *, size_t) |
| Formats a time_t as an ISO 8601 string in local time. | |
| String | free_string (String) |
| Free the dynamically allocated String. | |
| int | full_screen_fork_exec (char **) |
| Execute a command in full screen mode. | |
| int | full_screen_shell (char *) |
| Execute a shell command in full screen mode. | |
| bool | get_argp_doc_by_name (char *comment, const struct argp_option *, const char *) |
| Retrieves the documentation string for a given key name from an argp options array. | |
| int | get_chyron_key (Chyron *, int) |
| Get keycode from chyron. | |
| int | get_clr_pair (int, int) |
| Get color pair index for foreground and background colors. | |
| char * | get_ip_addresses (char *, int) |
| Retrieves the IP addresses of the local machine and formats them into a string. | |
| char * | get_local_timestamp () |
| Returns the current local time as an ISO 8601 formatted string. | |
| void | get_rfc3339_s (char *, size_t) |
| char * | get_user_str (char *, size_t) |
| Retrieves the current user's name and UID, and formats it into a string. | |
| bool | handle_signal (sig_atomic_t) |
| bool | init_clr_palette (SIO *) |
| Initialize color palette based on SIO settings. | |
| void | init_stdscr () |
| bool | is_directory (const char *) |
| Checks if the given path is a directory. | |
| bool | is_hex_str (char *, int) |
| Validates that a string consists of exactly len hexadecimal digits. | |
| bool | is_newer (char *, char *) |
| Checks if the file specified by "fut" is newer than the file specified by "control". | |
| bool | is_set_chyron_key (Chyron *, int) |
| Check if function key label is set. | |
| bool | is_symlink_to_dir (const char *) |
| Checks if the given path is a symbolic link to a directory. | |
| bool | is_valid_date (int yyyy, int mm, int dd) |
| Check if a given date is valid, including leap years. | |
| bool | is_valid_regex (const char *) |
| Checks if the given regular expression pattern is valid. | |
| bool | is_valid_time (int hh, int mm, int ss) |
| Check if a given time is valid. | |
| char * | iso8601_time (char *, int, time_t *, bool) |
| Formats a struct tm as an ISO 8601 string. | |
| void | left_justify (char *s) |
| Left justify string by removing leading spaces. | |
| bool | locate_file_in_path (char *, char *) |
| Locates a file in the system PATH. | |
| WINDOW * | message_win (char *) |
| Display a message in a window or print to stderr if curses is not available. | |
| size_t | mk_cmplx_str (cchar_t *, char *, attr_t, int) |
| Convert a multibyte string to an array of cchar_t complex characters. | |
| bool | mk_dir (char *dir) |
| If directory doesn't exist, make it. | |
| bool | mk_raw_tioctl (struct termios *) |
| mk_raw_tioctl() - set terminal to raw mode | |
| String | mk_string (size_t) |
| Create a String struct with a dynamically allocated string. | |
| cchar_t | mkcc (int, attr_t, const char *) |
| Create a cchar_t with the specified color pair index. | |
| void | mouse_getch (int *, int *, int *, int *) |
| void | mvwaddstr_fill (WINDOW *, int, int, char *, int) |
| For lines shorter than their display area, fill the rest with spaces. | |
| Chyron * | new_chyron () |
| Create and initialize Chyron structure. | |
| bool | normalize_file_spec (char *) |
| replace backslashes with forward lashes | |
| void | numeric (char *d, char *s) |
| Extract numeric characters from source string to destination string. | |
| void | open_cmenu_log () |
| Open new C-Menu log file. | |
| bool | open_curses (SIO *) |
| Initialize NCurses and color settings. | |
| int | open_log (char *) |
| bool | parse_local_timestamp (const char *, time_t *) |
| Parses an ISO 8601 timestamp string in local time and converts it to time_t. | |
| int | Perror (char *) |
| Display a simple error message window or print to stderr. | |
| char * | rep_substring (const char *, const char *, const char *) |
| Replace all occurrences of "tgt_s" in "org_s" with "rep_s". | |
| void | resize_panel (PANEL *, int, int, int, int) |
| bool | restore_curses_tioctl () |
| restore_curses_tioctl() - restore curses terminal settings | |
| bool | restore_shell_tioctl () |
| restore_shell_tioctl() - restore shell terminal settings | |
| void | restore_wins () |
| Restore all windows after a screen resize. | |
| int | rgb_clr_to_cube (int) |
| int | rgb_to_curses_clr (RGB *) |
| Get color index for RGB color. | |
| int | rgb_to_xterm256_idx (RGB *) |
| Convert RGB color to XTerm 256 color index. | |
| void | right_justify (char *, int) |
| Right justify string by removing trailing spaces and adding leadingspaces. | |
| size_t | rtrim (char *) |
| Trims trailing spaces from string s in place. | |
| int | segmentation_fault () |
| Function to intentionally cause a segmentation fault for testing purposes. | |
| void | set_chyron_key (Chyron *, int, char *, int) |
| Set chyron key with default color pair (cp_nt_rev). | |
| void | set_chyron_key_cp (Chyron *, int, char *, int, int) |
| Set chyron key with color pair (cp). | |
| bool | set_sane_tioctl (struct termios *) |
| set_sane_tioctl() - set terminal to sane settings for C-MENU | |
| int | shell (char *) |
| Execute a shell command. | |
| void | sig_dfl_mode () |
| Set signal handlers to default behavior. | |
| void | sig_prog_mode () |
| Set up signal handlers for interrupt signals. | |
| void | sig_shell_mode () |
| void | signal_handler (int) |
| Signal handler for interrupt signals. | |
| size_t | ssnprintf (char *, size_t, const char *,...) |
| ssnprintf was designed to be a safer alternative to snprintf. | |
| char * | stdio_fdnames (char *, char *) |
| char * | stdio_names (char *, char *) |
| bool | str_subc (char *, char *, char, char *, int) |
| Replaces "ReplaceChr" in "s" with "Withstr" in "d" won't copy more than "l" bytes to "d" Replaces all occurrences of a character in a string with another string, copying the result to a destination buffer. | |
| int | str_to_args (char **, char *, int) |
| Converts a string into an array of argument strings. | |
| bool | str_to_bool (const char *) |
| Converts String to boolean true or false. | |
| size_t | str_to_cc (cchar_t *, const char *, attr_t, int, size_t) |
| Convert a multibyte string to an array of cchar_t complex characters. | |
| double | str_to_double (char *) |
| converts string to double | |
| bool | str_to_lower (char *) |
| Converts a string to lowercase. | |
| bool | str_to_upper (char *) |
| Converts a string to uppercase. | |
| size_t | string_cat (String *, const String *) |
| Concatenates src String to dest String, allocating additional memory for dest String if necessary. | |
| size_t | string_cpy (String *, const String *) |
| Copy src String to dest String, allocating additional memory for dest String if necessary. | |
| size_t | string_ncat (String *, const String *, size_t) |
| Concatenates up to n characters from src String to dest String, allocating additional memory for dest String if necessary. | |
| size_t | string_ncpy (String *, const String *, size_t) |
| copies up to n characters from src String to dest String, allocating additional memory for dest String if necessary | |
| size_t | strip_ansi (char *, char *) |
| Strips ANSI SGR escape sequences (ending in 'm') from string s to d. | |
| bool | strip_quotes (char *) |
| removes leading and trailing double quotes if present | |
| bool | stripz_quotes (char *) |
| removes leading and trailing double quotes if present | |
| bool | strnfill (char *, char, int) |
| size_t | strnlf (char *, size_t) |
| terminates string with line feed | |
| size_t | strnz (char *, size_t) |
| terminates string at New Line, Carriage Return, or max_len | |
| size_t | strnz__cat (char *, const char *, size_t) |
| safer alternative to strncat | |
| size_t | strnz__cpy (char *, const char *, size_t) |
| safer alternative to strncpy | |
| char * | strnz_dup (char *, size_t) |
| Allocates memory for and duplicates string s up to length l or until line feed or carriage return. | |
| String | to_string (const char *) |
| String functions provide a simple string library to facilitate string manipulation in C, allowing developers to easily create, copy, concatenate, and free strings without having to manage memory manually. | |
| size_t | trim (char *) |
| Trims leading and trailing spaces from string s in place. | |
| bool | trim_ext (char *, char *) |
| trims the file extension from "filename" and copies the result to "buf" | |
| bool | trim_path (char *) |
| Trims trailing spaces and slashes from directory path in place. | |
| void | unset_chyron_key (Chyron *, int) |
| Unset chyron key. | |
| bool | unstr_hex_clr (char *, char *) |
| Validates that a string is a hex color code in the format "#RRGGBB". | |
| void | user_end () |
| bool | verify_dir (char *, int) |
| Verifies that the directory specified by "spec" exists and is accessible with the permissions specified by "imode". | |
| bool | verify_dir_q (char *, int) |
| bool | verify_file (char *, int) |
| Verifies that the file specified by "in_spec" exists and is accessible with the permissions specified by "imode". | |
| bool | verify_file_q (char *, int) |
| bool | verify_spec_arg (char *, char *, char *, char *, int) |
| Verify file specification argument. | |
| int | vgetch (WINDOW *, int) |
| Wrapper for wgetch that handles signals and mouse events, and accepts a single character answer. | |
| void | w_mouse_getch (WINDOW *, int *, int *, int *, int *) |
| int | wait_continue (WINDOW *, Chyron *, int) |
| Update the waiting message with remaining time and check for user input. | |
| bool | wait_destroy (Chyron *) |
| Destroy the waiting message window and chyron. | |
| Chyron * | wait_mk_chyron () |
| Create a Chyron struct for the waiting message. | |
| WINDOW * | wait_mk_win (Chyron *, char *) |
| Display a popup waiting message. | |
| bool | waitpid_with_timeout (pid_t, int) |
| Wait for a process to finish with a timeout and optional user cancellation. | |
| int | wccp_to_str (wchar_t, uint8_t *) |
| Converts a Unicode code point to a UTF-8 encoded string. | |
| int | win2_box_new (int, int, int, int, char *) |
| Create a new window with optional box and title, and a second window inside it. | |
| int | win2_new (int, int, int, int) |
| Create a new subwindow (win2) with specified dimensions and position. | |
| void | win_del () |
| Delete the current window and its associated box window. | |
| void | win_init_attrs () |
| Initialize window attributes. | |
| int | win_new (int, int) |
| Create a new window with specified dimensions and position. | |
| void | win_redraw (WINDOW *) |
| Redraw the specified window. | |
| void | win_resize (int, int, char *) |
| Resize the current window and its box, and update the title. | |
| void | win_Toggle_Attrs () |
| void | write_cmenu_log (char *) |
| Write message to C-Menu log file with timestamp. | |
| void | write_cmenu_log_nt (char *) |
| Write message to C-Menu log file without timestamp. | |
| void | write_log (char *) |
| RGB | xterm256_idx_to_rgb (int) |
| Convert XTerm 256 color index to RGB. | |
| int | xwgetch (WINDOW *, Chyron *, int) |
| Wrapper for wgetch that handles signals, mouse events, checks for clicks on the chyron line, and accepts a sinigle character answer. | |
Variables | |
| cchar_t | bl |
| cchar_t | br |
| cchar_t | bs |
| const wchar_t | bw_bl |
| const wchar_t | bw_br |
| const wchar_t | bw_bt |
| const wchar_t | bw_chk |
| const wchar_t | bw_cr |
| const wchar_t | bw_da |
| const wchar_t | bw_ho |
| const wchar_t | bw_la |
| const wchar_t | bw_lt |
| const wchar_t | bw_ra |
| const wchar_t | bw_ran |
| const wchar_t | bw_rt |
| const wchar_t | bw_sp |
| const wchar_t | bw_tl |
| const wchar_t | bw_tr |
| const wchar_t | bw_tt |
| const wchar_t | bw_ua |
| const wchar_t | bw_ve |
| cchar_t | CC_BLUE |
| cchar_t | CC_BOX |
| cchar_t | CC_BRKTL |
| cchar_t | CC_BRKTR |
| cchar_t | CC_CMDLN |
| cchar_t | CC_DATA1 |
| cchar_t | CC_DATA2 |
| cchar_t | CC_DATA3 |
| cchar_t | CC_FILL_CHAR |
| cchar_t | CC_GREEN |
| cchar_t | CC_IND |
| cchar_t | CC_LN |
| cchar_t | CC_NT |
| cchar_t | CC_NT_HL |
| cchar_t | CC_NT_HL_REV |
| cchar_t | CC_NT_REV |
| cchar_t | CC_RED |
| cchar_t | CC_REVERSE |
| cchar_t | CC_TITLE |
| cchar_t | CC_YELLOW |
| cchar_t | chk |
| int | click_x |
| int | click_y |
| int | clr_cnt |
| int | clr_idx |
| int | clr_pair_cnt |
| int | clr_pair_idx |
| int | cmenu_log_fd |
| FILE * | cmenu_log_fp |
| char const | colors_text [][10] |
| Color names for .minitrc overrides. | |
| int | cp_blue |
| int | cp_bold |
| int | cp_box |
| int | cp_brackets |
| int | cp_cmdln_bg |
| int | cp_cmdln_fg |
| int | cp_default |
| int | cp_fill_char |
| int | cp_green |
| int | cp_highlight |
| int | cp_ind |
| int | cp_ln_bg |
| int | cp_ln_fg |
| int | cp_nt |
| int | cp_nt_hl |
| int | cp_nt_hl_rev |
| int | cp_nt_rev |
| int | cp_red |
| int | cp_title |
| int | cp_yellow |
| struct termios shell_err_tioctl | curses_err_tioctl |
| struct termios shell_in_tioctl | curses_in_tioctl |
| struct termios shell_out_tioctl | curses_out_tioctl |
| struct termios shell_tioctl | curses_tioctl |
| cchar_t | da |
| int | dbgfd |
| char | em0 [MAXLEN] |
| char | em1 [MAXLEN] |
| char | em2 [MAXLEN] |
| char | em3 [MAXLEN] |
| char | errmsg [] |
| int | exit_code |
| bool | f_curses_open |
| bool | f_debug |
| bool | f_have_curses_tioctl |
| bool | f_have_shell_tioctl |
| bool | f_restore_screen |
| char | fn [MAXLEN] |
| cchar_t | la |
| cchar_t | ls |
| cchar_t | lt |
| int | mbegx |
| int | mbegy |
| int | mcols |
| int | mg_action |
| int | mg_col |
| int | mg_line |
| int | mlines |
| WINDOW * | mouse_win |
| int | n_cols |
| int | n_lines |
| PANEL * | panel_box [MAXWIN] |
| PANEL * | panel_win [MAXWIN] |
| PANEL * | panel_win2 [MAXWIN] |
| cchar_t | ra |
| cchar_t | ran |
| cchar_t | rs |
| cchar_t | rt |
| SCREEN * | screen |
| volatile sig_atomic_t | sig_received |
| cchar_t | sp |
| int | src_line |
| char * | src_name |
| char | stdio_names_str [MAXLEN] |
| cchar_t | tl |
| cchar_t | tr |
| cchar_t | ts |
| int | tty_fd |
| FILE * | tty_fp |
| cchar_t | ua |
| int | wait_timeout |
| int | win_attr |
| int | win_attr_even |
| int | win_attr_odd |
| WINDOW * | win_box [MAXWIN] |
| int | win_ptr |
| WINDOW * | win_win [MAXWIN] |
| WINDOW * | win_win2 [MAXWIN] |
| #define __atexit |
This macro registers the end_pgm function to be called when the program exits.
It checks the return value of atexit() to ensure that the registration was successful, and if not, it prints an error message and exits with a failure status. Programs using libcm should call __atexit in their main function to ensure that the end_pgm function is registered to be called on program exit. This will help ensure that the terminal is properly restored to its original state, even if the program encounters an error or is terminated unexpectedly.
Definition at line 297 of file cm.h.
| #define ABS | ( | x | ) |
ABS macro for absolute value, which evaluates the expression once and returns the absolute value.
This macro uses a compound statement to create a local scope for the temporary variable _a, which stores the value of x. This ensures that if x has side effects (such as being incremented), it will only be evaluated once when the macro is expanded. The use of typeof allows the macro to work with any data type that supports comparison with zero and negation.
Definition at line 137 of file cm.h.
| #define BW_HO L'\x2500' |
| #define CHYRON_KEY_MAXLEN 64 |
| #define CHYRON_KEYS 20 |
| #define COLOR_LEN 8 |
Include Exclude
---------- ----------
LF_FIFO 1 0 00000001 7 11111110 named pipe LF_CHR 2 1 00000010 6 11111101 character device LF_DIR 4 2 00000100 5 11111011 directory LF_BLK 8 3 00001000 4 11110111 block device LF_REG 16 4 00010000 3 11101111 regular file LF_LNK 32 5 00100000 2 11011111 link LF_SOCK 64 6 01000000 1 10111111 socket LF_UNKNOWN 128 7 10000000 0 01111111 unknown length of color code strings
| #define KEY_ALTINS 0x223 |
EXTENDED NCURSES KEYS
Key code bindings are customarily defined in terminfo. xterm-256color tends to be the most complete, and indeed, it seems to work with Ghostty, Kitty, and Alacritty. If you want to use the altkey bindings, you may need to set your terminal's TERM environment variable to xterm-256color. Here's why:
Ghostty, Kitty, and Alacritty all come with their own terminfo files:
Ghostty with xterm-ghostty, Kitty with xterm-kitty, and Alacritty with alacritty
None of the three produced the correct extended altkey bindings when paired with the terminfo provided in their distribution, yet all three worked with xterm-256color.
The extended altkeys were not defined in any of the terminfo files, not even xterm-256color. Yet, xterm-256color produced consistent keycode bindings with all three emulators. The standard key bindings, ins, delete, up, down arrows, etc., were the same for all three terminfos, and all three emulators produced the correct key bindings for those keys.
The fact that xterm-256color produced consistent keycode bindings for the altkeys, while the other three terminfos did not, is likely due to the fact that xterm-256color is more widely used and has better support for extended key bindings, even if they are not explicitly defined in the terminfo file. It's possible that xterm-256color has some default behavior or fallback mechanism that allows it to recognize and produce key codes for the altkeys, while the other terminfos do not have such a mechanism in place. This could explain why xterm-256color produced consistent keycode bindings for the altkeys across all three emulators, while the other terminfos did not.
| #define MAX | ( | a, | |
| b ) |
MIN macro for compatibility with code that uses the same name, while avoiding multiple evaluations of the arguments.
/usr/include/sys/param.h contains implementations of the MIN and MAX macros, which are simple but can lead to issues with multiple evaluations of the arguments if they have side effects. These macros provides a safer alternative to param.h Here are the macros from /usr/include/sys/param.h. You may comment out the macros defined herein and use the macros in param.h if you prefer.
| #define max | ( | a, | |
| b ) |
max macro evaluates two expressions, returning greatest result.
These macros use compound statements to create local scopes for the temporary variables _x and _y, which store the values of x and y, respectively. This ensures that if x or y have side effects (such as being incremented), they will only be evaluated once when the macro is expanded. The use of typeof allows the macro to work with any data type. The line (void)(&_x == &_y) is a compile-time check to ensure that the types of the arguments are compatible. This implementation of the min and max macros provides a safer and more robust way to determine the minimum and maximum values between two expressions without risking unintended consequences from multiple evaluations.
| #define MAX_ARGS 64 |
| #define MIN | ( | x, | |
| y ) |
| #define min | ( | x, | |
| y ) |
| #define SCR_COLS 1024 |
| #define to_lowercase | ( | c | ) |
to_lowercase(c) - convert an uppercase letter to lowercase
| #define to_uppercase | ( | c | ) |
to_uppercase(c) - convert a lowercase letter to uppercase
simple macro to convert a character to uppercase
| #define to_uppercase | ( | c | ) |
to_uppercase(c) - convert a lowercase letter to uppercase
simple macro to convert a character to uppercase
| #define XTERM_256COLOR |
| enum ColorsEnum |
Used for xterm256 color conversions.
| enum F_Type |
| enum LFFlags |
Definition at line 201 of file cm.h.
| enum LFTypes |
byte 2 - bits 16-23 File types
| Enumerator | |
|---|---|
| LF_FIFO | 1 named pipe |
| LF_CHR | 2 character device |
| LF_DIR | 4 directory |
| LF_BLK | 8 block |
| LF_REG | 16 regular file |
| LF_LNK | 32 link |
| LF_SOCK | 64 socket |
| LF_UNKNOWN | 128 unknown |
|
extern |
Definition at line 1236 of file dwin.c.
References bl, br, bs, ls, rs, tl, tr, and ts.
Referenced by bare_box_new().
|
extern |
|
extern |
Accepts input for a field in a C-Menu window.
| win | The window to accept input from |
| accept_s | The string to accept input into |
| flin | The line number of the field |
| fcol | The column number of the field |
| flen | The length of the field |
< Enter accepts the field and moves to the next field if f_erase_remainder is set, it will clear the remaining characters above and after the current cursor location
KEY_IC toggles insert mode
KEY_DC deletes character at cursor
KEY_HOME moves cursor to start of field
KEY_BACKSPACE deletes character before cursor
KEY_LEFT moves cursor left one character
KEY_RIGHT moves cursor right one character
Handles mouse events for field editing
Definition at line 51 of file cm_fields.c.
References click_x, click_y, f_erase_remainder, and vgetch().
Referenced by get_cmd_arg().
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
dump options to stdout
|
extern |
dump options to stdout
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Create a String struct with a dynamically allocated string.
| l | length of string to create including null terminator |
The returned String struct contains a dynamically allocated string of he specified length
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Trims trailing spaces from string s in place.
| s | - string to trim |
Definition at line 338 of file futil.c.
Referenced by fmt_line(), and picker().
|
extern |
|
extern |
Definition at line 1089 of file futil.c.
References fdname(), ssnprintf(), strnz__cat(), and strnz__cpy().
Referenced by destroy_pick_view(), form_process(), and view_init_input().
|
extern |
Definition at line 1064 of file futil.c.
References ssnprintf(), strnz__cat(), and strnz__cpy().
Referenced by fork_exec(), menu_cmd_processor(), and view_init_input().
|
extern |
Converts String to boolean true or false.
| s | - string to convert |
Definition at line 941 of file futil.c.
Referenced by process_config_file().
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
| cchar_t bl |
Definition at line 501 of file cm.h.
Referenced by border_draw(), init_view_boxwin(), initialize_local_colors(), message_win(), and win_resize().
| cchar_t br |
Definition at line 501 of file cm.h.
Referenced by border_draw(), init_view_boxwin(), initialize_local_colors(), message_win(), and win_resize().
| cchar_t bs |
Definition at line 501 of file cm.h.
Referenced by border_draw(), init_view_boxwin(), initialize_local_colors(), message_win(), and win_resize().
|
extern |
|
extern |
|
extern |
bottom tee
|
extern |
right piointing angle
right angle
Definition at line 152 of file dwin.c.
Referenced by initialize_local_colors().
|
extern |
cross
|
extern |
down arrow
right arrow
Definition at line 150 of file dwin.c.
Referenced by initialize_local_colors().
|
extern |
The following are the actual wchar_t variables that will hold the box drawing characters. These correspond to the above Unicode code points. By defining them as wchar_t, we can use them in the ncurses library to draw boxes and lines in the terminal. The variables are named with a "bw_" prefix to indicate that they are box (wide) drawing characters, and they will be initialized with the corresponding Unicode characters defined above. horizontal line
horizontal line
Definition at line 138 of file dwin.c.
Referenced by border_hsplit(), and initialize_local_colors().
|
extern |
left arrow
right arrow
Definition at line 148 of file dwin.c.
Referenced by initialize_local_colors().
|
extern |
left tee
Definition at line 144 of file dwin.c.
Referenced by border_hsplit(), initialize_local_colors(), and win_resize().
|
extern |
|
extern |
right piointing angle
right angle
Definition at line 151 of file dwin.c.
Referenced by initialize_local_colors().
|
extern |
right tee
Definition at line 145 of file dwin.c.
Referenced by border_hsplit(), initialize_local_colors(), and win_resize().
|
extern |
space
tee space
Definition at line 146 of file dwin.c.
Referenced by initialize_local_colors(), picker(), and win_resize().
|
extern |
|
extern |
|
extern |
top tee
|
extern |
up arrow
right arrow
Definition at line 149 of file dwin.c.
Referenced by initialize_local_colors().
|
extern |
|
extern |
blue background
Definition at line 217 of file dwin.c.
Referenced by check_panels(), and initialize_local_colors().
|
extern |
indicator colors
Definition at line 199 of file dwin.c.
Referenced by bare_box_new(), box_hsplit_new(), init_view_boxwin(), initialize_local_colors(), message_win(), and win_resize().
|
extern |
left bracket
left field bracket
Definition at line 494 of file cm.h.
Referenced by initialize_local_colors().
|
extern |
right bracket
right field bracket
Definition at line 495 of file cm.h.
Referenced by initialize_local_colors().
|
extern |
Definition at line 202 of file dwin.c.
Referenced by initialize_local_colors().
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
green background
Definition at line 215 of file dwin.c.
Referenced by check_panels(), and initialize_local_colors().
|
extern |
box colors
Definition at line 200 of file dwin.c.
Referenced by get_cmd_char(), and initialize_local_colors().
|
extern |
Definition at line 201 of file dwin.c.
Referenced by init_view_boxwin(), init_view_full_screen(), and initialize_local_colors().
|
extern |
C-Menu normal text
Definition at line 204 of file dwin.c.
Referenced by display_prompt(), get_cmd_arg(), init_view_boxwin(), init_view_full_screen(), initialize_local_colors(), menu_cmd_processor(), popup_ckeys(), reverse_object(), unreverse_object(), win2_new(), win_new(), and win_resize().
|
extern |
|
extern |
|
extern |
reverse
Definition at line 205 of file dwin.c.
Referenced by display_prompt(), get_cmd_arg(), initialize_local_colors(), menu_cmd_processor(), popup_ckeys(), and reverse_object().
|
extern |
red background
Definition at line 214 of file dwin.c.
Referenced by check_panels(), and initialize_local_colors().
|
extern |
curses default reverse
|
extern |
|
extern |
| cchar_t chk |
Definition at line 631 of file cm.h.
Referenced by initialize_local_colors(), picker(), remove_right_angle(), reverse_object(), toggle_object(), and unreverse_object().
|
extern |
the x coordinate of a mouse click
Definition at line 81 of file dwin.c.
Referenced by cf_accept(), dxwgetch(), field_editor(), form_post(), form_process(), menu_cmd_processor(), picker(), and xwgetch().
|
extern |
the y coordinate of a mouse click
Definition at line 80 of file dwin.c.
Referenced by cf_accept(), dxwgetch(), field_editor(), form_post(), form_process(), menu_cmd_processor(), picker(), and xwgetch().
|
extern |
number of colors used
Definition at line 195 of file dwin.c.
Referenced by init_clr_palette(), and rgb_to_curses_clr().
|
extern |
current color index
|
extern |
number of color pairs supported by the terminal
Definition at line 197 of file dwin.c.
Referenced by get_clr_pair().
|
extern |
|
extern |
Definition at line 54 of file futil.c.
Referenced by open_cmenu_log(), write_cmenu_log(), and write_cmenu_log_nt().
|
extern |
|
extern |
Color names for .minitrc overrides.
color codes for the 16 basic colors
colors_text
These names are used in .minitrc to specify color overrides The order of these names corresponds to the ColorsEnum values
Definition at line 133 of file dwin.c.
Referenced by clr_name_to_idx(), and list_colors().
|
extern |
blue background color pair index
Definition at line 194 of file dwin.c.
Referenced by initialize_local_colors().
|
extern |
bold color pair index
|
extern |
box color pair index
Definition at line 179 of file dwin.c.
Referenced by border_hsplit_text(), initialize_local_colors(), and picker().
|
extern |
color pair index for field brackets
Definition at line 190 of file dwin.c.
Referenced by init_form(), and initialize_local_colors().
|
extern |
command line number background color pair index
|
extern |
command line number color pair index
|
extern |
default color pair index
|
extern |
fill character color pair index
Definition at line 189 of file dwin.c.
Referenced by form_display_fields(), and initialize_local_colors().
|
extern |
green background color pair index
Definition at line 192 of file dwin.c.
Referenced by initialize_local_colors().
|
extern |
highlight color pair index
|
extern |
indicator color pair index
Definition at line 180 of file dwin.c.
Referenced by initialize_local_colors().
|
extern |
line number background color pair index
|
extern |
line number color pair index
|
extern |
normal color pair index
Definition at line 183 of file dwin.c.
Referenced by fmt_line(), form_display_field(), form_display_fields(), and initialize_local_colors().
|
extern |
highlight color pair index
Definition at line 185 of file dwin.c.
Referenced by initialize_local_colors(), menu_cmd_processor(), and menu_engine().
|
extern |
highlight reverse color pair index
Definition at line 186 of file dwin.c.
Referenced by field_editor(), form_engine(), initialize_local_colors(), menu_cmd_processor(), and picker().
|
extern |
reverse color pair index
Definition at line 184 of file dwin.c.
Referenced by compile_chyron(), field_editor(), initialize_local_colors(), picker(), search(), and set_chyron_key().
|
extern |
red background color pair index
Definition at line 191 of file dwin.c.
Referenced by initialize_local_colors().
|
extern |
title color pair index
Definition at line 182 of file dwin.c.
Referenced by border_title(), and initialize_local_colors().
|
extern |
yellow background color pair index
Definition at line 193 of file dwin.c.
Referenced by initialize_local_colors().
|
extern |
Definition at line 37 of file scriou.c.
Referenced by capture_curses_tioctl(), and restore_curses_tioctl().
|
extern |
Definition at line 35 of file scriou.c.
Referenced by capture_curses_tioctl(), and restore_curses_tioctl().
|
extern |
Definition at line 36 of file scriou.c.
Referenced by capture_curses_tioctl(), and restore_curses_tioctl().
|
extern |
Definition at line 34 of file scriou.c.
Referenced by dxwgetch(), vgetch(), and xwgetch().
| cchar_t da |
Definition at line 631 of file cm.h.
Referenced by initialize_local_colors().
|
extern |
the file descriptor for debug output, for debugging purposes
|
extern |
error message string for error messages
Definition at line 175 of file dwin.c.
Referenced by action_disposition(), dxwgetch(), enter_file_spec(), form_desc_error(), form_parse_desc(), form_process(), form_read_data(), form_write(), get_clr_pair(), handle_signal(), init_view_boxwin(), init_view_full_screen(), mk_dir(), new_init(), new_pick(), new_view(), open_cmenu_log(), pad_refresh(), parse_menu_description(), popup_ckeys(), verify_dir(), verify_file(), view_cmd_processor(), view_init_input(), waitpid_with_timeout(), write_view_buffer(), and xwgetch().
|
extern |
error message string for error messages
Definition at line 176 of file dwin.c.
Referenced by dxwgetch(), enter_file_spec(), form_desc_error(), form_parse_desc(), form_process(), form_read_data(), form_write(), get_clr_pair(), handle_signal(), mk_dir(), new_init(), new_pick(), new_view(), parse_menu_description(), popup_ckeys(), verify_dir(), verify_file(), view_cmd_processor(), view_init_input(), write_cmenu_log(), write_view_buffer(), and xwgetch().
|
extern |
error message string for error messages
Definition at line 177 of file dwin.c.
Referenced by dxwgetch(), enter_file_spec(), form_desc_error(), form_parse_desc(), form_process(), form_read_data(), form_write(), get_clr_pair(), handle_signal(), mk_dir(), new_init(), new_view(), parse_menu_description(), popup_ckeys(), verify_dir(), verify_file(), view_cmd_processor(), view_init_input(), write_view_buffer(), and xwgetch().
|
extern |
error message string for error messages
Definition at line 178 of file dwin.c.
Referenced by verify_dir(), and verify_file().
|
extern |
|
extern |
curses mode is active
Definition at line 33 of file sig.c.
Referenced by action_disposition(), answer_yn(), destroy_curses(), display_error(), handle_signal(), message_win(), open_curses(), Perror(), ui_init(), ui_shutdown(), and wait_mk_win().
|
extern |
a flag to indicate whether debug output should be printed, for debugging purposes
|
extern |
curses tioctl captured
Definition at line 25 of file scriou.c.
Referenced by capture_curses_tioctl(), and restore_curses_tioctl().
|
extern |
shell tioctl captured
Definition at line 24 of file scriou.c.
Referenced by capture_shell_tioctl(), and restore_shell_tioctl().
|
extern |
whether to restore the screen
|
extern |
function name for error messages
Definition at line 174 of file dwin.c.
Referenced by verify_dir(), and verify_file().
| cchar_t la |
Definition at line 631 of file cm.h.
Referenced by initialize_local_colors().
|
extern |
Definition at line 631 of file cm.h.
Referenced by border_draw(), init_view_boxwin(), initialize_local_colors(), message_win(), and win_resize().
| cchar_t lt |
Definition at line 631 of file cm.h.
Referenced by border_hsplit_text(), border_title(), and initialize_local_colors().
|
extern |
beginning x coordinate of the current window, which can be used to determine the position of the window on the terminal screen.
|
extern |
beginning y coordinate of the current window, which can be used to determine the position of the window on the terminal screen.
|
extern |
number of columns in the current window, which may be less than the total number of columns in the terminal if the window is resized or if multiple windows are being used.
|
extern |
action in progress, which can be used to keep track of the current state of the program and determine how to respond to user input or other events.
|
extern |
window column, which can be used to determine the current column position in the window for displaying text or other content.
|
extern |
window line, which can be used to determine the current line position in the window for displaying text or other content.
|
extern |
number of lines in the current window, which may be less than the total number of lines in the terminal if the window is resized or if multiple windows are being used.
|
extern |
|
extern |
number of columns in the terminal
|
extern |
number of lines in the terminal
|
extern |
Definition at line 57 of file dwin.c.
Referenced by bare_box_new(), check_panels(), destroy_curses(), open_curses(), and win_del().
|
extern |
Definition at line 56 of file dwin.c.
Referenced by check_panels(), win_del(), and win_new().
|
extern |
Definition at line 55 of file dwin.c.
Referenced by check_panels(), win2_new(), and win_del().
| cchar_t ra |
Definition at line 631 of file cm.h.
Referenced by initialize_local_colors().
| cchar_t ran |
Definition at line 631 of file cm.h.
Referenced by get_cmd_arg(), get_cmd_char(), initialize_local_colors(), picker(), and reverse_object().
| cchar_t rs |
Definition at line 501 of file cm.h.
Referenced by border_draw(), init_view_boxwin(), initialize_local_colors(), message_win(), and win_resize().
| cchar_t rt |
Definition at line 631 of file cm.h.
Referenced by border_hsplit_text(), border_title(), and initialize_local_colors().
|
extern |
Definition at line 42 of file dwin.c.
Referenced by destroy_curses(), open_curses(), ui_init(), and ui_shutdown().
|
extern |
Definition at line 31 of file sig.c.
Referenced by dxwgetch(), handle_signal(), popup_ckeys(), signal_handler(), and xwgetch().
| cchar_t sp |
Definition at line 631 of file cm.h.
Referenced by border_hsplit_text(), border_title(), deselect_object(), get_cmd_char(), initialize_local_colors(), picker(), remove_right_angle(), toggle_object(), unreverse_object(), and view_cmd_processor().
|
extern |
the line number of the source file being processed, for error messages
Definition at line 172 of file dwin.c.
Referenced by verify_dir(), and verify_file().
|
extern |
the name of the source file being processed, for error messages
Definition at line 173 of file dwin.c.
Referenced by verify_dir(), and verify_file().
|
extern |
Definition at line 134 of file futil.c.
Referenced by destroy_pick_view(), fork_exec(), form_process(), menu_cmd_processor(), and view_init_input().
| cchar_t tl |
Definition at line 501 of file cm.h.
Referenced by border_draw(), border_title(), init_view_boxwin(), initialize_local_colors(), message_win(), and win_resize().
| cchar_t tr |
Definition at line 501 of file cm.h.
Referenced by border_draw(), init_view_boxwin(), initialize_local_colors(), message_win(), and win_resize().
| cchar_t ts |
Definition at line 501 of file cm.h.
Referenced by border_draw(), border_hsplit_text(), border_title(), init_view_boxwin(), initialize_local_colors(), message_win(), and win_resize().
|
extern |
|
extern |
Definition at line 43 of file dwin.c.
Referenced by destroy_curses(), open_curses(), ui_init(), and ui_shutdown().
| cchar_t ua |
Definition at line 631 of file cm.h.
Referenced by initialize_local_colors().
|
extern |
Definition at line 152 of file futil.c.
Referenced by form_process(), process_config_file(), and write_config().
|
extern |
|
extern |
Ncurses attributes for the current window even lines, which may be different from the attributes for odd lines to create a striped effect in the window.
|
extern |
Ncurses attributes for the current window odd lines, which may be different from the attributes for even lines to create a striped effect in the window.
|
extern |
array of pointers to box windows
Definition at line 53 of file dwin.c.
Referenced by bare_box_new(), box_hsplit_new(), check_panels(), destroy_curses(), display_form(), open_curses(), open_pick_win(), restore_wins(), win2_new(), win_del(), win_new(), and win_resize().
|
extern |
Pointer to the current window pair, box and window, which can be used to keep track of the currently active window and its associated box.
Definition at line 164 of file dwin.c.
Referenced by action_disposition(), answer_yn(), bare_box_new(), box_hsplit_new(), destroy_curses(), display_error(), display_form(), menu_cmd_processor(), menu_engine(), open_curses(), open_pick_win(), Perror(), popup_ckeys(), restore_wins(), ui_init(), wait_mk_win(), win2_new(), win_del(), win_new(), and win_resize().
|
extern |
array of pointers to windows
Definition at line 52 of file dwin.c.
Referenced by action_disposition(), answer_yn(), check_panels(), destroy_curses(), display_error(), display_form(), menu_cmd_processor(), menu_engine(), open_curses(), open_pick_win(), Perror(), popup_ckeys(), restore_wins(), wait_mk_win(), win_del(), win_new(), and win_resize().
|
extern |
array of pointers to windows
Definition at line 51 of file dwin.c.
Referenced by check_panels(), destroy_curses(), open_curses(), open_pick_win(), restore_wins(), win2_new(), and win_del().