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 DEBUG   false
#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 W_BOX   0x40
#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 = 1 , LF_ICASE = 2 , LF_EXC_REGEX = 4 , LF_REGEX = 8 ,
  LF_EXEC = 16
}
enum  FTypes {
  FT_BLK = 1 , FT_CHR = 2 , FT_DIR = 4 , FT_FIFO = 8 ,
  FT_LNK = 16 , FT_REG = 32 , FT_SOCK = 64 , FT_UNKNOWN = 128
}

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 win_new (int, int, int, int, char *, int)
 Create a new window with optional box and title.
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 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, int)
 Find files in a directory matching a regular expression.
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 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_tt
const wchar_t bw_rt
const wchar_t bw_cr
const wchar_t bw_bt
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
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 194 of file cm.h.

194#define __atexit \
195 { \
196 int rc; \
197 rc = atexit(end_pgm); \
198 if (rc != 0) { \
199 fprintf(stderr, "\nCannot set exit function\n"); \
200 exit(EXIT_FAILURE); \
201 } \
202 }

◆ _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 272 of file cm.h.

◆ BO_COLOR

#define BO_COLOR   1

default bold foreground color

Definition at line 273 of file cm.h.

◆ BW_BL

#define BW_BL   L'\x2514'

bottom left

Definition at line 427 of file cm.h.

◆ BW_BR

#define BW_BR   L'\x2518'

bottom right

Definition at line 428 of file cm.h.

◆ BW_BT

#define BW_BT   L'\x2534'

bottom tee

Definition at line 437 of file cm.h.

◆ BW_CR

#define BW_CR   L'\x253C'

cross

Definition at line 436 of file cm.h.

◆ BW_HO

#define BW_HO   L'\x2500'

UNICODE BOX DRAWING SYMBOLS horizontal line

Definition at line 423 of file cm.h.

◆ BW_LT

#define BW_LT   L'\x251C'

left tee

Definition at line 433 of file cm.h.

◆ BW_RBL

#define BW_RBL   L'\x2570'

rounded bottom left

Definition at line 431 of file cm.h.

◆ BW_RBR

#define BW_RBR   L'\x256f'

rounded bottom right

Definition at line 432 of file cm.h.

◆ BW_RT

#define BW_RT   L'\x2524'

right tee

Definition at line 435 of file cm.h.

◆ BW_RTL

#define BW_RTL   L'\x256d'

rounded left tee

Definition at line 429 of file cm.h.

◆ BW_RTR

#define BW_RTR   L'\x256e'

rounded right tee

Definition at line 430 of file cm.h.

◆ BW_SP

#define BW_SP   L'\x20'

space

Definition at line 438 of file cm.h.

◆ BW_TL

#define BW_TL   L'\x250C'

top left

Definition at line 425 of file cm.h.

◆ BW_TR

#define BW_TR   L'\x2510'

top right

Definition at line 426 of file cm.h.

◆ BW_TT

#define BW_TT   L'\x252C'

top tee

Definition at line 434 of file cm.h.

◆ BW_VE

#define BW_VE   L'\x2502'

vertical line

Definition at line 424 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 227 of file cm.h.

227#define CHYRON_KEY_MAXLEN \
228 64

◆ CHYRON_KEYS

#define CHYRON_KEYS   20

maximum number of key bindings for the chyron

Definition at line 230 of file cm.h.

◆ COLOR_LEN

#define COLOR_LEN   8

length of color code strings

Definition at line 180 of file cm.h.

◆ Ctrl

#define Ctrl ( c)
Value:

Definition at line 33 of file cm.h.

◆ DEBUG

#define DEBUG   false

Definition at line 26 of file cm.h.

◆ DEFAULTSHELL

#define DEFAULTSHELL   "/bin/bash"

Definition at line 181 of file cm.h.

◆ FG_COLOR

#define FG_COLOR   2

default foreground color

Definition at line 271 of file cm.h.

◆ KEY_ALTDEL

#define KEY_ALTDEL   0x20e

Definition at line 402 of file cm.h.

◆ KEY_ALTDOWN

#define KEY_ALTDOWN   0x214

Definition at line 407 of file cm.h.

◆ KEY_ALTEND

#define KEY_ALTEND   0x219

Definition at line 403 of file cm.h.

◆ KEY_ALTF

#define KEY_ALTF ( n)
Value:

define alt function keys

Definition at line 346 of file cm.h.

◆ KEY_ALTF0

#define KEY_ALTF0   0x138

Definition at line 345 of file cm.h.

◆ KEY_ALTHOME

#define KEY_ALTHOME   0x21e

Definition at line 400 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 399 of file cm.h.

◆ KEY_ALTLEFT

#define KEY_ALTLEFT   0x228

Definition at line 406 of file cm.h.

◆ KEY_ALTPGDN

