C-Menu 0.2.9
A User Interface Toolkit
Loading...
Searching...
No Matches
cm.h File Reference

Headder for C-Menu API library, libcm.so. More...

#include "version.h"
#include <ncursesw/ncurses.h>
#include <signal.h>
#include <stddef.h>
#include <stdlib.h>
Include dependency graph for cm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ChyronKey
struct  Chyron
struct  RGB
struct  ColorPair
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  String
 The String structure represents a string object with a pointer to the string and its allocated length. More...
struct  WCStr
 wide character string object with a pointer to the wide character string and its allocated length More...
struct  CCStr
 complex character objectl with a pointer to the complex character string and its allocated length More...
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...

Macros

#define _XOPEN_SOURCE_EXTENDED   1
#define NCURSES_WIDECHAR   1
#define _GNU_SOURCE
#define nullptr   NULL
#define MAX_ARGS   64
#define MAXLEN   256
#define MAXARGS   64
#define SCR_COLS   1024
#define MAX_DEPTH   3
#define Ctrl(c)
#define max(a, b)
 max macro evaluates two expressions, returning greatest result.
#define min(x, y)
 min macro evaluates two expressions, returning least result
#define MAX(a, b)
 MIN macro for compatibility with code that uses the same name, while avoiding multiple evaluations of the arguments.
#define MIN(x, y)
 MAX macro for compatibility with code that uses the same name, while avoiding multiple evaluations of the arguments.
#define ABS(x)
 ABS macro for absolute value, which evaluates the expression once and returns the absolute value.
#define S_TOLOWER(c)
#define S_TOUPPER(c)
#define COLOR_LEN   8
#define DEFAULTSHELL   "/bin/bash"
#define S_WCOK   0x1000
#define S_QUIET   0x2000
#define __atexit
 This macro registers the end_pgm function to be called when the program exits.
#define CHYRON_KEY_MAXLEN   64
#define CHYRON_KEYS   20
#define FG_COLOR   2
#define BG_COLOR   0
#define BO_COLOR   1
#define LN_COLOR   4
#define LN_BG_COLOR   7
#define KEY_ALTF0   0x138
#define KEY_ALTF(n)
#define XTERM_256COLOR
#define KEY_ALTINS   0x223
#define KEY_ALTHOME   0x21e
#define KEY_ALTPGUP   0x232
#define KEY_ALTDEL   0x20e
#define KEY_ALTEND   0x219
#define KEY_ALTPGDN   0x22d
#define KEY_ALTUP   0x23d
#define KEY_ALTLEFT   0x228
#define KEY_ALTDOWN   0x214
#define KEY_ALTRIGHT   0x237
#define BW_HO   L'\x2500'
#define BW_VE   L'\x2502'
#define BW_TL   L'\x250C'
#define BW_TR   L'\x2510'
#define BW_BL   L'\x2514'
#define BW_BR   L'\x2518'
#define BW_RTL   L'\x256d'
#define BW_RTR   L'\x256e'
#define BW_RBL   L'\x2570'
#define BW_RBR   L'\x256f'
#define BW_LT   L'\x251C'
#define BW_TT   L'\x252C'
#define BW_RT   L'\x2524'
#define BW_CR   L'\x253C'
#define BW_BT   L'\x2534'
#define BW_SP   L'\x20'
#define MAXWIN   30
#define to_uppercase(c)
#define to_lowercase(c)
#define to_uppercase(c)

Typedefs

typedef unsigned char uchar

Enumerations

enum  colors_enum {
  CLR_BLACK , CLR_RED , CLR_GREEN , CLR_YELLOW ,
  CLR_BLUE , CLR_MAGENTA , CLR_CYAN , CLR_WHITE ,
  CLR_BBLACK , CLR_BRED , CLR_BGREEN , CLR_BYELLOW ,
  CLR_BBLUE , CLR_BMAGENTA , CLR_BCYAN , CLR_BWHITE ,
  CLR_BORANGE , CLR_FG , CLR_BG , CLR_BO ,
  CLR_LN , CLR_LN_BG , CLR_NCOLORS
}
enum  LFFlags {
  LF_HIDE = 0b00000001 , LF_ICASE = 0b00000010 , LF_EXC_REGEX = 0b00000100 , LF_REGEX = 0b00001000 ,
  LF_EXEC = 0b00010000 , LF_USER = 0b00100000 , LF_SETUID = 0b10000000 , LF_SETGID = 0b01000000 ,
  LF_PERM_R = 0b00100001 , LF_PERM_W = 0b00010000 , LF_PERM_X = 0b00001000
}
enum  FTypes {
  FT_BLK = 0b00000001 , FT_CHR = 0b00000010 , FT_DIR = 0b00000100 , FT_FIFO = 0b00001000 ,
  FT_LNK = 0b00010000 , FT_REG = 0b00100000 , FT_SOCK = 0b01000000 , FT_UNKNOWN = 0b10000000
}

Functions

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.
Chyronwait_mk_chyron ()
 Create a Chyron struct for the waiting message.
WINDOW * wait_mk_win (Chyron *, char *)
 Display a popup waiting message.
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.
bool waitpid_with_timeout (pid_t, int)
bool action_disposition (char *title, char *action_str)
void dump_opts ()
void dump_opts_by_use (char *, char *)
bool capture_shell_tioctl ()
 capture_shell_tioctl() - capture shell terminal settings
bool restore_shell_tioctl ()
 restore_shell_tioctl() - restore shell terminal settings
bool capture_curses_tioctl ()
 capture_curses_tioctl() - capture curses terminal settings
bool restore_curses_tioctl ()
 restore_curses_tioctl() - restore curses terminal settings
bool mk_raw_tioctl (struct termios *)
 mk_raw_tioctl() - set terminal to raw mode
bool set_sane_tioctl (struct termios *)
 set_sane_tioctl() - set terminal to sane settings for C-MENU
int box_new (int, int, int, int, char *, bool)
 Create a new window with optional box and title.
int win_new (int, int, int, int)
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 signal_handler (int)
 Signal handler for interrupt signals.
bool handle_signal (sig_atomic_t)
void sig_prog_mode ()
 Set up signal handlers for interrupt signals.
void sig_dfl_mode ()
 Set signal handlers to default behavior.
bool mk_dir (char *dir)
 If directory doesn't exist, make it.
int segmentation_fault ()
 Function to intentionally cause a segmentation fault for testing purposes.
void write_cmenu_log_nt (char *)
 Write message to C-Menu log file without timestamp.
void write_cmenu_log (char *)
 Write message to C-Menu log file with timestamp.
void open_cmenu_log ()
 Open new C-Menu log file.
