C-Menu 0.2.9
A User Interface Toolkit
Loading...
Searching...
No Matches
menu.h
Go to the documentation of this file.
1/** @file menu.h
2 * @brief Menu data structures, enums, types, end external declarations
3 * @author Bill Waller
4 * Copyright (c) 2025
5 * MIT License
6 * billxwaller@gmail.com
7 * @date 2026-02-09
8 */
9
10#pragma once
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#include <cm.h>
17
18#define MAX_MENU_LINES 256 /** Maximum number of menu lines in a menu */
19
20/**< Menu line types */
21typedef enum { MT_NULL = 0x320,
23 MT_CHOICE } MenuLineType;
24
25/**< Menu Actions */
26typedef enum {
27 MA_NEW = 350,
32} MenuAction;
33
34/**< Menu command types */
35typedef enum {
36 CT_NULL = 0x396,
52} MenuCommandType;
53
54/** @struct Line
55 @brief The Line strutures are attached to the Menu main structure */
56typedef struct {
57
58 void *ui_runtime; /**< A pointer to the UI runtime structure, which may be used to
59 access information about the current state of the UI,
60 such as variables, settings, or other data that may be
61 needed for processing the menu line or executing its
62 command, used to provide context and information for
63 processing the menu line and executing its associated
64 command */
65 void *ui_surface; /**< A pointer to the UI surface structure, which may be used to
66 access information about the current state of the UI
67 surface, such as dimensions, colors, or other properties
68 that may be needed for processing the menu line or
69 executing its command, used to provide context and
70 information for processing the menu line and executing
71 its associated command */
72
73 unsigned int type; /**< The type of menu line, e.g. MT_TEXT for a text line,
74 MT_CHOICE for a choice line */
75 char *raw_text; /**< The raw text of the menu line, as read from the menu
76 description file, before processing any variables or
77 formatting */
78 char *choice_text; /**< The formatted text of the menu line, after
79 processing any variables and formatting, used for
80 display purposes */
81 char choice_letter; /**< The letter that the user can press to select this
82 menu line, if it is a choice line, used for selection
83 purposes */
84 uint letter_pos; /**< The position of the choice letter in the text, for
85 highlighting purposes, used to determine where to
86 highlight the choice letter in the menu display */
87 uint command_type; /**< The type of command associated with this menu line,
88 e.g. CT_RETURNMAIN for a command that returns to the
89 main menu, CT_EXEC for a command that executes a
90 program, CT_HELP for a command that displays help
91 information, etc., used to determine what action to
92 take when this menu line is selected */
93 char *command_str; /**< The command string associated with this menu line,
94 which may be a command to execute, a menu to display,
95 a form to show, etc., depending on the command type,
96 used to determine the specific action to take when
97 this menu line is selected */
98} Line;
99
100/** @struct Menu
101 @brief The Menu structure is the main data structure for the menu
102 application, containing all the information about the menu, its lines, and
103 its display properties */
104typedef struct {
105 uint fg_clr_idx; /**< The foreground color for the menu display, used to
106 determine the color of the text and other elements in the
107 menu display */
108 uint bg_clr_idx; /** <The background color for the menu display, used to
109 determine the color of the background in the menu display
110 */
111 uint bo_clr_idx; /**< The color for the box around the menu, used to
112 determine the color of the box in the menu display */
113 uint lines; /**< The number of lines for the menu window size, used to
114 determine the height of the menu display */
115 uint cols; /**< The number of columns for the menu window size, used to
116 determine the width of the menu display */
117 uint begy; /**< The screen line for the upper left corner of the menu window,
118 used to determine the vertical position of the menu display on
119 the screen */
120 uint begx; /**< The screen column for the upper left corner of the menu
121 window, used to determine the horizontal position of the menu
122 display on the screen */
123
124#ifdef ASDF
125
126 WINDOW *win; /**< The ncurses window structure for the menu display, used to
127 manage the display of the menu on the screen and handle user
128 input */
129 WINDOW *box; /**< The ncurses window structure for the box around the menu,
130 used to manage the display of the box around the menu on the
131 screen */
132#endif
133
134 char title[MAXLEN]; /**< The title to display on the top line of the box
135 window, used to provide a title or header for the
136 menu display */
137 int argc; /**< The number of arguments on the command line, used to
138 determine how many arguments were passed to the menu
139 application when it was executed */
140 char **argv; /**< The argument vector from the command line, used to access
141 the specific arguments passed to the menu application when
142 it was executed */
143 char mapp_spec[MAXLEN]; /**< The menu application description file spec,
144 which may be a file name or a fully qualified
145 path to a file, used to specify the location of
146 the menu description file that contains the
147 information about the menu lines and their
148 properties */
149 char help_spec[MAXLEN]; /**< The menu application help file spec, which may
150 be a file name or a fully qualified path to a
151 file, used to specify the location of the help
152 file that contains the information about the menu
153 application and how to use it */
154 char provider_cmd[MAXLEN]; /**< The provider command, which can be executed
155 in the background to provide dynamic content
156 for a program called by the menu application,
157 used to specify a command that can be run in
158 the background to generate dynamic content for
159 the menu display or for a program that is
160 called by the menu application */
162 [MAXLEN]; /**< The receiver command, which can be executed in the
163 background to process the output of a program called by the
164 menu application, used to specify a command that can be run
165 in the background to process the output of a program that
166 is called by the menu application, such as parsing the
167 output and updating the menu display or performing some
168 other action based on the output */
169 char cmd[MAXLEN]; /**< A command that can be executed in the foreground,
170 possibly taking control of the screen, by the menu
171 application, such as an editor or other program that is
172 called by the menu application, used to specify a
173 command that can be run in the foreground when selected
174 from the menu, which may take control of the screen and
175 require user interaction */
176 bool f_mapp_spec; /**< A flag to indicate whether the menu application
177 description file has been verified, used to indicate
178 whether the menu description file specified by
179 mapp_spec has been successfully verified and can be
180 used to populate the menu lines and their properties */
181 bool f_help_spec; /**< A flag to indicate whether the menu application help
182 file has been verified, used to indicate whether the
183 help file specified by help_spec has been successfully
184 verified and can be used to provide help information
185 for the menu application */
186 bool f_provider_cmd; /**< A flag to indicate whether the provider command
187 has been verified, used to indicate whether the
188 provider command specified by provider_cmd has been
189 successfully verified and can be executed in the
190 background to provide dynamic content for the menu
191 display or for a program called by the menu
192 application */
193 bool f_receiver_cmd; /**< A flag to indicate whether the receiver command
194 has been verified, used to indicate whether the
195 receiver command specified by receiver_cmd has been
196 successfully verified and can be executed in the
197 background to process the output of a program called
198 by the menu application */
199 bool f_cmd; /**< A flag to indicate whether the foreground command has been
200 verified, used to indicate whether the command specified by
201 cmd has been successfully verified and can be executed in the
202 foreground when selected from the menu */
203 uint choice_max_len; /**< The longest choice text string of all menu lines,
204 used to determine the width of the menu window,
205 calculated based on the length of the choice_text for
206 all menu lines and used to ensure that the menu
207 window is wide enough to accommodate the longest
208 choice text without truncation or wrapping */
209 uint text_max_len; /**< The longest text string of all menu lines, used to
210 determine the width of the menu window, calculated
211 based on the length of the raw_text for all menu lines
212 and used to ensure that the menu window is wide enough
213 to accommodate the longest text without truncation or
214 wrapping */
215 uint item_count; /**< The number of menu lines in this menu, used to
216 determine how many lines are currently defined in the
217 menu and to manage the array of menu lines */
218 uint line_idx; /**< The index of the currently selected menu line, used for
219 highlighting and selection purposes, updated based on user
220 input to indicate which menu line is currently selected and
221 should be highlighted in the menu display */
222 Line *line[MAX_MENU_LINES]; /**< An array of pointers to the menu line
223 structures in this menu, used to store the
224 information about each menu line, including
225 its type, text, choice letter, command type,
226 and command string, and to manage the menu
227 lines in the menu display */
228} Menu;
229// extern Menu *menu;
230
231extern unsigned int get_command_type(char *);
232extern void free_menu_line(Line *);
233#ifdef __cplusplus
234}
235#endif
void form_help(char *)
#define FIELD_MAXLEN
Definition form.h:18
@ FF_DECIMAL_INT
Definition form.h:50
@ FF_STRING
Definition form.h:48
@ FF_HEX_INT
Definition form.h:52
@ FF_YYYYMMDD
Definition form.h:61
@ FF_HHMMSS
Definition form.h:63
@ FF_CURRENCY
Definition form.h:58
@ FF_FLOAT
Definition form.h:54
@ FF_INVALID
Definition form.h:68
@ FF_DOUBLE
Definition form.h:56
@ FF_APR
Definition form.h:65
@ FA_END
Definition form.h:42
@ FA_ACCEPT
Definition form.h:29
@ FA_EDIT
Definition form.h:40
@ FA_CALC
Definition form.h:37
@ FA_HELP
Definition form.h:31
@ FA_REFUSE
Definition form.h:35
@ FA_CANCEL
Definition form.h:33
@ FA_CONTINUE
Definition form.h:27
int form_read_description(Form *)
void form_display_chyron(Form *)
#define FIELD_MAXCNT
Definition form.h:19
int cmd_processor(Init *)
int open_pick_win(Init *)
bool view_stack_peek(const ViewStack *, View *)
@ OT_INT
Definition common.h:88
@ OT_BOOL
Definition common.h:89
@ OT_HEX
Definition common.h:90
@ OT_STRING
Definition common.h:87
int popup_form(Init *, int, char **, uint, uint)
instantiate a form popup window
Definition popups.c:113
bool view_stack_push(ViewStack *, View)
int popup_menu(Init *, int, char **, uint, uint)
instantiate a menu popup window
Definition popups.c:53
void view_stack_free(ViewStack *)
@ FORM
Definition common.h:80
@ MENU
Definition common.h:82
@ VIEW
Definition common.h:79
@ PICK
Definition common.h:81
@ OG_FILES
Definition common.h:95
@ OG_DIRS
Definition common.h:96
@ OG_SPECS
Definition common.h:97
@ OG_MISC
Definition common.h:98
@ OG_FLAGS
Definition common.h:100
@ OG_PARMS
Definition common.h:99
@ OG_COL
Definition common.h:101
bool view_stack_pop(ViewStack *, View *)
int popup_pick(Init *, int, char **, uint, uint)
instantiate a pick popup window
Definition popups.c:83
bool view_stack_init(ViewStack *, size_t)
void destroy_view_win(Init *)
int popup_view(Init *, int, char **, uint, uint, uint, uint)
instantiate a view popup window
Definition popups.c:145
int pick_engine(Init *)
char minitrc[MAXLEN]
volatile sig_atomic_t sig_received
Definition sig.c:32
size_t rtrim(char *)
Trims trailing spaces from string s in place.
Definition futil.c:308
bool handle_signal(sig_atomic_t)
void win_Toggle_Attrs()
uint mlines
uint mbegx
bool strnfill(char *, char, uint)
void sig_shell_mode()
void get_rfc3339_s(char *, size_t)
bool f_have_shell_tioctl
Definition scriou.c:24
bool waitpid_with_timeout(pid_t, uint)
void init_stdscr()
struct termios shell_out_tioctl program_out_tioctl
Definition scriou.c:36
char stdio_names_str[4096]
Definition futil.c:122
bool verify_dir_q(char *, uint)
uint dbgfd
@ F_REG
Definition cm.h:218
@ F_BLK
Definition cm.h:216
@ F_FIFO
Definition cm.h:211
@ F_F0
Definition cm.h:210
@ F_F3
Definition cm.h:217
@ F_SOCK
Definition cm.h:222
@ F_CHR
Definition cm.h:212
@ F_F5
Definition cm.h:221
@ F_F1
Definition cm.h:213
@ F_DIR
Definition cm.h:214
@ F_UNKNOWN
Definition cm.h:224
@ F_F2
Definition cm.h:215
@ F_F4
Definition cm.h:219
@ F_LNK
Definition cm.h:220
@ F_F6
Definition cm.h:223
#define KEY_ALTF0
Definition cm.h:331
uint n_lines
void restore_wins()
int stdout_fd
Definition ui_common.c:61
void dump_opts()
void win_del()
void win_resize(uint, uint, char *)
bool construct_file_spec(char *, char *, char *, char *, char *, uint)
struct termios shell_tioctl program_tioctl
Definition scriou.c:34
char * stdio_names(char *, char *)
Definition futil.c:1083
unsigned char uchar
Definition cm.h:345
String mk_string(size_t)
Create a String struct with a dynamically allocated string.
Definition futil.c:1550
uint mg_col
uint n_cols
bool verify_file_q(char *, uint)
char fn[MAXLEN]
Definition ui_common.c:45
void win_init_attrs()
struct termios shell_in_tioctl program_in_tioctl
Definition scriou.c:35
bool f_debug
uint mg_line
#define SCR_COLS
Definition cm.h:65
void dump_opts_by_use(char *, char *)
char errmsg[]
Definition futil.c:126
uint src_line
Definition ui_common.c:43
int wait_timeout
Definition futil.c:140
@ LF_EXC_REGEX
Definition cm.h:184
@ LF_HIDE
Definition cm.h:182
@ LF_ISUID
Definition cm.h:194
@ LF_IRUSR
Definition cm.h:192
@ LF_ICASE
Definition cm.h:183
@ LF_ISGID
Definition cm.h:193
@ LF_EXEC
Definition cm.h:186
@ LF_REGEX
Definition cm.h:185
@ LF_USER
Definition cm.h:187
@ LF_IXUSR
Definition cm.h:190
@ LF_IWUSR
Definition cm.h:191
bool f_restore_screen
@ LF_FIFO
Definition cm.h:199
@ LF_DIR
Definition cm.h:201
@ LF_UNKNOWN
Definition cm.h:206
@ LF_SOCK
Definition cm.h:205
@ LF_BLK
Definition cm.h:202
@ LF_LNK
Definition cm.h:204
@ LF_REG
Definition cm.h:203
@ LF_CHR
Definition cm.h:200
int exit_code
Definition ui_common.c:31
FILE * tty_fp
struct termios shell_err_tioctl program_err_tioctl
Definition scriou.c:37
#define min(x, y)
min macro evaluates two expressions, returning least result
Definition cm.h:104
uint16_t win_attr
Definition ui_common.c:34
int stdin_fd
Definition ui_common.c:61
bool f_program_open
uint mbegy
bool str_to_bool(const char *)
Converts String to boolean true or false.
Definition futil.c:960
uint mcols
#define __atexit
This macro registers the end_pgm function to be called when the program exits.
Definition cm.h:275
bool is_image_file(const char *filename)
char * src_name
Definition ui_common.c:44
char * fill_field(char *, char *, char, uint)
Definition futil.c:1714
uint mg_action
char * stdio_fdnames(char *, char *)
Definition futil.c:1108
void user_end()
UiChyron * wait_mk_chyron()
int display_curses_keys()
bool f_have_program_tioctl
Definition scriou.c:25
uint enter_option()
#define Ctrl(c)
Definition cm.h:67
int stderr_fd
Definition ui_common.c:61
void display_argv_error_msg(char *, char **)
bool wait_destroy(UiChyron *)
char * rep_substring(const char *, const char *, const char *) __attribute__((nonnull(1
Replace all occurrences of "tgt_s" in "org_s" with "rep_s".
Definition futil.c:1449
@ MT_TEXT
Definition menu.h:22
@ MT_CHOICE
Definition menu.h:23
@ MT_NULL
Definition menu.h:21
@ CT_PICK
Definition menu.h:45
@ CT_FORM
Definition menu.h:41
@ CT_DEXE
Definition menu.h:37
@ CT_UNDEFINED
Definition menu.h:51
@ CT_MENU
Definition menu.h:44
@ CT_RETURN
Definition menu.h:48
@ CT_TOGGLE
Definition menu.h:49
@ CT_HELP
Definition menu.h:39
@ CT_WRITE_CONFIG
Definition menu.h:50
@ CT_FORM_WRITE
Definition menu.h:43
@ CT_EXEC
Definition menu.h:38
@ CT_VIEW
Definition menu.h:46
@ CT_NULL
Definition menu.h:36
@ CT_ABOUT
Definition menu.h:40
@ CT_FORM_EXEC
Definition menu.h:42
@ CT_CKEYS
Definition menu.h:47
void free_menu_line(Line *)
@ MA_RETURN
Definition menu.h:28
@ MA_DISPLAY_MENU
Definition menu.h:29
@ MA_RESET_MENU
Definition menu.h:30
@ MA_NEW
Definition menu.h:27
@ MA_CONTINUE
Definition menu.h:31
#define MAX_MENU_LINES
Definition menu.h:18
void ui_render()
Render the UI by updating panels and refreshing the display.
Definition ui_ncurses.c:884
int ui_cursor_move(UiSurface *s, ss_t w, uint y, uint x)
Move the cursor to a specified position within a UiSurface.
Definition ui_ncurses.c:666
int click_x
Definition ui_common.c:30
int ui_curs_set(int visibility)
Set the visibility of the cursor.
Definition ui_ncurses.c:840
int click_y
Definition ui_common.c:29
int ui_wclrtoeol(UiSurface *s, ss_t w)
Clear to the end of the line in a surface window.
#define UIKEY_DC
#define UIKEY_BACKSPACE
#define UIKEY_LEFT
#define UIKEY_F09
#define UIKEY_IC
#define UIKEY_END
#define UIKEY_BUTTON1
#define UIKEY_RIGHT
#define UIKEY_HOME
#define UIKEY_ENTER
int ui_get_event(UiSurface *s, ss_t w, UiChyron *chyron, UiEvent *ev, int timeout_ms)
Read input events.
int ui_mvwaddstr(UiSurface *s, ss_t w, uint y, uint x, const char *text)
Draw a text string at a specific position in a surface window.
int init_cnt
Definition mem.c:28
void view_full_screen_resize(Init *)
Resize the full screen view and its components.
Definition init_view.c:111
void view_boxwin_resize(Init *)
Resize the current window and its box.
Definition init_view.c:198
ViewStack view_stack
Definition init_view.c:32
#define TRUE
Definition iloan.c:31
int popup_ckeys()
Definition curskeys.c:31
#define MAXLEN
Definition curskeys.c:15
void cmenu_shutdown(Init *init)
Definition menu.c:88
void cmenu_abend(Init *init, int ec, char *s)
Definition menu.c:94
uint form_yx_to_fidx(Form *, uint, uint)
int cf_accept(UiSurface *sfc, ss_t w, char *accept_s, uint flin, uint fcol, uint flen)
Accepts input for a field in a C-Menu window.
Definition cm_fields.c:41
bool f_erase_remainder
Structure to hold field information for C-Menu.
Definition cm_fields.c:30
int process_config_file(char *, Init *)
Definition init.c:694
void display_field(UiCell *cmplx_buf, uint y, uint x)
Definition fields.c:355
char ff_tbl[][26]
Definition fields.c:25
struct termios shell_tioctl
Definition scriou.c:22
int fork_exec(char **)
Fork and exec a command.
Definition exec.c:122
int shell(char *)
Execute a shell command.
Definition exec.c:74
int full_screen_fork_exec(char **)
Execute a command in full screen mode.
Definition exec.c:45
int full_screen_shell(char *)
Execute a shell command in full screen mode.
Definition exec.c:58
int fork_detach_execvp(char **eargv)
Fork, set new session ID, close files, and execute detached command.
Definition detach.c:41
int form_fmt_field(Form *form, char *s)
Format field according to its format type.
Definition fields.c:449
bool is_valid_date(uint yyyy, uint mm, uint dd)
Check if a given date is valid, including leap years.
Definition fields.c:612
int field_editor(Form *)
Accept input for a field.
Definition fields.c:47
void numeric(char *d, char *s)
Extract numeric characters from source string to destination string.
Definition fields.c:649
bool is_valid_time(uint hh, uint mm, uint ss)
Check if a given time is valid.
Definition fields.c:633
void right_justify(char *, uint)
Right justify string by removing trailing spaces and adding leadingspaces.
Definition fields.c:586
void left_justify(char *s)
Left justify string by removing leading spaces.
Definition fields.c:573
int form_display_field_n(Form *, uint)
Display field n.
Definition fields.c:348
int form_display_field(Form *)
Display current field.
Definition fields.c:370
int form_desc_error(Form *form, int, char *, char *)
Handle errors encountered while parsing the form description file, providing detailed error messages ...
int init_form(Init *, int, char **, uint, uint)
Initialize form data structure and parse description file.
Definition form_engine.c:61
int field_navigator(Form *)
Handle user input for field entry, allowing navigation between fields and looping until an exit actio...
bool locate_file_in_path(char *, char *)
Locates a file in the system PATH.
Definition futil.c:1296
size_t canonicalize_file_spec(char *)
Removes quotes and trims at first space.
Definition futil.c:1350
size_t strnz__cpy(char *, const char *, size_t)
safer alternative to strncpy
Definition whence.c:291
bool parse_local_timestamp(const char *, time_t *)
Parses an ISO 8601 timestamp string in local time and converts it to time_t.
Definition futil.c:250
bool trim_ext(char *, char *)
trims the file extension from "filename" and copies the result to "buf"
Definition futil.c:1035
bool stripz_quotes(char *)
removes leading and trailing double quotes if present
Definition futil.c:723
size_t trim(char *)
Trims leading and trailing spaces from string s in place.
Definition futil.c:361
char * get_local_timestamp()
Returns the current local time as an ISO 8601 formatted string.
Definition futil.c:284
bool is_directory(const char *)
Checks if the given path is a directory.
Definition futil.c:1381
bool file_spec_path(char *, char *)
extracts the path component of a file specification
Definition futil.c:889
bool str_to_upper(char *)
Converts a string to uppercase.
Definition futil.c:496
bool dir_name(char *, char *)
Returns the directory name of a file specification.
Definition futil.c:1158
bool is_hex_str(char *, uint)
Validates that a string consists of exactly len hexadecimal digits.
Definition futil.c:197
double str_to_double(char *)
converts string to double
Definition futil.c:948
bool str_to_lower(char *)
Converts a string to lowercase.
Definition futil.c:482
size_t strnz(char *, size_t)
terminates string at New Line, Carriage Return, or max_len
Definition futil.c:599
size_t ssnprintf(char *, size_t, const char *,...)
ssnprintf was designed to be a safer alternative to snprintf.
Definition futil.c:390
bool strip_quotes(char *)
removes leading and trailing double quotes if present
Definition futil.c:710
int str_to_args(char **, char *, uint)
Converts a string into an array of argument strings.
Definition futil.c:412
bool is_valid_regex(const char *)
Checks if the given regular expression pattern is valid.
Definition futil.c:1409
bool expand_tilde(char *, uint)
Replaces "~/" in string with the user's home directory.
Definition futil.c:989
char * strnz_dup(char *, size_t)
Allocates memory for and duplicates string s up to length l or until line feed or carriage return.
Definition futil.c:642
bool file_spec_name(char *, char *)
extracts the file name component of a file specification
Definition futil.c:916
char size_t strip_ansi(char *, char *)
Strips ANSI SGR escape sequences (ending in 'm') from string s to d.
Definition futil.c:848
bool mk_dir(char *dir)
If directory doesn't exist, make it.
Definition futil.c:1329
size_t strnz__cat(char *, const char *, size_t)
safer alternative to strncat
Definition whence.c:320
bool get_argp_doc_by_name(char *comment, const struct argp_option *, const char *)
Retrieves the documentation string for a given key name from an argp options array.
Definition futil.c:164
char * get_ip_addresses(char *, uint)
Retrieves the IP addresses of the local machine and formats them into a string.
Definition futil.c:324
bool is_symlink_to_dir(const char *)
Checks if the given path is a symbolic link to a directory.
Definition futil.c:1394
bool verify_file(char *, uint)
Verifies that the file specified by "in_spec" exists and is accessible with the permissions specified...
Definition futil.c:1249
size_t strnlf(char *, size_t)
terminates string with line feed
Definition futil.c:619
int a_toi(char *, bool *)
a safer alternative to atoi() for converting ASCII strings to integers.
Definition futil.c:784
bool str_subc(char *, char *, char, char *, uint)
Replaces "ReplaceChr" in "s" with "Withstr" in "d" won't copy more than "l" bytes to "d" Replaces all...
Definition futil.c:680
char * strerror__r(int errnum, char *buf, size_t buflen)
A thread-safe alternative to strerror() that writes the error message corresponding to errnum into th...
Definition futil.c:748
int destroy_argv(uint argc, char **argv)
Deallocates memory allocated for argument strings in argv.
Definition futil.c:468
bool chrep(char *, char, char)
Replaces all occurrences of old_chr in s with new_chr in place.
Definition futil.c:765
bool base_name(char *, char *)
Returns the base name of a file specification.
Definition futil.c:1132
bool normalize_file_spec(char *)
replace backslashes with forward lashes
Definition futil.c:872
char * format_local_timestamp(time_t, char *, size_t)
Formats a time_t as an ISO 8601 string in local time.
Definition futil.c:273
bool is_newer(char *, char *)
Checks if the file specified by "fut" is newer than the file specified by "control".
Definition futil.c:148
char * fdname(int, char *)
Retrieves the file path associated with a given file descriptor.
Definition futil.c:1073
bool verify_dir(char *, uint)
Verifies that the directory specified by "spec" exists and is accessible with the permissions specifi...
Definition futil.c:1198
char * get_user_str(char *, size_t)
Retrieves the current user's name and UID, and formats it into a string.
Definition futil.c:297
bool trim_path(char *)
Trims trailing spaces and slashes from directory path in place.
Definition futil.c:1007
unsigned long a_to_ul(const char *)
Converts a string to an unsigned long long integer, with support for suffixes K, M,...
Definition futil.c:812
bool unstr_hex_clr(char *, char *)
Validates that a string is a hex color code in the format "#RRGGBB".
Definition futil.c:220
size_t string_cpy(String *, const String *)
Copy src String to dest String, allocating additional memory for dest String if necessary.
Definition futil.c:1584
String to_string(const char *)
String functions provide a simple string library to facilitate string manipulation in C,...
Definition futil.c:1530
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 Strin...
Definition futil.c:1641
size_t string_cat(String *, const String *)
Concatenates src String to dest String, allocating additional memory for dest String if necessary.
Definition futil.c:1601
String free_string(String)
Free the dynamically allocated String.
Definition futil.c:1569
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...
Definition futil.c:1620
int segmentation_fault()
Function to intentionally cause a segmentation fault for testing purposes.
Definition futil.c:1666
int parse_opt_args(Init *, int, char **)
Parse command-line options and set Init struct values accordingly.
Definition init.c:622
bool derive_file_spec(char *, char *, char *)
Derive full file specification from directory and file name.
Definition init.c:1436
int write_config(Init *init)
Write the current configuration to a file specified in init->minitrc.
Definition init.c:1160
void mapp_initialization(Init *, int, char **)
Main initialization function for MAPP - Menu Application.
Definition init.c:498
void zero_opt_args(Init *)
Initialize optional arguments in the Init struct to default values.
Definition init.c:637
void view_calc_boxwin_dimensions(Init *)
Calculate the dimensions and position of the box window for C-Menu View.
Definition init_view.c:215
int init_view_full_screen(Init *init)
Initialize C-Menu View in full screen mode.
Definition init_view.c:47
int init_view_boxwin(Init *init)
Initialize the C-Menu View in box window mode.
Definition init_view.c:162
void view_calc_full_screen_dimensions(Init *)
Calculate the dimensions for full screen mode.
Definition init_view.c:128
int view_init_input(Init *init, char *file_name)
Initialize the input for the C-Menu View.
Definition init_view.c:299
bool verify_spec_arg(char *, char *, char *, char *, uint)
Verify file specification argument.
Definition mem.c:361
Pick * new_pick(Init *init, int argc, char **argv, uint begy, uint begx)
Create and initialize Pick structure.
Definition mem.c:178
View * destroy_view(Init *init)
Destroy View structure.
Definition mem.c:337
Menu * new_menu(Init *init, int argc, char **argv, uint begy, uint begx)
Create and initialize Menu structure.
Definition mem.c:126
Init * new_init(int argc, char **argv)
Create and initialize Init structure.
Definition mem.c:60
Menu * destroy_menu(Init *init)
Destroy Menu structure.
Definition mem.c:147
Form * destroy_form(Init *init)
Destroy Form structure.
Definition mem.c:267
View * new_view(Init *init)
Create and initialize View structure.
Definition mem.c:291
Init * destroy_init(Init *init)
Destroy Init structure.
Definition mem.c:91
Form * new_form(Init *init, int argc, char **argv, uint begy, uint begx)
Create and initialize Form structure.
Definition mem.c:244
Pick * destroy_pick(Init *init)
Destroy Pick structure.
Definition mem.c:217
unsigned int menu_engine(Init *)
The main loop of the menu system.
Definition menu_engine.c:36
unsigned int get_command_type(char *)
Get command type from command string.
unsigned int parse_menu_description(Init *)
Parse menu description file and create Menu.
int init_pick(Init *, int, char **, uint, uint)
Initializes pick structure and opens pick input file or pipe.
Definition pick_engine.c:68
bool restore_program_tioctl()
restore_program_tioctl() - restore program terminal settings
Definition scriou.c:84
bool capture_shell_tioctl()
capture_shell_tioctl() - capture shell terminal settings
Definition scriou.c:43
char di_getch()
get single character from terminal in raw mode
Definition scriou.c:158
bool mk_raw_tioctl(struct termios *)
mk_raw_tioctl() - set terminal to raw mode
Definition scriou.c:132
bool set_sane_tioctl(struct termios *)
set_sane_tioctl() - set terminal to sane settings for C-MENU
Definition scriou.c:99
bool restore_shell_tioctl()
restore_shell_tioctl() - restore shell terminal settings
Definition scriou.c:57
bool capture_program_tioctl()
capture_program_tioctl() - capture program terminal settings
Definition scriou.c:70
void sig_dfl_mode()
Set signal handlers to default behavior.
Definition sig.c:41
void signal_handler(int)
Signal handler for interrupt signals.
Definition sig.c:94
void sig_prog_mode()
Set up signal handlers for interrupt signals.
Definition sig.c:61
int view_file(Init *)
Start view.
int view_cmd_processor(Init *)
Main Command Processing Loop for View.
void build_prompt(View *)
Build Prompt String.
void initialize_line_table(View *)
Initialize Line Table.
void destroy_line_table(View *)
Destroy Line Table.
void page_next(View *)
Advance to Next Page.
int pad_refresh(View *)
Refresh Pad and Line Number Window.
int display_prompt(View *, char *)
Display Command Line Prompt.
uint mm
Definition cm.h:72
uint dd
Definition cm.h:73
uint yyyy
Definition cm.h:71
uint hh
Definition cm.h:77
uint mm
Definition cm.h:78
uint ss
Definition cm.h:79
char * s
Definition cm.h:402
size_t l
Definition cm.h:403
Arg ** v
Definition cm.h:406
size_t n
Definition cm.h:407
size_t l
Definition cm.h:411
char * s
Definition cm.h:410
size_t l
Definition cm.h:415
wchar_t * s
Definition cm.h:414
char fill_char
Definition cm.h:427
uint ff
Definition cm.h:426
uint flen
Definition cm.h:425
uint fcol
Definition cm.h:424
uint flin
Definition cm.h:423
bool cf_erase_remainder
Definition cm.h:428
char title[MAXLEN]
Definition common.h:132
char mapp_data[MAXLEN]
Definition common.h:151
char minitrc[MAXLEN]
Definition common.h:177
bool f_out_spec
Definition common.h:174
char mapp_help[MAXLEN]
Definition common.h:152
int begx
Definition common.h:121
bool f_title
Definition common.h:169
char chyron_s[MAXLEN]
Definition common.h:131
SIO * sio
Definition common.h:117
int pick_cnt
Definition common.h:192
bool f_cmd_all
Definition common.h:168
Form * form
Definition common.h:189
char in_spec[MAXLEN]
Definition common.h:171
char log_file_spec[MAXLEN]
Definition common.h:181
UiLogLevel min_log_level
Definition common.h:183
char cmd_all[MAXLEN]
Definition common.h:126
bool f_mapp_help
Definition common.h:160
bool f_mapp_msrc
Definition common.h:161
int argc
Definition common.h:133
char fill_char[2]
Definition common.h:149
bool f_cmd
Definition common.h:167
int prompt_type
Definition common.h:129
char about_fn[MAXLEN]
Definition common.h:178
char mapp_msrc[MAXLEN]
Definition common.h:153
int cols
Definition common.h:119
int menu_cnt
Definition common.h:188
int tab_stop
Definition common.h:185
bool f_mapp_home
Definition common.h:157
bool f_erase_remainder
Definition common.h:144
bool f_mapp_data
Definition common.h:158
bool f_read_theme
Definition common.h:145
bool f_mapp_desc
Definition common.h:164
char mapp_home[MAXLEN]
Definition common.h:150
bool f_mapp_user
Definition common.h:162
char prompt_str[MAXLEN]
Definition common.h:128
bool f_squeeze
Definition common.h:140
int begy
Definition common.h:120
char parent_cmd[MAXLEN]
Definition common.h:127
char mapp_spec[MAXLEN]
Definition common.h:179
char receiver_cmd[MAXLEN]
Definition common.h:124
int h_shift
Definition common.h:186
bool wrap
Definition common.h:147
bool f_multiple_cmd_args
Definition common.h:142
int select_max
Definition common.h:184
bool f_ln
Definition common.h:146
bool f_mapp_spec
Definition common.h:159
char provider_cmd[MAXLEN]
Definition common.h:123
char out_spec[MAXLEN]
Definition common.h:172
bool f_strip_ansi
Definition common.h:139
View * view
Definition common.h:193
bool p_view_files
Definition common.h:137
Menu * menu
Definition common.h:187
bool f_at_end_remove
Definition common.h:138
int view_cnt
Definition common.h:194
char brackets[3]
Definition common.h:148
bool f_ignore_case
Definition common.h:136
char ** argv
Definition common.h:134
int lines
Definition common.h:118
char mapp_user[MAXLEN]
Definition common.h:154
char cmd[MAXLEN]
Definition common.h:125
char mapp_theme[MAXLEN]
Definition common.h:155
uint timeout_secs
Definition common.h:182
int optind
Definition common.h:135
bool f_help_spec
Definition common.h:170
bool f_receiver_cmd
Definition common.h:166
bool f_provider_cmd
Definition common.h:165
int form_cnt
Definition common.h:190
char help_spec[MAXLEN]
Definition common.h:180
char editor[MAXLEN]
Definition common.h:175
Pick * pick
Definition common.h:191
bool f_in_spec
Definition common.h:173
char menuapp[MAXLEN]
Definition common.h:176
uint col
Definition form.h:102
char str[SCR_COLS]
Definition form.h:104
uint len
Definition form.h:106
uint line
Definition form.h:100
UiCell accept_cc[FIELD_MAXLEN]
Definition form.h:142
char display_s[FIELD_MAXLEN]
Definition form.h:130
UiCell display_cc[FIELD_MAXLEN]
Definition form.h:135
char accept_s[FIELD_MAXLEN]
Definition form.h:126
uint col
Definition form.h:115
uint ff
Definition form.h:119
uint len
Definition form.h:117
char input_s[FIELD_MAXLEN]
Definition form.h:123
UiCell filler_cc[FIELD_MAXLEN]
Definition form.h:141
uint line
Definition form.h:113
char filler_s[FIELD_MAXLEN]
Definition form.h:136
uint dcnt
Definition form.h:332
uint bo_clr_idx
Definition form.h:149
uint fg_clr_idx
Definition form.h:147
FILE * out_fp
Definition form.h:163
Text * text[FIELD_MAXCNT]
Definition form.h:340
uint cols
Definition form.h:151
bool f_in_pipe
Definition form.h:223
bool f_mapp_spec
Definition form.h:194
wchar_t brktr[5]
Definition form.h:296
bool f_erase_remainder
Definition form.h:237
Field * field[FIELD_MAXCNT]
Definition form.h:353
char receiver_cmd[MAXLEN]
Definition form.h:180
bool f_process
Definition form.h:248
uint fidx
Definition form.h:310
char provider_cmd[MAXLEN]
Definition form.h:172
bool f_query
Definition form.h:250
UiChyron * chyron
Definition form.h:365
int out_fd
Definition form.h:167
uint didx
Definition form.h:325
bool f_out_pipe
Definition form.h:228
uint begy
Definition form.h:152
bool f_provider_cmd
Definition form.h:258
bool f_calculate
Definition form.h:246
char fill_char[4]
Definition form.h:299
bool help
Definition form.h:252
bool f_cmd
Definition form.h:273
bool f_help_spec
Definition form.h:233
FILE * in_fp
Definition form.h:161
char out_spec[MAXLEN]
Definition form.h:210
uint lines
Definition form.h:150
bool f_receiver_cmd
Definition form.h:265
wchar_t brktl[5]
Definition form.h:293
bool f_multiple_cmd_args
Definition form.h:245
uint begx
Definition form.h:154
char in_spec[MAXLEN]
Definition form.h:203
char mapp_spec[FIELD_MAXLEN]
Definition form.h:169
char cmd[MAXLEN]
Definition form.h:187
char title[MAXLEN]
Definition form.h:159
char brackets[3]
Definition form.h:281
uint bg_clr_idx
Definition form.h:148
bool f_out_spec
Definition form.h:220
bool f_in_spec
Definition form.h:217
uint fcnt
Definition form.h:318
int in_fd
Definition form.h:165
char help_spec[MAXLEN]
Definition form.h:196
char * choice_text
Definition menu.h:78
void * ui_surface
Definition menu.h:65
void * ui_runtime
Definition menu.h:58
char * raw_text
Definition menu.h:75
char * command_str
Definition menu.h:93
unsigned int type
Definition menu.h:73
uint letter_pos
Definition menu.h:84
char choice_letter
Definition menu.h:81
uint command_type
Definition menu.h:87
char provider_cmd[MAXLEN]
Definition menu.h:154
uint bg_clr_idx
Definition menu.h:108
char mapp_spec[MAXLEN]
Definition menu.h:143
int argc
Definition menu.h:137
Line * line[MAX_MENU_LINES]
Definition menu.h:222
bool f_help_spec
Definition menu.h:181
char cmd[MAXLEN]
Definition menu.h:169
bool f_provider_cmd
Definition menu.h:186
uint fg_clr_idx
Definition menu.h:105
uint text_max_len
Definition menu.h:209
uint begy
Definition menu.h:117
bool f_mapp_spec
Definition menu.h:176
uint cols
Definition menu.h:115
char receiver_cmd[MAXLEN]
Definition menu.h:162
uint bo_clr_idx
Definition menu.h:111
bool f_receiver_cmd
Definition menu.h:193
bool f_cmd
Definition menu.h:199
uint choice_max_len
Definition menu.h:203
char help_spec[MAXLEN]
Definition menu.h:149
uint begx
Definition menu.h:120
uint line_idx
Definition menu.h:218
uint lines
Definition menu.h:113
char ** argv
Definition menu.h:140
uint item_count
Definition menu.h:215
char title[MAXLEN]
Definition menu.h:134