2
3
4
5
6
7
8
18#define MAX_MENU_LINES 256
55
59
60
61
62
63
64
66
67
68
69
70
71
74
76
77
79
80
82
83
85
86
88
89
90
91
92
94
95
96
97
101
102
103
106
107
109
110
112
114
116
118
119
121
122
127
128
130
131
135
136
138
139
141
142
144
145
146
147
148
150
151
152
153
155
156
157
158
159
160
163
164
165
166
167
168
170
171
172
173
174
175
177
178
179
180
182
183
184
185
187
188
189
190
191
192
194
195
196
197
198
200
201
202
204
205
206
207
208
210
211
212
213
214
216
217
219
220
221
223
224
225
226
227
int form_read_description(Form *)
void form_display_chyron(Form *)
int cmd_processor(Init *)
int open_pick_win(Init *)
bool view_stack_peek(const ViewStack *, View *)
int popup_form(Init *, int, char **, uint, uint)
instantiate a form popup window
bool view_stack_push(ViewStack *, View)
int popup_menu(Init *, int, char **, uint, uint)
instantiate a menu popup window
void view_stack_free(ViewStack *)
bool view_stack_pop(ViewStack *, View *)
int popup_pick(Init *, int, char **, uint, uint)
instantiate a pick popup window
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
volatile sig_atomic_t sig_received
size_t rtrim(char *)
Trims trailing spaces from string s in place.
bool handle_signal(sig_atomic_t)
bool strnfill(char *, char, uint)
void get_rfc3339_s(char *, size_t)
bool waitpid_with_timeout(pid_t, uint)
struct termios shell_out_tioctl program_out_tioctl
char stdio_names_str[4096]
bool verify_dir_q(char *, uint)
void win_resize(uint, uint, char *)
bool construct_file_spec(char *, char *, char *, char *, char *, uint)
struct termios shell_tioctl program_tioctl
char * stdio_names(char *, char *)
String mk_string(size_t)
Create a String struct with a dynamically allocated string.
bool verify_file_q(char *, uint)
struct termios shell_in_tioctl program_in_tioctl
void dump_opts_by_use(char *, char *)
struct termios shell_err_tioctl program_err_tioctl
#define min(x, y)
min macro evaluates two expressions, returning least result
bool str_to_bool(const char *)
Converts String to boolean true or false.
#define __atexit
This macro registers the end_pgm function to be called when the program exits.
bool is_image_file(const char *filename)
char * fill_field(char *, char *, char, uint)
char * stdio_fdnames(char *, char *)
UiChyron * wait_mk_chyron()
int display_curses_keys()
bool f_have_program_tioctl
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".
void free_menu_line(Line *)
void ui_render()
Render the UI by updating panels and refreshing the display.
int ui_cursor_move(UiSurface *s, ss_t w, uint y, uint x)
Move the cursor to a specified position within a UiSurface.
int ui_curs_set(int visibility)
Set the visibility of the cursor.
int ui_wclrtoeol(UiSurface *s, ss_t w)
Clear to the end of the line in a surface window.
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.
void view_full_screen_resize(Init *)
Resize the full screen view and its components.
void view_boxwin_resize(Init *)
Resize the current window and its box.
void cmenu_shutdown(Init *init)
void cmenu_abend(Init *init, int ec, char *s)
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.
bool f_erase_remainder
Structure to hold field information for C-Menu.
int process_config_file(char *, Init *)
void display_field(UiCell *cmplx_buf, uint y, uint x)
struct termios shell_tioctl
int fork_exec(char **)
Fork and exec a command.
int shell(char *)
Execute a shell 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 fork_detach_execvp(char **eargv)
Fork, set new session ID, close files, and execute detached command.
int form_fmt_field(Form *form, char *s)
Format field according to its format type.
bool is_valid_date(uint yyyy, uint mm, uint dd)
Check if a given date is valid, including leap years.
int field_editor(Form *)
Accept input for a field.
void numeric(char *d, char *s)
Extract numeric characters from source string to destination string.
bool is_valid_time(uint hh, uint mm, uint ss)
Check if a given time is valid.
void right_justify(char *, uint)
Right justify string by removing trailing spaces and adding leadingspaces.
void left_justify(char *s)
Left justify string by removing leading spaces.
int form_display_field_n(Form *, uint)
Display field n.
int form_display_field(Form *)
Display current field.
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.
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.
size_t canonicalize_file_spec(char *)
Removes quotes and trims at first space.
size_t strnz__cpy(char *, const char *, size_t)
safer alternative to strncpy
bool parse_local_timestamp(const char *, time_t *)
Parses an ISO 8601 timestamp string in local time and converts it to time_t.
bool trim_ext(char *, char *)
trims the file extension from "filename" and copies the result to "buf"
bool stripz_quotes(char *)
removes leading and trailing double quotes if present
size_t trim(char *)
Trims leading and trailing spaces from string s in place.
char * get_local_timestamp()
Returns the current local time as an ISO 8601 formatted string.
bool is_directory(const char *)
Checks if the given path is a directory.
bool file_spec_path(char *, char *)
extracts the path component of a file specification
bool str_to_upper(char *)
Converts a string to uppercase.
bool dir_name(char *, char *)
Returns the directory name of a file specification.
bool is_hex_str(char *, uint)
Validates that a string consists of exactly len hexadecimal digits.
double str_to_double(char *)
converts string to double
bool str_to_lower(char *)
Converts a string to lowercase.
size_t strnz(char *, size_t)
terminates string at New Line, Carriage Return, or max_len
size_t ssnprintf(char *, size_t, const char *,...)
ssnprintf was designed to be a safer alternative to snprintf.
bool strip_quotes(char *)
removes leading and trailing double quotes if present
int str_to_args(char **, char *, uint)
Converts a string into an array of argument strings.
bool is_valid_regex(const char *)
Checks if the given regular expression pattern is valid.
bool expand_tilde(char *, uint)
Replaces "~/" in string with the user's home directory.
char * strnz_dup(char *, size_t)
Allocates memory for and duplicates string s up to length l or until line feed or carriage return.
bool file_spec_name(char *, char *)
extracts the file name component of a file specification
char size_t strip_ansi(char *, char *)
Strips ANSI SGR escape sequences (ending in 'm') from string s to d.
bool mk_dir(char *dir)
If directory doesn't exist, make it.
size_t strnz__cat(char *, const char *, size_t)
safer alternative to strncat
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.
char * get_ip_addresses(char *, uint)
Retrieves the IP addresses of the local machine and formats them into a string.
bool is_symlink_to_dir(const char *)
Checks if the given path is a symbolic link to a directory.
bool verify_file(char *, uint)
Verifies that the file specified by "in_spec" exists and is accessible with the permissions specified...
size_t strnlf(char *, size_t)
terminates string with line feed
int a_toi(char *, bool *)
a safer alternative to atoi() for converting ASCII strings to integers.
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...
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...
int destroy_argv(uint argc, char **argv)
Deallocates memory allocated for argument strings in argv.
bool chrep(char *, char, char)
Replaces all occurrences of old_chr in s with new_chr in place.
bool base_name(char *, char *)
Returns the base name of a file specification.
bool normalize_file_spec(char *)
replace backslashes with forward lashes
char * format_local_timestamp(time_t, char *, size_t)
Formats a time_t as an ISO 8601 string in local time.
bool is_newer(char *, char *)
Checks if the file specified by "fut" is newer than the file specified by "control".
char * fdname(int, char *)
Retrieves the file path associated with a given file descriptor.
bool verify_dir(char *, uint)
Verifies that the directory specified by "spec" exists and is accessible with the permissions specifi...
char * get_user_str(char *, size_t)
Retrieves the current user's name and UID, and formats it into a string.
bool trim_path(char *)
Trims trailing spaces and slashes from directory path in place.
unsigned long a_to_ul(const char *)
Converts a string to an unsigned long long integer, with support for suffixes K, M,...
bool unstr_hex_clr(char *, char *)
Validates that a string is a hex color code in the format "#RRGGBB".
size_t string_cpy(String *, const String *)
Copy src String to dest String, allocating additional memory for dest String if necessary.
String to_string(const char *)
String functions provide a simple string library to facilitate string manipulation in C,...
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...
size_t string_cat(String *, const String *)
Concatenates src String to dest String, allocating additional memory for dest String if necessary.
String free_string(String)
Free the dynamically allocated String.
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...
int segmentation_fault()
Function to intentionally cause a segmentation fault for testing purposes.
int parse_opt_args(Init *, int, char **)
Parse command-line options and set Init struct values accordingly.
bool derive_file_spec(char *, char *, char *)
Derive full file specification from directory and file name.
int write_config(Init *init)
Write the current configuration to a file specified in init->minitrc.
void mapp_initialization(Init *, int, char **)
Main initialization function for MAPP - Menu Application.
void zero_opt_args(Init *)
Initialize optional arguments in the Init struct to default values.
void view_calc_boxwin_dimensions(Init *)
Calculate the dimensions and position of the box window for C-Menu View.
int init_view_full_screen(Init *init)
Initialize C-Menu View in full screen mode.
int init_view_boxwin(Init *init)
Initialize the C-Menu View in box window mode.
void view_calc_full_screen_dimensions(Init *)
Calculate the dimensions for full screen mode.
int view_init_input(Init *init, char *file_name)
Initialize the input for the C-Menu View.
bool verify_spec_arg(char *, char *, char *, char *, uint)
Verify file specification argument.
Pick * new_pick(Init *init, int argc, char **argv, uint begy, uint begx)
Create and initialize Pick structure.
View * destroy_view(Init *init)
Destroy View structure.
Menu * new_menu(Init *init, int argc, char **argv, uint begy, uint begx)
Create and initialize Menu structure.
Init * new_init(int argc, char **argv)
Create and initialize Init structure.
Menu * destroy_menu(Init *init)
Destroy Menu structure.
Form * destroy_form(Init *init)
Destroy Form structure.
View * new_view(Init *init)
Create and initialize View structure.
Init * destroy_init(Init *init)
Destroy Init structure.
Form * new_form(Init *init, int argc, char **argv, uint begy, uint begx)
Create and initialize Form structure.
Pick * destroy_pick(Init *init)
Destroy Pick structure.
unsigned int menu_engine(Init *)
The main loop of the menu system.
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.
bool restore_program_tioctl()
restore_program_tioctl() - restore program terminal settings
bool capture_shell_tioctl()
capture_shell_tioctl() - capture shell terminal settings
char di_getch()
get single character from terminal in raw mode
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
bool restore_shell_tioctl()
restore_shell_tioctl() - restore shell terminal settings
bool capture_program_tioctl()
capture_program_tioctl() - capture program terminal settings
void sig_dfl_mode()
Set signal handlers to default behavior.
void signal_handler(int)
Signal handler for interrupt signals.
void sig_prog_mode()
Set up signal handlers for interrupt signals.
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.
char log_file_spec[MAXLEN]
char receiver_cmd[MAXLEN]
char provider_cmd[MAXLEN]
UiCell accept_cc[FIELD_MAXLEN]
char display_s[FIELD_MAXLEN]
UiCell display_cc[FIELD_MAXLEN]
char accept_s[FIELD_MAXLEN]
char input_s[FIELD_MAXLEN]
UiCell filler_cc[FIELD_MAXLEN]
char filler_s[FIELD_MAXLEN]
Text * text[FIELD_MAXCNT]
Field * field[FIELD_MAXCNT]
char receiver_cmd[MAXLEN]
char provider_cmd[MAXLEN]
char mapp_spec[FIELD_MAXLEN]
char provider_cmd[MAXLEN]
Line * line[MAX_MENU_LINES]
char receiver_cmd[MAXLEN]