void sig_shell_mode ()
char di_getch ()
 sget single character from terminal in raw mode
int enter_option ()
WINDOW * win_del ()
 Delete the current window and its associated box window.
void destroy_win (WINDOW *)
void destroy_box (WINDOW *)
void restore_wins ()
 Restore all windows after a screen resize.
void cbox (WINDOW *)
 Draw a box around the specified window.
void win_init_attrs ()
 Initialize window attributes.
void win_Toggle_Attrs ()
void mvwaddstr_fill (WINDOW *, int, int, char *, int)
 For lines shorter than their display area, fill the rest with spaces.
int display_curses_keys ()
void init_stdscr ()
void curskeys (WINDOW *)
void mouse_getch (int *, int *, int *, int *)
void w_mouse_getch (WINDOW *, int *, int *, int *, int *)
void destroy_curses ()
 Gracefully shut down NCurses and restore terminal settings.
int a_toi (char *, bool *)
 a safer alternative to atoi() for converting ASCII strings to integers.
bool chrep (char *, char, char)
 Replaces all occurrences of old_chr in s with new_chr in place.
char * rep_substring (const char *, const char *, const char *)
 Replace all occurrences of "tgt_s" in "org_s" with "rep_s".
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
int str_to_args (char **, char *, int)
 Converts a string into an array of argument strings.
void destroy_argv (int argc, char **argv)
 Deallocates memory allocated for argument strings in argv.
bool str_to_bool (const char *)
 Converts String to boolean true or false.
bool str_to_lower (char *)
 Converts a string to lowercase.
bool str_to_upper (char *)
 Converts a string to uppercase.
bool strnfill (char *, char, int)
 Fills string s with character c n.
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.
size_t strnz (char *, size_t)
 terminates string at New Line, Carriage Return, or max_len
size_t strnlf (char *, size_t)
 terminates string with line feed
char * strnz_dup (char *, size_t)
 Allocates memory for and duplicates string s up to length l or until line feed or carriage return.
size_t ssnprintf (char *, size_t, const char *,...)
 ssnprintf was designed to be a safer alternative to snprintf.
size_t strnz__cpy (char *, const char *, size_t)
 safer alternative to strncpy
size_t strnz__cat (char *, const char *, size_t)
 safer alternative to strncat
double str_to_double (char *)
 converts string to double
size_t string_cpy (String *, const String *)
 Copy src String to dest String, allocating additional memory for dest String if necessary.
size_t string_cat (String *, const String *)
 Concatenates 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 trim (char *)
 Trims leading and trailing spaces from string s in place.
size_t rtrim (char *)
 Trims trailing spaces from string s in place.
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.
String mk_string (size_t)
 Create a String struct with a dynamically allocated string.
String free_string (String)
 Free the dynamically allocated String.
void apply_gamma (RGB *)
 Apply gamma correction to RGB color.
int get_clr_pair (int, int)
 Get color pair index for foreground and background colors.
int clr_name_to_idx (char *)
 Get color index from color name.
int rgb_to_xterm256_idx (RGB *)
 Convert RGB color to XTerm 256 color index.
bool init_clr_palette (SIO *)
 Initialize color palette based on SIO settings.
bool open_curses (SIO *)
 Initialize NCurses and color settings.
int rgb_clr_to_cube (int)
int rgb_to_curses_clr (RGB *)
 Get color index for RGB color.
RGB xterm256_idx_to_rgb (int)
 Convert XTerm 256 color index to RGB color.
int fork_exec (char **)
 Fork and exec a command.
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.
int shell (char *)
 Execute a shell command.
void get_rfc3339_s (char *, size_t)
int open_log (char *)
void write_log (char *)
void compile_chyron (Chyron *)
 construct the chyron string from the chyron structure
void display_chyron (WINDOW *, Chyron *, int, int)
int get_chyron_key (Chyron *, int)
 Get keycode from chyron.
bool is_set_chyron_key (Chyron *, int)
 Check if function key label is set.
void set_chyron_key (Chyron *, int, char *, int)
void set_chyron_key_cp (Chyron *, int, char *, int, int)
 Set chyron key.
void unset_chyron_key (Chyron *, int)
 Unset chyron key.
Chyronnew_chyron ()
 Create and initialize Chyron structure.
Chyrondestroy_chyron (Chyron *chyron)
 Destroy Chyron structure.
void abend (int, char *)
 Abnormal program termination.
void display_argv_error_msg (char *, char **)
int display_error (char *, char *, char *, char *)
 Display an error message window or print to stderr.
int answer_yn (char *, char *, char *, char *)
 Accept a single letter answer.
int display_ok_message (char *)
int Perror (char *)
 Display a simple error message window or print to stderr.
void user_end ()
bool lf_find (const char *, const char *, const char *, int, long, time_t, time_t, intmax_t)
 Find files in a directory matching a regular expression.
unsigned long long a_to_ull (const char *)
size_t canonicalize_file_spec (char *)
 Removes quotes and trims at first space.
bool construct_file_spec (char *, char *, char *, char *, char *, int)
bool file_spec_path (char *, char *)
 extracts the path component of a file specification
bool file_spec_name (char *, char *)
 extracts the file name component of a file specification
bool is_directory (const char *)
 Checks if the given path is a directory.
bool is_valid_regex (const char *)
 Checks if the given regular expression pattern is valid.
bool dir_name (char *, char *)
 Returns the directory name of a file specification.
bool base_name (char *, char *)
 Returns the base name of a file specification.
bool expand_tilde (char *, int)
 Replace Leading Tilde With Home Directory.
bool locate_file_in_path (char *, char *)
 Locates a file in the system PATH.
bool normalize_file_spec (char *)
 replace backslashes with forward lashes
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.
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_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_spec_arg (char *, char *, char *, char *, int)
 Verify file specification argument.

Variables

