5
6
7
8#define _XOPEN_SOURCE_EXTENDED 1
10#define NCURSES_WIDECHAR 1
13#include "../ui/ui_ncurses_internal.h"
14#include <ncursesw/ncurses.h>
15#include <ncursesw/panel.h>
18#include "../ui/ui_notcurses_internal.h"
19#include <notcurses/notcurses.h>
32typedef struct UiSplitSurface UiSplitSurface;
34typedef struct UiMB UiMB;
92#define ALLWINS (uint)1000
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
152
153
154
161
162
163
164
165
166
167
226extern const wchar_t *
bw_rtl;
227extern const wchar_t *
bw_rtr;
228extern const wchar_t *
bw_rbl;
229extern const wchar_t *
bw_rbr;
230extern const wchar_t *
bw_sp;
231extern const wchar_t *
bw_ra;
232extern const wchar_t *
bw_la;
233extern const wchar_t *
bw_ua;
234extern const wchar_t *
bw_da;
235extern const wchar_t *
bw_ran;
236extern const wchar_t *
bw_lan;
237extern const wchar_t *
bw_chk;
238extern const wchar_t *
bw_h09;
241typedef cchar_t UiCell;
267#define CELL_CHAR_INITIALIZER(c) {
269 .gcluster_backstop = 0
,
272}
273#define CELL_INITIALIZER(c, s, chan) {
275 .gcluster_backstop = 0
,
277 .channels = (chan), \
278}
279#define DEFAULT_INITIALIZER(c) {
281 .gcluster_backstop = 0
,
282 .stylemask = (bkgd_cell.stylemask),
283 .channels = (bkgd_cell.channels), \
284}
297static inline int unicode_to_utf8_gcluster(uint32_t cp, GCluster *g) {
302 }
else if (cp <= 0x7FF) {
303 g
->c[0] = (
char)(0xC0 | (cp >> 6));
304 g
->c[1] = (
char)(0x80 | (cp & 0x3F));
307 }
else if (cp <= 0xFFFF) {
308 g
->c[0] = (
char)(0xE0 | (cp >> 12));
309 g
->c[1] = (
char)(0x80 | ((cp >> 6) & 0x3F));
310 g
->c[2] = (
char)(0x80 | (cp & 0x3F));
313 }
else if (cp <= 0x10FFFF) {
314 g
->c[0] = (
char)(0xF0 | (cp >> 18));
315 g
->c[1] = (
char)(0x80 | ((cp >> 12) & 0x3F));
316 g
->c[2] = (
char)(0x80 | ((cp >> 6) & 0x3F));
317 g
->c[3] = (
char)(0x80 | (cp & 0x3F));
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342UiRuntime *
ui_init(
const UiConfig *config);
349UiSurface *
ui_surface_new(uint w, UiSurface *parent, uint p, uint lines, uint cols, uint y, uint x);
350UiSurface *
ui_box_surface_new(UiSurface *parent, uint p, uint lines, uint cols, uint y, uint x,
char *title);
351int ui_surface_addwin(UiSurface *s, uint w, uint p, uint lines, uint cols, uint y, uint x);
352int ui_surface_addpad(UiSurface *s, uint w, uint view_win, uint lines, uint cols);
364int ui_get_event(UiSurface *s, uint w, UiEvent *ev,
int timeout_ms);
367int ui_wmove(UiSurface *s, uint w, uint y, uint x);
371int ui_wscrl(UiSurface *s, uint w,
int rows);
374void ui_getyx(UiSurface *s, uint w, uint *lines, uint *cols);
375void ui_getmaxyx(UiSurface *s, uint w, uint *lines, uint *cols);
376int ui_draw_ch(UiSurface *s, uint w,
const char c);
377int ui_draw_ch_yx(UiSurface *s, uint w, uint y, uint x,
const char c);
378int ui_draw_text(UiSurface *s, uint w, uint y, uint x,
const char *text);
379int ui_draw_text_n(UiSurface *s, uint w, uint y, uint x,
const char *text,
int m);
380int ui_draw_text_fill(UiSurface *s, uint w, uint y, uint x,
const char *text,
int m);
419int ui_mvwaddch(UiSurface *s, uint w, uint y, uint x,
const char c);
421int ui_waddstr(UiSurface *s, uint w,
const char *text);
422int ui_mvaddstr(UiSurface *s, uint w, uint y, uint x,
const char *text);
423int ui_mvwaddstr(UiSurface *s, uint w, uint y, uint x,
const char *text);
424int ui_waddnstr(UiSurface *s, uint w,
const char *text,
int m);
425int ui_mvwaddstr(UiSurface *s, uint w, uint y, uint x,
const char *text);
426int ui_mvwaddstr_fill(UiSurface *s, uint w, uint y, uint x,
const char *str,
int m);
427int ui_mvwaddnstr(UiSurface *s, uint w, uint y, uint x,
const char *text,
int m);
429int ui_waddwstr(UiSurface *s, uint w,
const wchar_t *wstr);
430int ui_mvwaddwstr(UiSurface *s, uint w, uint y, uint x,
const wchar_t *wstr);
431int ui_waddnwstr(UiSurface *s, uint w,
const wchar_t *wstr,
int m);
432int ui_mvwaddnwstr(UiSurface *s, uint w, uint y, uint x,
const wchar_t *wstr,
int m);
448int ui_setscrreg(UiSurface *s, uint w, uint top, uint bottom);
450int ui_keypad(UiSurface *s, uint w,
bool enable);
451int ui_idlok(UiSurface *s, uint w,
bool enable);
452int ui_idcok(UiSurface *s, uint w,
bool enable);
489int ui_init_color(uint16_t color, uint8_t r, uint8_t g, uint8_t b);
497uint ui_add_color(RGB *rgb);
498uint ui_add_color_hex(
char *s);
499int ui_wch_to_utf8(
const wchar_t fill_ch);
501int ui_set_nccell(
UiCell *cell,
const wchar_t *wstr,
const UiStyle *style, ushort *pair);
507int ui_bkgrnd(UiSurface *s, uint w,
const UiCell *cell);
508int ui_bkgrndset(UiSurface *s, uint w,
const UiCell *cell);
509int ui_getcchar(
const UiCell *uc, wchar_t *wstr, attr_t *attrs, ushort *pair,
void *opts);
510int ui_setcchar(UiCell *wch,
const wchar_t *wc,
const attr_t attrs,
short pair,
const void *opts);
511int ui_init_color(uint color, uint r, uint g, uint b);
512int ui_color_content(uint color, uint *r, uint *g, uint *b);
513int ui_init_pair(uint pair, uint fg, uint bg);
514int ui_pair_content(uint pair, uint *fg, uint *bg);
515uint ui_add_pair(uint fg, uint bg);
516int ui_chg_pair(uint pair, uint fg, uint bg);
517int ui_get_pair(uint pair, uint *fg, uint *bg);
518int ui_add_color(uint r, uint g, uint b);
519SCREEN *ui_ncurses_get_screen();
520int ui_getmaxx(UiSurface *s, uint w);
521int ui_getmaxy(UiSurface *s, uint w);
529
532
533
534
535
539
540
541
542
int form_read_description(Form *)
void form_display_chyron(Form *)
int cmd_processor(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
int mpick(int, char **, int, int, int, int, char *, int)
volatile sig_atomic_t sig_received
size_t rtrim(char *)
Trims trailing spaces from string s in place.
bool handle_signal(sig_atomic_t)
uint rgb_to_curses_clr(RGB *)
bool strnfill(char *, char, uint)
void get_rfc3339_s(char *, size_t)
bool waitpid_with_timeout(pid_t, uint)
bool wait_destroy(Chyron *)
int bare_box_new(uint, uint, uint, uint, char *)
char stdio_names_str[4096]
int display_ok_message(char *)
bool verify_dir_q(char *, uint)
struct termios shell_tioctl curses_tioctl
void win_resize(uint, uint, char *)
bool construct_file_spec(char *, char *, char *, char *, char *, uint)
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)
#define CHYRON_KEY_MAXLEN
void dump_opts_by_use(char *, char *)
Chyron * wait_mk_chyron()
uint rgb_clr_to_cube(uint)
#define min(x, y)
min macro evaluates two expressions, returning least result
bool f_have_curses_tioctl
int wccp_to_str(wchar_t, uint8_t *)
bool str_to_bool(const char *)
Converts String to boolean true or false.
int win2_box_new(uint, uint, uint, uint, char *)
#define __atexit
This macro registers the end_pgm function to be called when the program exits.
char * fill_field(char *, char *, char, uint)
struct termios shell_out_tioctl curses_out_tioctl
size_t codepoint_to_utf8(uint32_t codepoint, uint8_t *utf8)
char * stdio_fdnames(char *, char *)
int display_curses_keys()
void initialize_styles(SIO *)
void display_argv_error_msg(char *, char **)
struct termios shell_in_tioctl curses_in_tioctl
struct termios shell_err_tioctl curses_err_tioctl
void free_menu_line(Line *)
int ui_waddnstr(UiSurface *s, uint w, const char *text, int m)
int ui_draw_vline(UiSurface *s, uint w, uint y, uint x, uint len, const UiStyle *style)
int ui_wadd_wch(UiSurface *s, uint w, const UiCell *cell)
int ui_draw_ch_yx(UiSurface *s, uint w, uint y, uint x, const char c)
int ui_wclrtobot(UiSurface *s, uint w)
int ui_mvwadd_wchstr(UiSurface *s, uint w, uint y, uint x, const UiCell *cell)
int ui_cursor_move(UiSurface *s, uint w, uint y, uint x)
int ui_mvwaddnstr(UiSurface *s, uint w, uint y, uint x, const char *text, int m)
UiRuntime * ui_init(const UiConfig *config)
void ui_getyx(UiSurface *s, uint w, uint *lines, uint *cols)
int ui_surface_hide(UiSurface *s, uint w)
int ui_wshow(UiSurface *s, uint w)
int ui_wset_style(UiSurface *s, uint w, const UiStyle *style)
int ui_bkgdset(UiSurface *s, uint w, const UiCell *cell)
int ui_mice_enable(int mask)
UiSurface * ui_surface_new(uint w, UiSurface *parent, uint p, uint lines, uint cols, uint y, uint x)
int ui_mvwaddstr(UiSurface *s, uint w, uint y, uint x, const char *text)
int ui_setscrreg(UiSurface *s, uint w, uint top, uint bottom)
int ui_scrollok(UiSurface *s, uint w, bool enable)
int ui_wadd_wchnstr(UiSurface *s, uint w, const UiCell *cell, uint m)
int ui_add_color_rgb(RGB *rgb)
int ui_mvwaddnwstr(UiSurface *s, uint w, uint y, uint x, const wchar_t *wstr, int m)
int ui_wclear(UiSurface *s, uint w)
int ui_draw_text_n(UiSurface *s, uint w, uint y, uint x, const char *text, int m)
int ui_mvwadd_wchnstr(UiSurface *s, uint w, uint y, uint x, const UiCell *cell, uint m)
int ui_draw_box_title(UiSurface *s, uint w, uint x, const UiStyle *style, const char *title)
int ui_get_event_no_mouse(UiSurface *surface, uint w, UiEvent *ev)
int ui_mvwaddch(UiSurface *s, uint w, uint y, uint x, const char c)
int ui_get_event(UiSurface *s, uint w, UiEvent *ev, int timeout_ms)
Wait for an input event on target (or stdscr if NULL).
int ui_bkgd(UiSurface *s, uint w, const UiCell *cell)
int ui_draw_text(UiSurface *s, uint w, uint y, uint x, const char *text)
int ui_wresize(UiSurface *s, uint w, uint lines, uint cols)
struct notcurses NotCurses
struct notcurses_options NotCursesOptions
void ui_surface_destroy(UiSurface *s)
int ui_surface_move(UiSurface *s, uint w, uint y, uint x)
int ui_idlok(UiSurface *s, uint w, bool enable)
int ui_waddnwstr(UiSurface *s, uint w, const wchar_t *wstr, int m)
int ui_mvaddstr(UiSurface *s, uint w, uint y, uint x, const char *text)
int ui_wmove(UiSurface *s, uint w, uint y, uint x)
UiSurface * ui_surface[UI_SFC_MAX]
int ui_draw_text_fill(UiSurface *s, uint w, uint y, uint x, const char *text, int m)
uint32_t ui_get_color(uint16_t color_idx)
int ui_whide(UiSurface *s, uint w)
int ui_werase(UiSurface *s, uint w)
void ui_get_screen_size(uint *lines, uint *cols)
void fast_exit(UiSurface *s)
RGB ui_hex_to_rgb(char *s)
int ui_waddstr(UiSurface *s, uint w, const char *text)
int ui_wclrtoeol(UiSurface *s, uint w)
int ui_wscrl(UiSurface *s, uint w, int rows)
int ui_mousemask(int mask)
int ui_wset_base(UiSurface *s, uint w, const UiStyle *style, uint32_t fill_ch)
int ui_get_event_multi(UiSurface *s, uint w, UiEvent *ev, int timeout_ms)
UiCell ui_cell_from_ucp(const wchar_t *ucp, const uint32_t *fg, const uint32_t *bg)
int ui_curs_set(int visibility)
int ui_top_panel(UiSurface *s, uint w)
int ui_wnoutrefresh(UiSurface *s, uint w)
int ui_surface_resize(UiSurface *s, uint w, uint lines, uint cols)
int ui_surface_show(UiSurface *s, uint w)
int ui_draw_hline(UiSurface *s, uint w, uint y, uint x, uint len, const UiStyle *style)
UiSurface * ui_box_surface_new(UiSurface *parent, uint p, uint lines, uint cols, uint y, uint x, char *title)
int ui_wadd_wchstr(UiSurface *s, uint w, const UiCell *cell)
struct ncplane_options NcPlaneOptions
int ui_keypad(UiSurface *s, uint w, bool enable)
int ui_cursor_enable(UiSurface *s, uint w, bool visible)
Disable (visible = false) or enable (visibile = true) the cursor at its current position on the surfa...
int ui_idcok(UiSurface *s, uint w, bool enable)
void ui_get_caps(UiCaps *caps)
Query the capabilities of the active backend.
int ui_mvwadd_wch(UiSurface *s, uint w, uint y, uint x, const UiCell *cell)
int ui_draw_border(UiSurface *s, uint w, UiBorderKind kind, const UiStyle *style)
UiBackend ui_get_backend()
Return which backend is powering this runtime.
int ui_surface_addpad(UiSurface *s, uint w, uint view_win, uint lines, uint cols)
void ui_getmaxyx(UiSurface *s, uint w, uint *lines, uint *cols)
int ui_cursor_enable_yx(UiSurface *s, uint w, uint y, uint x, bool visible)
Disable (visible = false) or enable (visibile = true) the cursor at a specified position on the surfa...
int ui_mvwaddwstr(UiSurface *s, uint w, uint y, uint x, const wchar_t *wstr)
int ui_mvwaddstr_fill(UiSurface *s, uint w, uint y, uint x, const char *str, int m)
int ui_waddch(UiSurface *s, uint w, const char c)
int ui_draw_ch(UiSurface *s, uint w, const char c)
int ui_waddwstr(UiSurface *s, uint w, const wchar_t *wstr)
int ui_surface_addwin(UiSurface *s, uint w, uint p, uint lines, uint cols, uint y, uint x)
int ui_chg_color(uint16_t color_idx, uint32_t *color)
int get_cmd_spec(View *, char *)
int view_accept_cmd(View *)
int ui_get_pair(uint16_t pair, uint *fg, uint *bg)
uint ui_init_color_hex(char *s)
uint64_t ui_get_channels_from_pair(uint16_t pair)
int ui_pair_content(uint pair, uint *fg, uint *bg)
int ui_getmaxx(UiSurface *s, uint w)
int ui_bkgrndset(UiSurface *s, uint w, const UiCell *cell)
int ui_init_color(uint color, uint r, uint g, uint b)
int ui_init_pair(uint pair, uint fg, uint bg)
uint ui_add_pair(uint fg, uint bg)
int ui_getcchar(const UiCell *uc, wchar_t *wstr, attr_t *attrs, uint16_t *pair, void *opts)
int ui_color_content(uint color, uint *r, uint *g, uint *b)
int ui_getmaxy(UiSurface *s, uint w)
int ui_bkgrnd(UiSurface *s, uint w, const UiCell *cell)
int ui_setcchar(cchar_t *wch, const wchar_t *wc, const attr_t attrs, short pair, const void *opts)
NcPlane * ncplane_clicked(NcPlane *pile_member, ncinput *ni)
int mk_chimera(UiCell *cell, char c)
uint get_plane_idx(UiSurface *s, struct ncplane *plane)
uint form_yx_to_fidx(Form *, uint, uint)
int cf_accept(UiSurface *sfc, uint 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 *)
uint rgb_to_xterm256_idx(RGB *rgb)
Convert RGB color to XTerm 256 color index.
int surface_box_win_new(uint wlines, uint wcols, uint wbegy, uint wbegx, char *wtitle)
char const colors_text[][10]
Color names for .minitrc overrides.
wchar_t * mbstr_to_wcstr(const char *mb_str)
void initialize_cells(SIO *sio)
Initialize local color variables and color pairs based on SIO settings.
int border_draw(UiSurface *sfc)
bool init_clr_palette(SIO *sio)
Initialize color palette based on SIO settings.
int surface_split_box_win_new(uint wlines, uint wcols, uint split_y, uint split_x, uint wbegy, uint wbegx, char *wtitle)
void mbc_to_wc(wchar_t wc[2], const char mbc)
void apply_gamma(RGB *rgb)
Apply gamma correction to RGB color.
RGB xterm256_idx_to_rgb(uint idx)
Convert XTerm 256 color index to RGB.
int assign_chyron_win(Chyron *chyron, UiSurface *sfc, uint win, char *y)
void display_field(UiCell *cmplx_buf, uint y, uint x)
struct termios shell_tioctl
int border_ysplit(UiSurface *sfc, uint y)
Draw a box with a separator line around the specified window.
int border_ysplit_text(UiSurface *sfc, char *text, uint separator_line)
Draw a box with a separator line and text around the specified 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.
int cm_surface_destroy(UiSurface *sfc)
Destroy the most recently created surface.
int border_title(UiSurface *sfc, char *title)
Draw a box with a title around the specified window.
void destroy_curses()
Gracefully shut down NCurses and restore terminal settings.
bool action_disposition(char *title, char *action_str)
Display a simple action disposition message window or print to stderr.
int answer_yn(char *msg0, char *msg1, char *msg2, char *msg3)
Accept a single letter answer.
int Perror(char *emsg_str)
Display a simple error message window or print to stderr.
void abend(int ec, char *s)
Abnormal program termination.
int display_error(char *msg0, char *msg1, char *msg2, char *msg3)
Display an error message window or print to stderr.
void set_chyron_key_cb(Chyron *chyron, uint k, char *s, uint kc, UiCell cell_base)
Set chyron key with color pair (cp).
Chyron * destroy_chyron(Chyron *chyron)
Destroy Chyron structure.
void compile_chyron(Chyron *chyron)
construct the chyron string from the chyron structure
int get_chyron_key(Chyron *chyron, uint x)
Get keycode from chyron.
void activate_all_chyron_keys(Chyron *chyron)
Deactivate chyron key.
void unset_chyron_key(Chyron *chyron, uint k)
Unset chyron key.
void activate_chyron_key(Chyron *chyron, uint k)
Activate chyron key.
uint mbstr_to_cellstr(UiCell *cmplx_buf, const char *str, const UiCell *cell_base, uint *pos, const uint atmost)
Convert multibyte string to complex character array.
void deactivate_all_chyron_keys(Chyron *chyron)
Deactivate all chyron keys.
Chyron * new_chyron()
Create and initialize Chyron structure.
bool is_set_chyron_key(Chyron *chyron, uint k)
Check if function key label is set.
void display_chyron(UiSurface *sfc, uint w, Chyron *chyron, uint line, uint col)
Display chyron on the specified line and column of the surface.
void deactivate_chyron_key(Chyron *chyron, uint k)
Deactivate chyron key.
void set_chyron_key(Chyron *chyron, uint k, char *s, uint kc)
Set chyron key with default color pair (cp_nt_rev).
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
char * iso8601_time(char *, uint, time_t *, bool)
Formats a struct tm as an ISO 8601 string.
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
void write_cmenu_log(char *)
Write message to C-Menu log file without timestamp.
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.
void open_cmenu_log()
Open new C-Menu log file.
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
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.
char * rep_substring(const char *, const char *, const char *)
Replace all occurrences of "tgt_s" in "org_s" with "rep_s".
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
void write_cmenu_log_ts(char *)
Write message to C-Menu log file with timestamp.
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...
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.
void save_object(Pick *, char *)
Saves a string as an object in the pick structure.
void toggle_object(Pick *)
Toggles the selection state of the currently selected object in pick window.
int output_objects(Pick *)
Outputs selected objects to specified output file.
int init_pick(Init *, int, char **, uint, uint)
Initializes pick structure and opens pick input file or pipe.
void reverse_object(Pick *)
Reverses the display of the currently selected object in pick window.
int pick_engine(Init *)
Initializes pick interface, calculates window size and position, and enters picker loop.
void display_pick_page(Pick *)
Displays current page of objects in pick window.
int open_pick_win(Init *)
Initializes the pick window based on the parameters specified in the Pick structure.
bool capture_shell_tioctl()
capture_shell_tioctl() - capture shell terminal settings
char di_getch()
get single character from terminal in raw mode
bool restore_curses_tioctl()
restore_curses_tioctl() - restore curses terminal settings
bool capture_curses_tioctl()
capture_curses_tioctl() - capture 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
bool restore_shell_tioctl()
restore_shell_tioctl() - restore shell 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.
void cat_file(View *)
Concatenate File to Standard Output.
int view_cmd_processor(Init *)
Main Command Processing Loop for View.
void build_prompt(View *)
Build Prompt String.
void go_to_position(View *, off_t)
Go to Specific File Position.
void initialize_line_table(View *)
Initialize Line Table.
void destroy_line_table(View *)
Destroy Line Table.
void next_page(View *)
Advance to Next Page.
int pad_refresh(View *)
Refresh Pad and Line Number Window.
int display_prompt(View *, char *)
Display Command Line Prompt.
UiMouseAction mouse_action
Runtime state for the NotCurses backend.
A drawable surface in the NotCurses backend.
struct UiSurface * parent
struct ncplane * mplane[SUB_SFC_MAX]
struct UiRuntime * runtime
struct UiSurfaceMeta meta[SUB_SFC_MAX]
char text[CHYRON_KEY_MAXLEN]
ChyronKey * key[CHYRON_KEYS]
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]
bool f_selected[OBJ_MAXCNT]
char receiver_cmd[MAXLEN]
char provider_cmd[MAXLEN]
char provider_cmd[MAXLEN]
char ln_bg_clr_x[COLOR_LEN]
char * next_file_spec_ptr
char receiver_cmd[MAXLEN]
UiCell cmplx_buf[PAD_COLS]
char stripped_line_out[PAD_COLS]
char tmp_prompt_str[MAXLEN]
char cur_file_str[MAXLEN]
char line_out_s[PAD_COLS]