2
3
4
5
6
7
8
14#define _XOPEN_SOURCE_EXTENDED 1
15#define NCURSES_WIDECHAR 1
16#include <ncursesw/ncurses.h>
28#define MAX_WIDE_LEN 1024
30#define PICK_MAX_ARG_LEN 256
31#define MAX_PICK_OBJS 1024
32#define ACCEPT_PROMPT_CHAR '_'
34#define MENU_HELP_FILE "menu.help"
35#define FORM_HELP_FILE "form.help"
36#define PICK_HELP_FILE "pick.help"
37#define VIEW_HELP_FILE "view.help"
38#define VIEW_PRT_FILE "prtout"
39#define DEFAULTEDITOR "vi"
41#define MINITRC ".minitrc"
43#define MAPP_DIR "~/menuapp"
44#define PRINTCMD "lp -c -s"
53 int main(int argc, char **argv) {
55 capture_shell_tioctl();
56 Init *init = new_init(argc, argv);
58 mapp_initialization(init);
61 capture_curses_tioctl();
64#define destroy_cmenu()
99
100
101
102
103
118
128
130
185extern Form *
new_form(Init *,
int,
char **,
int,
int);
186extern Pick *
new_pick(Init *,
int,
char **,
int,
int);
187extern Menu *
new_menu(Init *,
int,
char **,
int,
int);
188extern int popup_menu(Init *,
int,
char **,
int,
int);
189extern int popup_form(Init *,
int,
char **,
int,
int);
190extern int popup_pick(Init *,
int,
char **,
int,
int);
191extern int popup_view(Init *,
int,
char **,
int,
int,
int,
int);
205extern int init_form(Init *,
int,
char **,
int,
int);
206extern int init_pick(Init *,
int,
char **,
int,
int);
int cmd_processor(Init *)
int popup_form(Init *, int, char **, int, int)
instantiate a form popup window
int popup_menu(Init *, int, char **, int, int)
instantiate a menu popup window
int popup_view(Init *, int, char **, int, int, int, int)
instantiate a view popup window
int popup_pick(Init *, int, char **, int, int)
instantiate a pick popup window
volatile sig_atomic_t sig_received
bool handle_signal(sig_atomic_t)
#define __atexit
This macro registers the end_pgm function to be called when the program exits.
int popup_ckeys()
Display Curses Keys Responds to curses keys and mouse events, displaying the key code and description...
void view_win_resize(Init *, char *)
Resize the current window and its box, and update the title.
int box_new(int, int, int, int, char *, bool)
Create a new window with optional box and title.
void view_full_screen_resize(Init *)
Resize the full screen view and its components.
WINDOW * win_del()
Delete the current window and its associated box window.
int Perror(char *)
Display a simple error message window or print to stderr.
int display_error(char *em0, char *em1, char *em2, char *em3)
Display an error message window or print to stderr.
int init_form(Init *, int, char **, int, int)
Initialize form data structure and parse description file.
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
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 *)
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_win_dimensions(Init *, char *title)
Calculate the dimensions and position of the box window for C-Menu View.
int init_view_full_screen(Init *)
Initialize C-Menu View in full screen mode.
int init_view_boxwin(Init *, char *)
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(View *, char *)
Initialize the input for a C-Menu View.
View * destroy_view(Init *init)
Destroy View structure.
Form * new_form(Init *, int, char **, int, int)
Create and initialize Form structure.
bool init_menu_files(Init *, int, char **)
Initialize Menu file specifications.
Init * new_init(int, char **)
Create and initialize Init structure.
Menu * new_menu(Init *, int, char **, int, int)
Create and initialize Menu structure.
Menu * destroy_menu(Init *init)
Destroy Menu structure.
Form * destroy_form(Init *init)
Destroy Form structure.
View * new_view(Init *)
Create and initialize View structure.
Pick * new_pick(Init *, int, char **, int, int)
Create and initialize Pick structure.
Init * destroy_init(Init *init)
Destroy Init structure.
Pick * destroy_pick(Init *init)
Destroy Pick structure.
unsigned int menu_engine(Init *)
The main loop of the menu system.
unsigned int parse_menu_description(Init *)
Parse menu description file and create Menu.
int init_pick(Init *, int, char **, int, int)
Initializes pick structure and opens pick input file or pipe.
int pick_engine(Init *)
Initializes pick interface, calculates window size and position, and enters picker loop.
int open_pick_win(Init *)
Initializes the pick window based on the parameters specified in the Pick structure.
int view_file(Init *)
Start view.
char receiver_cmd[MAXLEN]
char provider_cmd[MAXLEN]