int cmenu_log_fd
int click_y
int click_x
int wait_timeout
bool f_debug
unsigned int cmd_key
int cp_default
int cp_norm
int cp_win
int cp_box
int cp_bold
int cp_title
int cp_highlight
int cp_reverse
int cp_reverse_highlight
int cp_ln
int cp_ln_bg
int clr_idx
int clr_cnt
int clr_pair_idx
int clr_pair_cnt
char const colors_text [][10]
struct termios shell_tioctl curses_tioctl
struct termios shell_in_tioctl curses_in_tioctl
struct termios shell_out_tioctl curses_out_tioctl
struct termios shell_err_tioctl curses_err_tioctl
bool f_have_shell_tioctl
bool f_have_curses_tioctl
bool f_curses_open
bool f_restore_screen
volatile sig_atomic_t sig_received
cchar_t CCC_NORM
cchar_t CCC_WIN
cchar_t CCC_BOX
cchar_t CCC_REVERSE
cchar_t CCC_LN
const wchar_t bw_ho
const wchar_t bw_ve
const wchar_t bw_tl
const wchar_t bw_tr
const wchar_t bw_bl
const wchar_t bw_br
const wchar_t bw_lt
const wchar_t bw_rt
const wchar_t bw_sp
const wchar_t bw_tt
const wchar_t bw_cr
const wchar_t bw_bt
FILE * cmenu_log_fp
int n_lines
int n_cols
int lines
int cols
int begx
int begy
WINDOW * win
WINDOW * win_win [MAXWIN]
WINDOW * win_box [MAXWIN]
int win_attr
int win_attr_odd
int win_attr_even
int win_ptr
bool win_pair
int mlines
int mcols
int mbegy
int mbegx
int mg_action
int mg_col
int mg_line
int eargc
char earg_str [MAXLEN]
char * eargv [MAXARGS]
int tty_fd
int dbgfd
int src_line
char * src_name
char fn [MAXLEN]
char em0 [MAXLEN]
char em1 [MAXLEN]
char em2 [MAXLEN]
char em3 [MAXLEN]
int exit_code
char errmsg []

Detailed Description

Headder for C-Menu API library, libcm.so.

Author
Bill Waller Copyright (c) 2025 MIT License billx.nosp@m.wall.nosp@m.er@gm.nosp@m.ail..nosp@m.com
Date
2026-02-09

Definition in file cm.h.

Macro Definition Documentation

◆ __atexit

#define __atexit
Value:
{ \
int rc; \
rc = atexit(end_pgm); \
if (rc != 0) { \
fprintf(stderr, "\nCannot set exit function\n"); \
exit(EXIT_FAILURE); \
} \
}

This macro registers the end_pgm function to be called when the program exits.

Note
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 202 of file cm.h.

202#define __atexit \
203 { \
204 int rc; \
205 rc = atexit(end_pgm); \
206 if (rc != 0) { \
207 fprintf(stderr, "\nCannot set exit function\n"); \
208 exit(EXIT_FAILURE); \
209 } \
210 }

◆ _GNU_SOURCE

#define _GNU_SOURCE

Definition at line 15 of file cm.h.

◆ _XOPEN_SOURCE_EXTENDED

#define _XOPEN_SOURCE_EXTENDED   1

Enable wide character support

Definition at line 13 of file cm.h.

◆ ABS

#define ABS ( x)
Value:
({ \
__typeof__(x) _a = (x); \
_a < 0 ? -_a : _a; \
})

ABS macro for absolute value, which evaluates the expression once and returns the absolute value.

Note
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 103 of file cm.h.

103#define ABS(x) \
104 ({ \
105 __typeof__(x) _a = (x); \
106 _a < 0 ? -_a : _a; \
107 })

◆ BG_COLOR

#define BG_COLOR   0

default background color

Definition at line 280 of file cm.h.

◆ BO_COLOR

#define BO_COLOR   1

default bold foreground color

Definition at line 281 of file cm.h.

◆ BW_BL

#define BW_BL   L'\x2514'

bottom left

Definition at line 436 of file cm.h.

◆ BW_BR

#define BW_BR   L'\x2518'

bottom right

Definition at line 437 of file cm.h.

◆ BW_BT

#define BW_BT   L'\x2534'

bottom tee

Definition at line 446 of file cm.h.

◆ BW_CR

#define BW_CR   L'\x253C'

cross

Definition at line 445 of file cm.h.

◆ BW_HO

#define BW_HO   L'\x2500'

UNICODE BOX DRAWING SYMBOLS horizontal line

Definition at line 432 of file cm.h.

◆ BW_LT

#define BW_LT   L'\x251C'

left tee

Definition at line 442 of file cm.h.

◆ BW_RBL

#define BW_RBL   L'\x2570'

rounded bottom left

Definition at line 440 of file cm.h.

◆ BW_RBR

#define BW_RBR   L'\x256f'

rounded bottom right

Definition at line 441 of file cm.h.

◆ BW_RT

#define BW_RT   L'\x2524'

right tee

Definition at line 444 of file cm.h.

◆ BW_RTL

#define BW_RTL   L'\x256d'

rounded left tee

Definition at line 438 of file cm.h.

◆ BW_RTR

#define BW_RTR   L'\x256e'

rounded right tee

Definition at line 439 of file cm.h.

◆ BW_SP

#define BW_SP   L'\x20'

space

Definition at line 447 of file cm.h.

◆ BW_TL

#define BW_TL   L'\x250C'

top left

Definition at line 434 of file cm.h.

◆ BW_TR

#define BW_TR   L'\x2510'

top right

Definition at line 435 of file cm.h.

◆ BW_TT

#define BW_TT   L'\x252C'

top tee

Definition at line 443 of file cm.h.

◆ BW_VE

#define BW_VE   L'\x2502'

vertical line

Definition at line 433 of file cm.h.

◆ CHYRON_KEY_MAXLEN

#define CHYRON_KEY_MAXLEN   64

maximum length of the command text for a key \ binding in the chyron

Definition at line 235 of file cm.h.

235#define CHYRON_KEY_MAXLEN \
236 64

◆ CHYRON_KEYS

#define CHYRON_KEYS   20

maximum number of key bindings for the chyron

Definition at line 238 of file cm.h.

◆ COLOR_LEN

#define COLOR_LEN   8
              Include     Exclude
             ----------  ----------

LF_BLK 1 0 00000001 7 11111110 block device LF_CHR 2 1 00000010 6 11111101 character device LF_DIR 4 2 00000100 5 11111011 directory LF_FIFO 8 3 00001000 4 11110111 named pipe LF_LNK 16 4 00010000 3 11101111 link LF_REG 32 5 00100000 2 11011111 regular file LF_SOCK 64 6 01000000 1 10111111 socket LF_UNKNOWN 128 7 10000000 0 01111111 unknown length of color code strings

Definition at line 188 of file cm.h.

◆ Ctrl

#define Ctrl ( c)
Value:

Definition at line 33 of file cm.h.

◆ DEFAULTSHELL

#define DEFAULTSHELL   "/bin/bash"

Definition at line 189 of file cm.h.

◆ FG_COLOR

#define FG_COLOR   2

default foreground color

Definition at line 279 of file cm.h.

◆ KEY_ALTDEL

#define KEY_ALTDEL   0x20e

Definition at line 411 of file cm.h.

◆ KEY_ALTDOWN

#define KEY_ALTDOWN   0x214

Definition at line 416 of file cm.h.

◆ KEY_ALTEND