#define KEY_ALTPGDN   0x22d

Definition at line 404 of file cm.h.

◆ KEY_ALTPGUP

#define KEY_ALTPGUP   0x232

Definition at line 401 of file cm.h.

◆ KEY_ALTRIGHT

#define KEY_ALTRIGHT   0x237

Definition at line 408 of file cm.h.

◆ KEY_ALTUP

#define KEY_ALTUP   0x23d

Definition at line 405 of file cm.h.

◆ LN_BG_COLOR

#define LN_BG_COLOR   7

default line number background

Definition at line 275 of file cm.h.

◆ LN_COLOR

#define LN_COLOR   4

default line number color

Definition at line 274 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 468 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 23 of file cm.h.

◆ S_QUIET

#define S_QUIET   0x2000

quiet mode flag for file validation

Definition at line 183 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 182 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 523 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 519 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 519 of file cm.h.

◆ W_BOX

#define W_BOX   0x40
              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 box window flag for win_new()

Definition at line 179 of file cm.h.

◆ XTERM_256COLOR

#define XTERM_256COLOR

use xterm-256color terminfo for altkey bindings

Definition at line 347 of file cm.h.

Typedef Documentation

◆ uchar

typedef unsigned char uchar

Definition at line 469 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
Enumerator
FT_BLK 
FT_CHR 

b00000001

FT_DIR 

b00000010

FT_FIFO 

b00000100

FT_LNK 

b00001000

FT_REG 

b00010000

FT_SOCK 

b00100000

FT_UNKNOWN 

b01000000

Definition at line 156 of file cm.h.

158 FT_CHR = 2,
159 FT_DIR = 4,
160 FT_FIFO = 8,
161 FT_LNK = 16,
162 FT_REG = 32,
163 FT_SOCK = 64,
164 FT_UNKNOWN = 128,
165};
@ FT_UNKNOWN
Definition cm.h:164
@ FT_SOCK
Definition cm.h:163
@ FT_DIR
Definition cm.h:159
@ FT_FIFO
Definition cm.h:160
@ FT_REG
Definition cm.h:162
@ FT_CHR
Definition cm.h:158
@ FT_BLK
Definition cm.h:157
@ FT_LNK
Definition cm.h:161

◆ LFFlags

enum LFFlags
Enumerator
LF_HIDE 

1 Don't list hidden files

LF_ICASE 

2 Ignore case in search

LF_EXC_REGEX 

4 Exclude files matching regular expression

LF_REGEX 

8 Include files matching regular expression

LF_EXEC 

16 Execute command each file

Definition at line 148 of file cm.h.

148 {
149 LF_HIDE = 1,
150 LF_ICASE = 2,
151 LF_EXC_REGEX = 4,
152 LF_REGEX = 8,
153 LF_EXEC = 16,
154};
@ LF_EXC_REGEX
Definition cm.h:151
@ LF_HIDE
Definition cm.h:149
@ LF_ICASE
Definition cm.h:150
@ LF_EXEC
Definition cm.h:153
@ LF_REGEX
Definition cm.h:152

Function Documentation

◆ action_disposition()

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

Definition at line 1224 of file dwin.c.

1224 {
1225 int len;
1226 int line, col;
1227 WINDOW *action_disposition_win;
1228
1229 if (!f_curses_open) {
1230 fprintf(stderr, "\n%s\n", title);
1231 fprintf(stderr, "%s\n", action_str);
1232 return true;
1233 }
1234 Chyron *chyron = new_chyron();
1235 set_chyron_key(chyron, 10, "F10 Continue", KEY_F(10));
1236 compile_chyron(chyron);
1237 len = max(strlen(title), strlen(action_str));
1238 col = (COLS - len - 4) / 2;
1239 line = (LINES - 4) / 2;
1240 if (win_new(2, len + 2, line, col, title, 0)) {
1241 ssnprintf(em0, MAXLEN - 1, "win_new(%d, %d, %d, %d, %s, %b) failed", 4,
1242 line, line, col, title, 0);
1243 Perror(em0);
1244 }
1245 action_disposition_win = win_win[win_ptr];
1246 mvwaddstr(action_disposition_win, 0, 1, action_str);
1247 display_chyron(action_disposition_win, chyron, 1, 0);
1248 wmove(action_disposition_win, 1, chyron->l);
1249 cmd_key = xwgetch(action_disposition_win, chyron, 1);
1250 win_del();
1251 destroy_chyron(chyron);
1252 return true;
1253}
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:117
WINDOW * win_win[MAXWIN]
Definition dwin.c:114
void display_chyron(WINDOW *win, Chyron *chyron, int line, int col)
Definition dwin.c:297
int win_ptr
Definition dwin.c:121
char em0[MAXLEN]
Definition dwin.c:132
void set_chyron_key(Chyron *, int, char *, int)
Definition dwin.c:245
int xwgetch(WINDOW *, Chyron *, int)
Wrapper for wgetch that handles signals, mouse events, checks for clicks on the chyron line,...
Definition dwin.c:1359
int win_new(int, int, int, int, char *, int)
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:902
Chyron * destroy_chyron(Chyron *chyron)
Destroy Chyron structure.
Definition dwin.c:198
void compile_chyron(Chyron *)
construct the chyron string from the chyron structure
Definition dwin.c:268
Chyron * new_chyron()
Create and initialize Chyron structure.
Definition dwin.c:183
int Perror(char *)
Display a simple error message window or print to stderr.
Definition dwin.c:1110
size_t ssnprintf(char *, size_t, const char *,...)
ssnprintf was designed to be a safer alternative to snprintf.
Definition futil.c:147
Definition cm.h:240
int l
Definition cm.h:244