#define KEY_ALTEND   0x219

Definition at line 412 of file cm.h.

◆ KEY_ALTF

#define KEY_ALTF ( n)
Value:

define alt function keys

Definition at line 355 of file cm.h.

◆ KEY_ALTF0

#define KEY_ALTF0   0x138

Definition at line 354 of file cm.h.

◆ KEY_ALTHOME

#define KEY_ALTHOME   0x21e

Definition at line 409 of file cm.h.

◆ KEY_ALTINS

#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.

Definition at line 408 of file cm.h.

◆ KEY_ALTLEFT

#define KEY_ALTLEFT   0x228

Definition at line 415 of file cm.h.

◆ KEY_ALTPGDN

#define KEY_ALTPGDN   0x22d

Definition at line 413 of file cm.h.

◆ KEY_ALTPGUP

#define KEY_ALTPGUP   0x232

Definition at line 410 of file cm.h.

◆ KEY_ALTRIGHT

#define KEY_ALTRIGHT   0x237

Definition at line 417 of file cm.h.

◆ KEY_ALTUP

#define KEY_ALTUP   0x23d

Definition at line 414 of file cm.h.

◆ LN_BG_COLOR

#define LN_BG_COLOR   7

default line number background

Definition at line 283 of file cm.h.

◆ LN_COLOR

#define LN_COLOR   4

default line number color

Definition at line 282 of file cm.h.

◆ MAX

#define MAX ( a,
b )
Value:

MIN macro for compatibility with code that uses the same name, while avoiding multiple evaluations of the arguments.

Note
/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.
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.
Note
The following macro provides a safer alternative to param.h

Definition at line 78 of file cm.h.

◆ max

#define max ( a,
b )
Value:

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.

Note
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.

Definition at line 48 of file cm.h.

◆ MAX_ARGS

#define MAX_ARGS   64

maximum number of arguments for external commands

Definition at line 28 of file cm.h.

◆ MAX_DEPTH

#define MAX_DEPTH   3

default depth for recursive file searching

Definition at line 32 of file cm.h.

◆ MAXARGS

#define MAXARGS   64

maximum number of arguments

Definition at line 30 of file cm.h.

◆ MAXLEN

#define MAXLEN   256

maximum length for strings and buffers

Definition at line 29 of file cm.h.

◆ MAXWIN

#define MAXWIN   30

maximum number of windows that can be created

Definition at line 491 of file cm.h.

◆ MIN

#define MIN ( x,
y )
Value:

MAX macro for compatibility with code that uses the same name, while avoiding multiple evaluations of the arguments.

Note
The following macro provides a safer alternative to param.h

Definition at line 88 of file cm.h.

◆ min

#define min ( x,
y )
Value:

min macro evaluates two expressions, returning least result

Definition at line 55 of file cm.h.

◆ NCURSES_WIDECHAR

#define NCURSES_WIDECHAR   1

Enable wide character support

Definition at line 14 of file cm.h.

◆ nullptr

#define nullptr   NULL

Definition at line 25 of file cm.h.

◆ S_QUIET

#define S_QUIET   0x2000

quiet mode flag for file validation

Definition at line 191 of file cm.h.

◆ S_TOLOWER

#define S_TOLOWER ( c)
Value:

Definition at line 108 of file cm.h.

◆ S_TOUPPER

#define S_TOUPPER ( c)
Value:

Definition at line 113 of file cm.h.

◆ S_WCOK

#define S_WCOK   0x1000

write or create permitted

Definition at line 190 of file cm.h.

◆ SCR_COLS

#define SCR_COLS   1024

maximum number of columns in the terminal screen

Definition at line 31 of file cm.h.

◆ to_lowercase

#define to_lowercase ( c)
Value:

to_lowercase(c) - convert an uppercase letter to lowercase

Definition at line 548 of file cm.h.

◆ to_uppercase [1/2]

#define to_uppercase ( c)
Value:

to_uppercase(c) - convert a lowercase letter to uppercase

simple macro to convert a character to uppercase

Definition at line 544 of file cm.h.

◆ to_uppercase [2/2]

#define to_uppercase ( c)
Value:

to_uppercase(c) - convert a lowercase letter to uppercase

simple macro to convert a character to uppercase

Definition at line 544 of file cm.h.

◆ XTERM_256COLOR

#define XTERM_256COLOR

use xterm-256color terminfo for altkey bindings

Definition at line 356 of file cm.h.

Typedef Documentation

◆ uchar

typedef unsigned char uchar

Definition at line 492 of file cm.h.

Enumeration Type Documentation

◆ colors_enum

Note
Used for xterm256 color conversions
These colors can be overridden in ".minitrc"
Enumerator
CLR_BLACK 
CLR_RED 
CLR_GREEN 
CLR_YELLOW 
CLR_BLUE 
CLR_MAGENTA 
CLR_CYAN 
CLR_WHITE 
CLR_BBLACK 
CLR_BRED 
CLR_BGREEN 
CLR_BYELLOW 
CLR_BBLUE 
CLR_BMAGENTA 
CLR_BCYAN 
CLR_BWHITE 
CLR_BORANGE 
CLR_FG 
CLR_BG 
CLR_BO 
CLR_LN 
CLR_LN_BG 
CLR_NCOLORS 

Definition at line 122 of file cm.h.

◆ FTypes

enum FTypes

byte 2 - bits 16-23 File types

Enumerator
FT_BLK 

1 block device

FT_CHR 

2 character device

FT_DIR 

4 directory

FT_FIFO 

8 named pipe

FT_LNK 

16 link

FT_REG 

32 regular file

FT_SOCK 

64 socket

FT_UNKNOWN 

128 unknown

Definition at line 164 of file cm.h.

166 FT_CHR = 0b00000010,
167 FT_DIR = 0b00000100,
168 FT_FIFO = 0b00001000,
169 FT_LNK = 0b00010000,
170 FT_REG = 0b00100000,
171 FT_SOCK = 0b01000000,
172 FT_UNKNOWN = 0b10000000
173};
@ FT_UNKNOWN
Definition cm.h:172
@ FT_SOCK
Definition cm.h:171
@ FT_DIR
Definition cm.h:167
@ FT_FIFO
Definition cm.h:168
@ FT_REG
Definition cm.h:170
@ FT_CHR
Definition cm.h:166
@ FT_BLK
Definition cm.h:165
@ FT_LNK
Definition cm.h:169

◆ LFFlags

enum LFFlags
Enumerator
LF_HIDE 

byte 0 - bits 0-7 Selection Flags 1 Don't list hidden files

LF_ICASE 

2 Ignore case in search

LF_EXC_REGEX 

4 Exclude files matching regex

LF_REGEX 

8 Include files matching regex

LF_EXEC 

16 Execute command each file

LF_USER 

32 Select User Name

LF_SETUID 

64 Select Setuid Files

LF_SETGID 

128 Select Setgid Files

LF_PERM_R 

256 Select Files with Read Permission

LF_PERM_W 

512 Select Files with Write Permission

LF_PERM_X 

1024 Select Files with Execute Permission

Definition at line 148 of file cm.h.

148 {
150 LF_HIDE = 0b00000001,
151 LF_ICASE = 0b00000010,
152 LF_EXC_REGEX = 0b00000100,
153 LF_REGEX = 0b00001000,
154 LF_EXEC = 0b00010000,
155 LF_USER = 0b00100000,
156 LF_SETUID = 0b10000000,
157 LF_SETGID = 0b01000000,
158 LF_PERM_R = 0b00100001,
159 LF_PERM_W = 0b00010000,
160 LF_PERM_X = 0b00001000,
161};
@ LF_EXC_REGEX
Definition cm.h:152
@ LF_PERM_R
Definition cm.h:158
@ LF_PERM_W
Definition cm.h:159
@ LF_HIDE
Definition cm.h:150
@ LF_ICASE
Definition cm.h:151
@ LF_SETGID
Definition cm.h:157
@ LF_PERM_X
Definition cm.h:160
@ LF_EXEC
Definition cm.h:154
@ LF_SETUID
Definition cm.h:156
@ LF_REGEX
Definition cm.h:153
@ LF_USER
Definition cm.h:155

Function Documentation

◆ a_to_ull()

unsigned long long a_to_ull ( const char * )
extern

Definition at line 526 of file futil.c.

526 {
527 char *endptr;
528 unsigned long long value = strtoull(str, &endptr, 10);
529 if (endptr == str)
530 return 0;
531 switch (tolower(*endptr)) {
532 case 'g':
533 return value * 1024ULL * 1024ULL * 1024ULL;
534 case 'm':
535 return value * 1024ULL * 1024ULL;
536 case 'k':
537 return value * 1024ULL;
538 default:
539 return value;
540 }
541}

◆ action_disposition()

bool action_disposition ( char * title,
char * action_str )
extern

Definition at line 1229 of file dwin.c.

1229 {
1230 int len;
1231 int line, col;
1232 WINDOW *action_disposition_win;
1233
1234 if (!f_curses_open) {
1235 fprintf(stderr, "\n%s\n", title);
1236 fprintf(stderr, "%s\n", action_str);
1237 return true;
1238 }
1239 Chyron *chyron = new_chyron();
1240 set_chyron_key(chyron, 10, "F10 Continue", KEY_F(10));
1241 compile_chyron(chyron);
1242 len = max(strlen(title), strlen(action_str));
1243 col = (COLS - len - 4) / 2;
1244 line = (LINES - 4) / 2;
1245 if (box_new(2, len + 2, line, col, title, true)) {
1246 ssnprintf(em0, MAXLEN - 1, "box_new(%d, %d, %d, %d, %s) failed", 4,
1247 line, line, col, title);
1248 Perror(em0);
1249 }
1250 action_disposition_win = win_win[win_ptr];
1251 mvwaddstr(action_disposition_win, 0, 1, action_str);
1252 display_chyron(action_disposition_win, chyron, 1, 0);
1253 wmove(action_disposition_win, 1, chyron->l);
1254 cmd_key = xwgetch(action_disposition_win, chyron, 1);
1255 win_del();
1256 destroy_chyron(chyron);
1257 return true;
1258}
bool f_curses_open
Definition sig.c:33
#define max(a, b)
max macro evaluates two expressions, returning greatest result.
Definition cm.h:48
#define MAXLEN
Definition curskeys.c:15
unsigned int cmd_key
Definition dwin.c:118
WINDOW * win_win[MAXWIN]
Definition dwin.c:115
void display_chyron(WINDOW *win, Chyron *chyron, int line, int col)
Definition dwin.c:298
int win_ptr
Definition dwin.c:122
char em0[MAXLEN]
Definition dwin.c:133
void set_chyron_key(Chyron *, int, char *, int)
Definition dwin.c:246
int xwgetch(WINDOW *, Chyron *, int)
Wrapper for wgetch that handles signals, mouse events, checks for clicks on the chyron line,...
Definition dwin.c:1364
int box_new(int, int, int, int, char *, bool)
Create a new window with optional box and title.
Definition dwin.c:783
WINDOW * win_del()
Delete the current window and its associated box window.
Definition dwin.c:898
Chyron * destroy_chyron(Chyron *chyron)
Destroy Chyron structure.
Definition dwin.c:199
void compile_chyron(Chyron *)
construct the chyron string from the chyron structure
Definition dwin.c:269
Chyron * new_chyron()
Create and initialize Chyron structure.
Definition dwin.c:184
int Perror(char *)
Display a simple error message window or print to stderr.
Definition dwin.c:1115
size_t ssnprintf(char *, size_t, const char *,...)
ssnprintf was designed to be a safer alternative to snprintf.
Definition futil.c:156
Definition cm.h:248
int l
Definition cm.h:252

References box_new(), cmd_key, compile_chyron(), destroy_chyron(), display_chyron(), em0, f_curses_open, Chyron::l, new_chyron(), Perror(), set_chyron_key(), ssnprintf(), win_del(), win_ptr, win_win, and xwgetch().

Here is the call graph for this function:

◆ construct_file_spec()

bool construct_file_spec ( char * ,
char * ,
char * ,
char * ,
char * ,
int  )
extern

◆ curskeys()

void curskeys ( WINDOW * )
extern

◆ destroy_box()

void destroy_box ( WINDOW * )
extern

◆ destroy_win()

void destroy_win ( WINDOW * )
extern

◆ display_argv_error_msg()

void display_argv_error_msg ( char * ,
char **  )
extern

◆ display_chyron()

void display_chyron ( WINDOW * ,
Chyron * ,
int ,
int  )
extern

Definition at line 298 of file dwin.c.

298 {
299 wmove(win, line, 0);
300 wclrtoeol(win);
301 wmove(win, line, 0);
302 wadd_wchstr(win, chyron->cmplx_buf);
303 wmove(win, line, col);
304 return;
305}
WINDOW * win
Definition dwin.c:114

References Chyron::cmplx_buf.

Referenced by action_disposition(), answer_yn(), display_error(), display_page(), field_editor(), form_display_fields(), form_post(), form_process(), Perror(), wait_continue(), and wait_mk_win().

Here is the caller graph for this function:

◆ display_curses_keys()