References cmd_key, compile_chyron(), destroy_chyron(), display_chyron(), em0, f_curses_open, Chyron::l, new_chyron(), Perror(), set_chyron_key(), ssnprintf(), win_del(), win_new(), 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 297 of file dwin.c.

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

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 1396 of file futil.c.

1397 {
1398 if (l == 0) {
1399 String str;
1400 str.l = 0;
1401 str.s = nullptr;
1402 return str;
1403 }
1404 String str;
1405 str.l = l + 1;
1406 str.s = (char *)malloc(str.l);
1407 str.s[0] = '\0';
1408 return str;
The String structure represents a string object with a pointer to the string and its allocated length...
Definition cm.h:584
size_t l
Definition cm.h:586
char * s
Definition cm.h:585

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 102 of file futil.c.

102 {
103 if (s == nullptr || *s == '\0')
104 return 0;
105 char *p = s;
106 char *d = s;
107 while (*p != '\0')
108 *d++ = *p++;
109 while (*(d - 1) == ' ' && d > s)
110 d--;
111 *d = '\0';
112 return (size_t)(d - s);
113}

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 245 of file dwin.c.

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

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 649 of file futil.c.

650 {
651 if (s == nullptr || *s == '\0')
652 return false;
653 switch (s[0]) {
654 case 't':
655 case 'T':
656 case 'y':
657 case 'Y':
658 case '1':
659 return true;
660 case 'o':
661 case 'O':
662 switch (s[1]) {
663 case 'n':
664 case 'N':
665 return true;
666 default:
667 break;
668 }
669 default:
670 break;
671 }
672 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 1431 of file dwin.c.

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

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_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 99 of file dwin.c.

Referenced by cbox().

◆ bw_br

const wchar_t bw_br
extern

bottom right corner

Definition at line 100 of file dwin.c.

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

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 95 of file dwin.c.

Referenced by cbox().

◆ bw_lt

const wchar_t bw_lt
extern

left tee

Definition at line 101 of file dwin.c.

Referenced by win_new(), and win_resize().

◆ bw_rt

const wchar_t bw_rt
extern

right tee

Definition at line 102 of file dwin.c.

Referenced by win_new(), and win_resize().

◆ bw_tl

const wchar_t bw_tl
extern

top left corner

Definition at line 97 of file dwin.c.

Referenced by cbox().

◆ bw_tr

const wchar_t bw_tr
extern

top right corner

Definition at line 98 of file dwin.c.

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 96 of file dwin.c.

Referenced by cbox().

◆ CCC_BOX

cchar_t CCC_BOX
extern

box color pair complex character

Definition at line 148 of file dwin.c.

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

◆ CCC_LN

cchar_t CCC_LN
extern

Definition at line 151 of file dwin.c.

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

◆ CCC_NORM

cchar_t CCC_NORM
extern

normal color pair complex character

Definition at line 145 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 149 of file dwin.c.

Referenced by open_curses().

◆ CCC_WIN

cchar_t CCC_WIN
extern

window color pair complex character

Definition at line 146 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 45 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 44 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 142 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 144 of file dwin.c.

Referenced by get_clr_pair().

◆ clr_pair_idx

int clr_pair_idx
extern

current color pair index

Definition at line 143 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 117 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().

◆ 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 91 of file dwin.c.

91 {
92 "black", "red", "green", "yellow", "blue", "magenta", "cyan",
93 "white", "orange", "bg", "abg", "bblack", "bred", "bgreen",
94 "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 138 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 141 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 136 of file dwin.c.

Referenced by open_curses().

◆ cp_reverse

int cp_reverse
extern

reverse color pair index

Definition at line 139 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 140 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 137 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 40 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 41 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 42 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 135 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 84 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 116 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 131 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 129 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 130 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 153 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 113 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 119 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 115 of file dwin.c.

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

◆ 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 121 of file dwin.c.

Referenced by action_disposition(), answer_yn(), destroy_curses(), display_error(), form_display_screen(), 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