int display_curses_keys ( )
extern

◆ display_ok_message()

int display_ok_message ( char * )
extern

◆ dump_opts()

void dump_opts ( )
extern

dump options to stdout

◆ dump_opts_by_use()

void dump_opts_by_use ( char * ,
char *  )
extern

dump options to stdout

◆ enter_option()

int enter_option ( )
extern

◆ get_rfc3339_s()

void get_rfc3339_s ( char * ,
size_t  )
extern

◆ handle_signal()

bool handle_signal ( sig_atomic_t )
extern

Referenced by popup_ckeys(), and xwgetch().

Here is the caller graph for this function:

◆ init_stdscr()

void init_stdscr ( )
extern

◆ mk_string()

String mk_string ( size_t l)
extern

Create a String struct with a dynamically allocated string.

Parameters
llength of string to create including null terminator
Returns
String struct
Note
The returned String struct contains a dynamically allocated string of he specified length
See also
free_string
Note
the caller is responsible for calling free_string to free the allocated memory.

Definition at line 1498 of file futil.c.

1499 {
1500 if (l == 0) {
1501 String str;
1502 str.l = 0;
1503 str.s = nullptr;
1504 return str;
1505 }
1506 String str;
1507 str.l = l + 1;
1508 str.s = (char *)malloc(str.l);
1509 str.s[0] = '\0';
1510 return str;
The String structure represents a string object with a pointer to the string and its allocated length...
Definition cm.h:609
size_t l
Definition cm.h:611
char * s
Definition cm.h:610

References String::l, and String::s.

◆ mouse_getch()

void mouse_getch ( int * ,
int * ,
int * ,
int *  )
extern

◆ open_log()

int open_log ( char * )
extern

◆ rgb_clr_to_cube()

int rgb_clr_to_cube ( int )
extern

◆ rtrim()

size_t rtrim ( char * s)
extern

Trims trailing spaces from string s in place.

Parameters
s- string to trim
Returns
length of trimmed string

Definition at line 111 of file futil.c.

111 {
112 if (s == nullptr || *s == '\0')
113 return 0;
114 char *p = s;
115 char *d = s;
116 while (*p != '\0')
117 *d++ = *p++;
118 while (*(d - 1) == ' ' && d > s)
119 d--;
120 *d = '\0';
121 return (size_t)(d - s);
122}

Referenced by fmt_line().

Here is the caller graph for this function:

◆ set_chyron_key()

void set_chyron_key ( Chyron * ,
int ,
char * ,
int  )
extern

Definition at line 246 of file dwin.c.

246 {
247 if (*s != '\0')
248 ssnprintf(chyron->key[k]->text, CHYRON_KEY_MAXLEN - 1, "%s", s);
249 else
250 chyron->key[k]->text[0] = '\0';
251 chyron->key[k]->keycode = kc;
252 chyron->key[k]->cp = cp_reverse;
253}
#define CHYRON_KEY_MAXLEN
Definition cm.h:235
int cp_reverse
Definition dwin.c:140

References ChyronKey::cp, cp_reverse, Chyron::key, ChyronKey::keycode, ssnprintf(), and ChyronKey::text.

Referenced by action_disposition(), answer_yn(), display_error(), form_display_fields(), form_post(), form_process(), Perror(), pick_engine(), and wait_mk_chyron().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sig_shell_mode()

void sig_shell_mode ( )
extern

◆ str_to_bool()

bool str_to_bool ( const char * s)
extern

Converts String to boolean true or false.

Parameters
s- string to convert
Returns
boolean true or false

Definition at line 674 of file futil.c.

675 {
676 if (s == nullptr || *s == '\0')
677 return false;
678 switch (s[0]) {
679 case 't':
680 case 'T':
681 case 'y':
682 case 'Y':
683 case '1':
684 return true;
685 case 'o':
686 case 'O':
687 switch (s[1]) {
688 case 'n':
689 case 'N':
690 return true;
691 default:
692 break;
693 }
694 default:
695 break;
696 }
697 return false;

Referenced by parse_config().

Here is the caller graph for this function:

◆ user_end()

void user_end ( )
extern

◆ verify_dir_q()

bool verify_dir_q ( char * ,
int  )
extern

◆ verify_file_q()

bool verify_file_q ( char * ,
int  )
extern

◆ w_mouse_getch()

void w_mouse_getch ( WINDOW * ,
int * ,
int * ,
int * ,
int *  )
extern

◆ waitpid_with_timeout()

bool waitpid_with_timeout ( pid_t ,
int  )
extern

Definition at line 1436 of file dwin.c.

1436 {
1437 int status;
1438 int rc;
1439 Chyron *wait_chyron;
1440 WINDOW *wait_win;
1441 int remaining = timeout;
1442
1443 usleep(100000); // Sleep for 200ms */
1444 rc = waitpid(pid, &status, WNOHANG);
1445 if (rc == pid)
1446 return true;
1447 if (rc == -1) {
1448 ssnprintf(em0, MAXLEN - 1, "Error waiting for process %d", pid);
1449 Perror(em0);
1450 return false;
1451 }
1452 wait_chyron = wait_mk_chyron();
1453 ssnprintf(em0, MAXLEN - 1, "Waiting for process %d to finish...", pid);
1454 wait_win = wait_mk_win(wait_chyron, em0);
1455 cmd_key = 0;
1456 while (rc == 0 && remaining > 0 && cmd_key != KEY_F(9)) {
1457 cmd_key = wait_continue(wait_win, wait_chyron, remaining);
1458 if (cmd_key == KEY_F(9))
1459 break;
1460 remaining--;
1461 }
1462 wait_destroy(wait_chyron);
1463 if (rc == pid)
1464 return true;
1465 return false;
1466}
bool wait_destroy(Chyron *)
Destroy the waiting message window and chyron.
Definition dwin.c:1208
int wait_continue(WINDOW *, Chyron *, int)
Update the waiting message with remaining time and check for user input.
Definition dwin.c:1220
WINDOW * wait_mk_win(Chyron *, char *)
Display a popup waiting message.
Definition dwin.c:1177
Chyron * wait_mk_chyron()
Create a Chyron struct for the waiting message.
Definition dwin.c:1166

References cmd_key, em0, Perror(), ssnprintf(), wait_continue(), wait_destroy(), wait_mk_chyron(), and wait_mk_win().

Referenced by form_process(), init_pick(), and view_init_input().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ win_new()

int win_new ( int ,
int ,
int ,
int  )
extern

Definition at line 820 of file dwin.c.

820 {
821 wbegy += 1;
822 wbegx += 1;
823 win_win[win_ptr] = newwin(wlines, wcols, wbegy, wbegx);
824 if (win_win[win_ptr] == nullptr) {
825 delwin(win_box[win_ptr]);
826 return 1;
827 }
828#ifdef DEBUG_IMMEDOK
829 immedok(win_win[win_ptr], true);
830#endif
831 wbkgrnd(win_win[win_ptr], &CCC_WIN);
832 wbkgrndset(win_win[win_ptr], &CCC_WIN);
833 keypad(win_win[win_ptr], true);
834 idlok(win_win[win_ptr], false);
835 idcok(win_win[win_ptr], false);
836 return 0;
837}
cchar_t CCC_WIN
Definition dwin.c:147
WINDOW * win_box[MAXWIN]
Definition dwin.c:116

References CCC_WIN, win_box, win_ptr, and win_win.

Referenced by box_new().

Here is the caller graph for this function:

◆ win_Toggle_Attrs()

void win_Toggle_Attrs ( )
extern

◆ write_log()

void write_log ( char * )
extern

Variable Documentation

◆ begx

int begx
extern

beginning x coordinate of the terminal

◆ begy

int begy
extern

beginning y coordinate of the terminal

◆ bw_bl

const wchar_t bw_bl
extern

bottom left corner

Definition at line 470 of file cm.h.

Referenced by cbox().

◆ bw_br

const wchar_t bw_br
extern

bottom right corner

Definition at line 471 of file cm.h.

Referenced by cbox().

◆ bw_bt

const wchar_t bw_bt
extern

bottom tee

◆ bw_cr

const wchar_t bw_cr
extern

cross

◆ bw_ho

const wchar_t bw_ho
extern

horizontal line

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

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

Definition at line 466 of file cm.h.

Referenced by cbox().

◆ bw_lt

const wchar_t bw_lt
extern

left tee

Definition at line 472 of file cm.h.

Referenced by box_new(), view_win_resize(), and win_resize().

◆ bw_rt

const wchar_t bw_rt
extern

right tee

Definition at line 474 of file cm.h.

Referenced by box_new(), view_win_resize(), and win_resize().

◆ bw_sp

const wchar_t bw_sp
extern

tee space

Definition at line 104 of file dwin.c.

Referenced by box_new(), view_win_resize(), and win_resize().

◆ bw_tl

const wchar_t bw_tl
extern

top left corner

Definition at line 468 of file cm.h.

Referenced by cbox().

◆ bw_tr

const wchar_t bw_tr
extern

top right corner

Definition at line 469 of file cm.h.

Referenced by cbox().

◆ bw_tt

const wchar_t bw_tt
extern

top tee

◆ bw_ve

const wchar_t bw_ve
extern

vertical line

Definition at line 467 of file cm.h.

Referenced by cbox().

◆ CCC_BOX

cchar_t CCC_BOX
extern

box color pair complex character

Definition at line 149 of file dwin.c.

Referenced by box_new(), open_curses(), view_win_resize(), and win_resize().

◆ CCC_LN

cchar_t CCC_LN
extern

Definition at line 152 of file dwin.c.

Referenced by init_view_boxwin(), init_view_full_screen(), open_curses(), and view_win_resize().

◆ CCC_NORM

cchar_t CCC_NORM
extern

normal color pair complex character

Definition at line 146 of file dwin.c.

Referenced by open_curses(), and win_del().

◆ CCC_REVERSE

cchar_t CCC_REVERSE
extern

reverse color pair complex character

Definition at line 150 of file dwin.c.

Referenced by open_curses().

◆ CCC_WIN

cchar_t CCC_WIN
extern

window color pair complex character

Definition at line 147 of file dwin.c.

Referenced by init_view_boxwin(), init_view_full_screen(), open_curses(), win_new(), and win_resize().

◆ click_x

int click_x
extern

the x coordinate of a mouse click

Definition at line 46 of file dwin.c.

Referenced by field_editor(), form_post(), form_process(), menu_cmd_processor(), picker(), and xwgetch().

◆ click_y

int click_y
extern

the y coordinate of a mouse click

Definition at line 45 of file dwin.c.

Referenced by field_editor(), form_post(), form_process(), menu_cmd_processor(), picker(), and xwgetch().

◆ clr_cnt

int clr_cnt
extern

number of colors used

Definition at line 143 of file dwin.c.

Referenced by init_clr_palette(), and rgb_to_curses_clr().

◆ clr_idx

int clr_idx
extern

line number background color pair index current color index

◆ clr_pair_cnt

int clr_pair_cnt
extern

number of color pairs supported by the terminal

Definition at line 145 of file dwin.c.

Referenced by get_clr_pair().

◆ clr_pair_idx

int clr_pair_idx
extern

current color pair index

Definition at line 144 of file dwin.c.

Referenced by parse_ansi_str().

◆ cmd_key

unsigned int cmd_key
extern

the command key for the current command, for error messages and other output

Definition at line 118 of file dwin.c.

Referenced by action_disposition(), answer_yn(), display_error(), field_navigator(), form_read_data(), init_pick(), view_init_input(), wait_continue(), and waitpid_with_timeout().

◆ cmenu_log_fd

int cmenu_log_fd
extern

Definition at line 45 of file futil.c.

Referenced by open_cmenu_log(), write_cmenu_log(), and write_cmenu_log_nt().

◆ cmenu_log_fp

FILE* cmenu_log_fp
extern

◆ colors_text

char const colors_text[][10]
extern

color codes for the 16 basic colors

colors_text

Note
Color names for .minitrc overrides
These names are used in .minitrc to specify color overrides
The order of these names corresponds to the colors_enum values

Definition at line 92 of file dwin.c.

92 {
93 "black", "red", "green", "yellow", "blue", "magenta", "cyan",
94 "white", "orange", "bg", "abg", "bblack", "bred", "bgreen",
95 "byellow", "bblue", "bcyan", "bmagenta", "bwhite", "borange", ""};

Referenced by clr_name_to_idx(), and list_colors().

◆ cols

int cols
extern

current number of columns (may be less than n_cols if the terminal is resized)

◆ cp_bold

int cp_bold
extern

bold color pair index

◆ cp_box

int cp_box
extern

box color pair index

Definition at line 139 of file dwin.c.

Referenced by open_curses().

◆ cp_default

int cp_default
extern

default color pair index

◆ cp_highlight

int cp_highlight
extern

highlight color pair index

◆ cp_ln

int cp_ln
extern

line number color pair index

Definition at line 142 of file dwin.c.

Referenced by open_curses().

◆ cp_ln_bg

int cp_ln_bg
extern

◆ cp_norm

int cp_norm
extern

normal color pair index

Definition at line 137 of file dwin.c.

Referenced by open_curses().

◆ cp_reverse

int cp_reverse
extern

reverse color pair index

Definition at line 140 of file dwin.c.

Referenced by compile_chyron(), field_editor(), open_curses(), and set_chyron_key().

◆ cp_reverse_highlight

int cp_reverse_highlight
extern

reverse highlight color pair index

Definition at line 141 of file dwin.c.

Referenced by field_editor(), form_process(), and open_curses().

◆ cp_title

int cp_title
extern

title color pair index

◆ cp_win

int cp_win
extern

window color pair index

Definition at line 138 of file dwin.c.

Referenced by fmt_line(), mk_cmplx_buf(), open_curses(), and search().

◆ curses_err_tioctl

struct termios shell_err_tioctl curses_err_tioctl
extern

Definition at line 37 of file scriou.c.

Referenced by capture_curses_tioctl(), and restore_curses_tioctl().

◆ curses_in_tioctl

struct termios shell_in_tioctl curses_in_tioctl
extern

Definition at line 35 of file scriou.c.

Referenced by capture_curses_tioctl(), and restore_curses_tioctl().

◆ curses_out_tioctl

struct termios shell_out_tioctl curses_out_tioctl
extern

Definition at line 36 of file scriou.c.

Referenced by capture_curses_tioctl(), and restore_curses_tioctl().

◆ curses_tioctl

struct termios shell_tioctl curses_tioctl
extern

Definition at line 34 of file scriou.c.

Referenced by xwgetch().

◆ dbgfd

int dbgfd
extern

the file descriptor for debug output, for debugging purposes

◆ earg_str

char earg_str[MAXLEN]
extern

earg - general use argument string general use argument string, for external commands or error messages

Definition at line 47 of file futil.c.

Referenced by enter_file_spec(), and menu_cmd_processor().

◆ eargc

int eargc
extern

general use argument count, for external commands or error messages

Definition at line 48 of file futil.c.

Referenced by display_pick_help(), enter_file_spec(), form_engine(), form_process(), and menu_cmd_processor().

◆ eargv

char* eargv[MAXARGS]
extern

eargv - argument vector for external commands, or error messages

Definition at line 49 of file futil.c.

Referenced by display_pick_help(), enter_file_spec(), and menu_cmd_processor().

◆ em0

◆ em1

◆ em2

◆ em3

char em3[MAXLEN]
extern

error message string for error messages

Definition at line 136 of file dwin.c.

Referenced by verify_dir(), and verify_file().

◆ errmsg

char errmsg[]
extern

Global variables for error reporting

Examples
/usr/local/src/C-Menu/src/enterchr.c, and /usr/local/src/C-Menu/src/enterstr.c.

Definition at line 93 of file futil.c.

◆ exit_code

int exit_code
extern

the exit code for the program, for error messages and other output

Definition at line 117 of file dwin.c.

◆ f_curses_open

bool f_curses_open
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(), open_curses(), Perror(), and wait_mk_win().

◆ f_debug

bool f_debug
extern

a flag to indicate whether debug output should be printed, for debugging purposes

◆ f_have_curses_tioctl

bool f_have_curses_tioctl
extern

curses tioctl captured

Definition at line 25 of file scriou.c.

Referenced by capture_curses_tioctl(), and restore_curses_tioctl().

◆ f_have_shell_tioctl

bool f_have_shell_tioctl
extern

shell tioctl captured

Definition at line 24 of file scriou.c.

Referenced by capture_shell_tioctl(), and restore_shell_tioctl().

◆ f_restore_screen

bool f_restore_screen
extern

whether to restore the screen

◆ fn

char fn[MAXLEN]
extern

function name for error messages

Definition at line 132 of file dwin.c.

Referenced by verify_dir(), and verify_file().

◆ lines

int lines
extern

current number of lines (may be less than n_lines if the terminal is resized)

◆ mbegx

int mbegx
extern

beginning x coordinate of the current window, which can be used to determine the position of the window on the terminal screen.

◆ mbegy

int mbegy
extern

beginning y coordinate of the current window, which can be used to determine the position of the window on the terminal screen.

◆ mcols

int mcols
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.

◆ mg_action

int mg_action
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.

◆ mg_col

int mg_col
extern

window column, which can be used to determine the current column position in the window for displaying text or other content.

◆ mg_line

int mg_line
extern

window line, which can be used to determine the current line position in the window for displaying text or other content.

◆ mlines

int mlines
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.

◆ n_cols

int n_cols
extern

number of columns in the terminal

◆ n_lines

int n_lines
extern

number of lines in the terminal

◆ sig_received

volatile sig_atomic_t sig_received
extern

Definition at line 31 of file sig.c.

Referenced by handle_signal(), popup_ckeys(), signal_handler(), and xwgetch().

◆ src_line

int src_line
extern

the line number of the source file being processed, for error messages

Definition at line 130 of file dwin.c.

Referenced by verify_dir(), and verify_file().

◆ src_name

char* src_name
extern

the name of the source file being processed, for error messages

Definition at line 131 of file dwin.c.

Referenced by verify_dir(), and verify_file().

◆ tty_fd

int tty_fd
extern

tty_fd - the file descriptor for the terminal, for error messages and other the file descriptor for the terminal, for error messages and other output

Global file/pipe numbers

Definition at line 154 of file dwin.c.

Referenced by picker().

◆ wait_timeout

int wait_timeout
extern

◆ win

WINDOW* win
extern

generic window pointer, used for various purposes

Definition at line 114 of file dwin.c.

◆ win_attr

int win_attr
extern

Ncurses attributes for the current window, such as color pair, bold, etc.

Definition at line 120 of file dwin.c.

◆ win_attr_even

int win_attr_even
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.

◆ win_attr_odd

int win_attr_odd
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.

◆ win_box

WINDOW* win_box[MAXWIN]
extern

array of pointers to box windows, indexed by window ID

Definition at line 116 of file dwin.c.

Referenced by box_new(), destroy_curses(), form_display_screen(), init_view_boxwin(), menu_engine(), open_pick_win(), popup_ckeys(), restore_wins(), win_del(), win_new(), and win_resize().

◆ win_pair

bool win_pair
extern

Flag to indicate whether the current window is part of a window pair

◆ win_ptr

int win_ptr
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 122 of file dwin.c.

Referenced by action_disposition(), answer_yn(), box_new(), destroy_curses(), display_error(), form_display_screen(), init_view_boxwin(), menu_engine(), open_curses(), open_pick_win(), Perror(), popup_ckeys(), restore_wins(), wait_mk_win(), win_del(), win_new(), and win_resize().

◆ win_win

WINDOW* win_win[MAXWIN]
extern