2
3
4
5
6
7
8
11
12
13
14
15
16
17
18
100void opt_prt_char(
const char *o,
const char *name,
const char *value);
101void opt_prt_str(
const char *o,
const char *name,
const char *value);
102void opt_prt_int(
const char *o,
const char *name,
int value);
103void opt_prt_double(
const char *o,
const char *name,
double value);
104void opt_prt_bool(
const char *o,
const char *name,
bool value);
112static char doc[] =
_(
"C-Menu - User Interface Toolkit");
113static char args_doc[] =
_(
"[INPUT] [OUTPUT] [HELP] [ARG4] [ARG5]");
116static struct argp_option options[] = {
117 {
"f_write_config",
'W', 0, OPTION_ARG_OPTIONAL,
"write configuration", 0},
118 {
"minitrc",
'a',
"file_spec", 0,
"configuration file spec", 1},
119 {
"parent_cmd",
'k', 0, 0,
"parent command", 1},
120 {
"begx",
'X',
"number", 0,
"begin on column", 2},
121 {
"begy",
'Y',
"number", 0,
"begin on line", 2},
122 {
"cols",
'C',
"number", 0,
"width in columns", 2},
123 {
"lines",
'L',
"number", 0,
"height in lines", 2},
124 {
"title",
'T',
"text", 0,
"Window title", 2},
125 {
"out_spec",
'o',
"file_spec", 0,
"output file spec", 3},
126 {
"cmd",
'c',
"file_spec", 0,
"view cmd, first file", 3},
127 {
"cmd_all",
'A',
"file_spec", 0,
"view cmd, all files", 3},
128 {
"help_spec",
'H',
"file_spec", 0,
"help file spec", 3},
129 {
"in_spec",
'i',
"file_spec", 0,
"input file spec", 3},
130 {
"log_level",
'l',
"text", 0,
"FATAL, ERROR, WARN, INFO, VERBOSE, DEBUG", 3},
131 {
"log_file_spec",
'g',
"file_spec", 0,
"log file spec", 3},
132 {
"mapp_spec",
'd',
"file_spec", 0,
"description file spec", 3},
133 {
"provider_cmd",
'S',
"file_spec", 0,
"execute provider of piped input", 3},
134 {
"receiver_cmd",
'R',
"file_spec", 0,
"execute receiver of piped output", 3},
135 {
"select_max",
'n',
"number", 0,
"number of selections", 5},
136 {
"f_erase_remainder",
'e',
"bool", OPTION_ARG_OPTIONAL,
"erase remainder of line on enter", 5},
137 {
"f_strip_ansi",
'j',
"bool", OPTION_ARG_OPTIONAL,
"always strip ansi when writing", 5},
138 {
"f_multiple_cmd_args",
'M',
"bool", OPTION_ARG_OPTIONAL,
"allow multiple command arguments", 5},
139 {
"f_read_theme",
'r',
"bool", OPTION_ARG_OPTIONAL,
"read and process theme file", 5},
140 {
"f_squeeze",
's',
"bool", OPTION_ARG_OPTIONAL,
"squeeze multiple blank lines", 5},
141 {
"f_ignore_case",
'x',
"bool", OPTION_ARG_OPTIONAL,
"ignore case in search", 5},
142 {
"p_view_files",
'v',
"bool", OPTION_ARG_OPTIONAL,
"File View in Pick", 5},
143 {
"wrap",
'w',
"bool", OPTION_ARG_OPTIONAL,
"view wrap lines", 5},
144 {
"f_ln",
'N',
"bool", OPTION_ARG_OPTIONAL,
"line numbers in view", 5},
145 {
"fill_char",
'f',
"char", 0,
"field fill_char (_,.,empty)", 5},
146 {
"brackets",
'u',
"text", 0,
"brackets around fields ([]{}<>)", 5},
147 {
"editor",
CM_EDITOR,
"text", 0,
"default editor", 5},
148 {
"tab_stop",
't',
"number", 0,
"number of spaces per tab (4)", 5},
149 {
"timeout_secs",
'Z',
"text", 0,
"seconds to wait for input", 3},
150 {
"h_shift",
'z',
"number", 0,
"horizontal shift width (16)", 5},
151 {
"border",
'b',
"text", 0,
"single, rounded, double, heavy, none", 5},
152 {
"bg",
BG,
"hex_clr", 0,
"Terminal (stdscr) background (#000000)", 6},
153 {
"fg",
FG,
"hex_clr", 0,
"Terminal (stdscr) foreground (#d0d0d0)", 6},
154 {
"box_fg",
BOX_FG,
"hex_clr", 0,
"box foreground (#d0d0d0)", 6},
155 {
"box_bg",
BOX_BG,
"hex_clr", 0,
"box background (#000000)", 6},
156 {
"ind_fg",
IND_FG,
"hex_clr", 0,
"indicator foreground (#d0d0d0)", 6},
157 {
"ind_bg",
IND_BG,
"hex_clr", 0,
"indicator background (#000000)", 6},
158 {
"brackets_fg",
BRACKETS_FG,
"hex_clr", 0,
"brackets foreground (#d0d0d0)", 6},
159 {
"brackets_bg",
BRACKETS_BG,
"hex_clr", 0,
"brackets background (#000000)", 6},
160 {
"fill_char_fg",
FILL_CHAR_FG,
"hex_clr", 0,
"fill character foreground (#d0d0d0)", 6},
161 {
"fill_char_bg",
FILL_CHAR_BG,
"hex_clr", 0,
"fill character background (#000000)", 6},
162 {
"nt_fg",
NT_FG,
"hex_clr", 0,
"normal foreground (#d0d0d0)", 6},
163 {
"nt_bg",
NT_BG,
"hex_clr", 0,
"normal background (#000000)", 6},
164 {
"nt_rev_fg",
NT_REV_FG,
"hex_clr", 0,
"normal reverse foreground (#000000)", 6},
165 {
"nt_rev_bg",
NT_REV_BG,
"hex_clr", 0,
"normal reverse background (#d0d0d0)", 6},
166 {
"nt_hl_fg",
NT_HL_FG,
"hex_clr", 0,
"normal highlight foreground (#ffffff)", 6},
167 {
"nt_hl_bg",
NT_HL_BG,
"hex_clr", 0,
"normal highlight background (#000000)", 6},
168 {
"nt_hl_rev_fg",
NT_HL_REV_FG,
"hex_clr", 0,
"normal highlight reverse foreground (#f00000)", 6},
169 {
"nt_hl_rev_bg",
NT_HL_REV_BG,
"hex_clr", 0,
"normal highlight reverse background (#d0d0d0)", 6},
170 {
"ln_fg",
LN_FG,
"hex_clr", 0,
"line number foreground (#0000b0)", 6},
171 {
"ln_bg",
LN_BG,
"hex_clr", 0,
"line number background (#202020)", 6},
172 {
"cmdln_fg",
CMDLN_FG,
"hex_clr", 0,
"line number foreground (#0000b0)", 6},
173 {
"cmdln_bg",
CMDLN_BG,
"hex_clr", 0,
"line number background (#202020)", 6},
174 {
"title_fg",
TITLE_FG,
"hex_clr", 0,
"title foreground (#d0d0d0)", 6},
175 {
"title_bg",
TITLE_BG,
"hex_clr", 0,
"title background (#000000)", 6},
176 {
"ran_fg",
RAN_FG,
"hex_clr", 0,
"ran foreground (#d0d0d0)", 6},
177 {
"ran_bg",
RAN_BG,
"hex_clr", 0,
"ran background (#000000)", 6},
178 {
"blue_gamma",
GM_BLUE,
"float", 0,
"blue_gamma (1.2)", 7},
179 {
"gray_gamma",
GM_GRAY,
"float", 0,
"gray gamma (1.2)", 7},
180 {
"green_gamma",
GM_GREEN,
"float", 0,
"green gamma (1.2)", 7},
181 {
"red_gamma",
GM_RED,
"float", 0,
"red gamma (View)", 7},
182 {
"black",
XBLACK,
"hex_clr", 0,
"black (#000000)", 8},
183 {
"red",
XRED,
"hex_clr", 0,
"red (#bf0000)", 8},
184 {
"green",
XGREEN,
"hex_clr", 0,
"green (#00cf00)", 8},
185 {
"yellow",
XYELLOW,
"hex_clr", 0,
"yellow (#efbf00)", 8},
186 {
"blue",
XBLUE,
"hex_clr", 0,
"blue (#0000FF)", 8},
187 {
"magenta",
XMAGENTA,
"hex_clr", 0,
"magenta (#9f009f)", 8},
188 {
"cyan",
XCYAN,
"hex_clr", 0,
"cyan (#00dfdf)", 8},
189 {
"white",
XWHITE,
"hex_clr", 0,
"white (#d0d0d0)", 8},
190 {
"bblack",
XBBLACK,
"hex_clr", 0,
"bright black (#7f7f7f)", 8},
191 {
"bred",
XBRED,
"hex_clr", 0,
"bright red (#FF3737)", 8},
192 {
"bgreen",
XBGREEN,
"hex_clr", 0,
"bright green (#00FF7f)", 8},
193 {
"byellow",
XBYELLOW,
"hex_clr", 0,
"bright yellow (#FFeF00)", 8},
194 {
"bblue",
XBBLUE,
"hex_clr", 0,
"bright blue (#00cfFF)", 8},
195 {
"bmagenta",
XMAGENTA,
"hex_clr", 0,
"bright magenta (#FF00FF)", 8},
196 {
"bcyan",
XBCYAN,
"hex_clr", 0,
"bright cyan (#00FFFF)", 8},
197 {
"bwhite",
XBWHITE,
"hex_clr", 0,
"bright white (#FFFFFF)", 8},
198 {
"mapp_data",
MAPP_DATA,
"directory", 0,
"data directory", 9},
199 {
"mapp_help",
MAPP_HELP,
"directory", 0,
"help directory", 9},
200 {
"mapp_home",
MAPP_HOME,
"directory", 0,
"home directory", 9},
201 {
"mapp_msrc",
MAPP_MSRC,
"directory", 0,
"source directory", 9},
202 {
"mapp_user",
MAPP_USER,
"directory", 0,
"user directory", 9},
203 {
"mapp_theme",
MAPP_THEME,
"file", 0,
"default theme file", 9},
208parse_opt(
int key,
char *arg,
struct argp_state *state) {
209 Init *init = state->input;
210 SIO *sio = init
->sio;
256 if (!strcmp(arg,
"SILENT"))
258 else if (!strcmp(arg,
"DEBUG"))
260 else if (!strcmp(arg,
"INFO"))
262 else if (!strcmp(arg,
"WARN"))
264 else if (!strcmp(arg,
"ERROR"))
266 else if (!strcmp(arg,
"FATAL"))
298 if (arg && arg[0] ==
't')
300 else if (arg && arg[0] ==
'f')
328 if (arg && arg[0] ==
't')
330 else if (arg && arg[0] ==
'f')
341 sscanf(arg,
"#%06x", &sio
->bg);
344 sscanf(arg,
"#%06x", &sio
->fg);
348 if (c ==
'r' || c ==
'R')
350 else if (c ==
's' || c ==
'S')
352 else if (c ==
'd' || c ==
'D')
354 else if (c ==
'h' || c ==
'H')
384 sscanf(arg,
"#%06x", &sio
->nt_fg);
387 sscanf(arg,
"#%06x", &sio
->nt_bg);
414 sscanf(arg,
"#%06x", &sio
->ln_fg);
417 sscanf(arg,
"#%06x", &sio
->ln_bg);
468 if (state->arg_num >= 35)
470 init
->argv[state->arg_num] = strdup(arg);
473 init
->argc = state->arg_num;
474 init
->argv[state->arg_num + 1] =
nullptr;
477 return ARGP_ERR_UNKNOWN;
482static struct argp argp = {options, parse_opt, args_doc, doc,
483 nullptr,
nullptr,
nullptr};
486
487
488
489
490
491
492
493
494
495
496
497
502 setlocale(LC_ALL,
"en_US.UTF-8");
504 init
->sio = (SIO *)calloc(1,
sizeof(SIO));
509 SIO *sio = init
->sio;
512 _(
"init struct not allocated on entry"));
516 e = getenv(
"CMENU_HOME");
517 if (!e || *e ==
'\0')
528 e = getenv(
"CMENU_RC");
529 if (!e || *e ==
'\0') {
587 if (e ==
nullptr || *e ==
'\0')
591 e = getenv(
"EDITOR");
599 ui_log(INFO,
"mapp_initialization");
600 ui_log(INFO,
_(
"config files processed"));
603 argp_parse(&argp, argc, argv, 0, 0, init);
612
613
614
615
616
617
618
619
620
621
624 argp_parse(&argp, argc, argv, 0, 0, init);
629
630
631
632
633
634
635
636
663
664
665
666
667
668
669
670
671
672
674 char config_file_name[
MAXLEN];
677 char *e = getenv(
"MINITRC");
695 char include_file_name[
MAXLEN];
698 SIO *sio = init
->sio;
702 FILE *config_fp = fopen(config_file_name,
"r");
703 char quote_char =
'\0';
705 fprintf(stderr,
"failed to read file: %s %s\n", config_file_name, strerror(errno));
708 while (fgets(tmp_str,
sizeof(tmp_str), config_fp)) {
709 bool inquotes =
false;
710 if (tmp_str[0] ==
'#')
716 while (*src_p !=
'\0') {
724 if (*src_p ==
'"' && *src_p ==
' ') {
733 while (*src_p !=
'\0') {
734 if ((*src_p ==
'"' || *src_p ==
'\'') && (*(src_p + 1) !=
'\\')) {
737 quote_char = *src_p++;
738 }
else if (*src_p == quote_char) {
747 dp = value + strlen(value);
752 if (*src_p ==
' ' || *src_p ==
';') {
756 if (*src_p ==
'\n') {
765 if (value[0] ==
'\0')
767 if (!strcmp(key,
"include")) {
773 if (!strcmp(key,
"minitrc")) {
777 if (!strcmp(key,
"lines")) {
781 if (!strcmp(key,
"cols")) {
785 if (!strcmp(key,
"begy")) {
789 if (!strcmp(key,
"begx")) {
793 if (!strcmp(key,
"f_ln")) {
797 if (!strcmp(key,
"f_at_end_remove")) {
801 if (!strcmp(key,
"f_erase_remainder")) {
805 if (!strcmp(key,
"brackets")) {
809 if (!strcmp(key,
"fill_char")) {
810 if (strlen(value) > 1)
812 if (wcwidth((
int)value[0]) > 1)
817 if (!strcmp(key,
"f_ignore_case")) {
821 if (!strcmp(key,
"p_view_files")) {
825 if (!strcmp(key,
"f_read_theme")) {
829 if (!strcmp(key,
"f_squeeze")) {
833 if (!strcmp(key,
"f_strip_ansi")) {
837 if (!strcmp(key,
"f_multiple_cmd_args")) {
841 if (!strcmp(key,
"select_max")) {
845 if (!strcmp(key,
"tab_stop")) {
849 if (!strcmp(key,
"timeout_secs")) {
853 if (!strcmp(key,
"h_shift")) {
857 if (!strcmp(key,
"wrap")) {
861 if (!strcmp(key,
"title")) {
865 if (!strcmp(key,
"cmd")) {
869 if (!strcmp(key,
"cmd_all")) {
873 if (!strcmp(key,
"parent_cmd")) {
877 if (!strcmp(key,
"provider_cmd")) {
881 if (!strcmp(key,
"receiver_cmd")) {
885 if (!strcmp(key,
"editor")) {
889 if (!strcmp(key,
"border")) {
891 if (c ==
'r' || c ==
'R')
893 else if (c ==
's' || c ==
'S')
895 else if (c ==
'd' || c ==
'D')
897 else if (c ==
'h' || c ==
'H')
903 if (!strcmp(key,
"fg")) {
904 sscanf(value,
"#%06x", &sio
->fg);
907 if (!strcmp(key,
"bg")) {
908 sscanf(value,
"#%06x", &sio
->bg);
911 if (!strcmp(key,
"box_fg")) {
912 sscanf(value,
"#%06x", &sio
->fg);
915 if (!strcmp(key,
"box_bg")) {
916 sscanf(value,
"#%06x", &sio
->box_bg);
919 if (!strcmp(key,
"ind_fg")) {
920 sscanf(value,
"#%06x", &sio
->ind_fg);
923 if (!strcmp(key,
"ind_bg")) {
924 sscanf(value,
"#%06x", &sio
->ind_bg);
927 if (!strcmp(key,
"brackets_fg")) {
931 if (!strcmp(key,
"brackets_bg")) {
935 if (!strcmp(key,
"fill_char_fg")) {
939 if (!strcmp(key,
"fill_char_bg")) {
943 if (!strcmp(key,
"ln_fg")) {
944 sscanf(value,
"#%06x", &sio
->ln_fg);
947 if (!strcmp(key,
"ln_bg")) {
948 sscanf(value,
"#%06x", &sio
->ln_bg);
951 if (!strcmp(key,
"cmdln_fg")) {
955 if (!strcmp(key,
"cmdln_bg")) {
959 if (!strcmp(key,
"nt_fg")) {
960 sscanf(value,
"#%06x", &sio
->nt_fg);
963 if (!strcmp(key,
"nt_bg")) {
964 sscanf(value,
"#%06x", &sio
->nt_bg);
967 if (!strcmp(key,
"nt_rev_fg")) {
971 if (!strcmp(key,
"nt_rev_bg")) {
975 if (!strcmp(key,
"nt_hl_fg")) {
979 if (!strcmp(key,
"nt_hl_bg")) {
983 if (!strcmp(key,
"nt_hl_rev_fg")) {
987 if (!strcmp(key,
"nt_hl_rev_bg")) {
991 if (!strcmp(key,
"title_fg")) {
995 if (!strcmp(key,
"title_bg")) {
999 if (!strcmp(key,
"ran_fg")) {
1000 sscanf(value,
"#%06x", &sio
->ran_fg);
1003 if (!strcmp(key,
"ran_bg")) {
1004 sscanf(value,
"#%06x", &sio
->ran_bg);
1007 if (!strcmp(key,
"red_gamma")) {
1011 if (!strcmp(key,
"green_gamma")) {
1015 if (!strcmp(key,
"blue_gamma")) {
1019 if (!strcmp(key,
"gray_gamma")) {
1023 if (!strcmp(key,
"black")) {
1024 sscanf(value,
"#%06x", &sio
->black);
1027 if (!strcmp(key,
"red")) {
1028 sscanf(value,
"#%06x", &sio
->red);
1031 if (!strcmp(key,
"green")) {
1032 sscanf(value,
"#%06x", &sio
->green);
1035 if (!strcmp(key,
"yellow")) {
1036 sscanf(value,
"#%06x", &sio
->yellow);
1039 if (!strcmp(key,
"blue")) {
1040 sscanf(value,
"#%06x", &sio
->blue);
1043 if (!strcmp(key,
"magenta")) {
1047 if (!strcmp(key,
"cyan")) {
1048 sscanf(value,
"#%06x", &sio
->cyan);
1051 if (!strcmp(key,
"white")) {
1052 sscanf(value,
"#%06x", &sio
->white);
1055 if (!strcmp(key,
"orange")) {
1056 sscanf(value,
"#%06x", &sio
->orange);
1059 if (!strcmp(key,
"bblack")) {
1060 sscanf(value,
"#%06x", &sio
->bblack);
1063 if (!strcmp(key,
"bred")) {
1064 sscanf(value,
"#%06x", &sio
->bred);
1067 if (!strcmp(key,
"bgreen")) {
1068 sscanf(value,
"#%06x", &sio
->bgreen);
1071 if (!strcmp(key,
"byellow")) {
1075 if (!strcmp(key,
"bblue")) {
1076 sscanf(value,
"#%06x", &sio
->bblue);
1079 if (!strcmp(key,
"bmagenta")) {
1083 if (!strcmp(key,
"bcyan")) {
1084 sscanf(value,
"#%06x", &sio
->bcyan);
1087 if (!strcmp(key,
"bwhite")) {
1088 sscanf(value,
"#%06x", &sio
->bwhite);
1091 if (!strcmp(key,
"borange")) {
1095 if (!strcmp(key,
"mapp_spec")) {
1099 if (!strcmp(key,
"mapp_data")) {
1103 if (!strcmp(key,
"mapp_help")) {
1107 if (!strcmp(key,
"mapp_home")) {
1111 if (!strcmp(key,
"mapp_msrc")) {
1115 if (!strcmp(key,
"mapp_user")) {
1119 if (!strcmp(key,
"mapp_theme")) {
1123 if (!strcmp(key,
"log_file_spec")) {
1127 if (!strcmp(key,
"log_level")) {
1129 if (!strcmp(value,
"SILENT"))
1131 else if (!strcmp(value,
"DEBUG"))
1133 else if (!strcmp(value,
"INFO"))
1135 else if (!strcmp(value,
"WARN"))
1137 else if (!strcmp(value,
"ERROR"))
1139 else if (!strcmp(value,
"FATAL"))
1146 (
void)fclose(config_fp);
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1162 char minitrc_dmp[
MAXLEN];
1164 SIO *sio = init
->sio;
1165 e = getenv(
"CMENU_HOME");
1166 minitrc_dmp[0] =
'\0';
1173 ui_log(INFO,
_(
"writing config file to: %s"), minitrc_dmp);
1174 FILE *minitrc_fp = fopen(minitrc_dmp,
"w");
1175 if (minitrc_fp == (FILE *)0) {
1177 ui_log(ERROR,
"em0");
1180 (
void)fprintf(minitrc_fp,
"# %s\n", minitrc_dmp);
1181 char *doc_tbl[50] = {
1182 _(
"# C-Menu example configuration file"),
1184 _(
"# This file is generated by C-Menu when run with the -W option."),
1185 _(
"# Copy this file and edit the copy because this file will be"),
1186 _(
"# overwritten each time C-Menu is run with the - W option."),
1188 _(
"# C-Menu processes key value pairs in reading order from its"),
1189 _(
"# main configuraiton file, ~/ menuapp /.minitrc, and any other"),
1190 _(
"# configuration files sourced with include statements such as"),
1191 _(
"# the following:"),
1193 _(
"# include = ~/menuapp/theme/default"),
1195 _(
"# Assuming your configuration file is in ~/menuapp/theme/Red,"),
1196 _(
"# you could create a symbolic link named default that points to"),
1197 _(
"# Red, and then include default in your main configuration file."),
1198 _(
"# (Actually ~/menuapp/.minitrc already includes default, so you"),
1199 _(
"# would only need to create the theme file and the symbolic link."),
1201 _(
"# ln -s Red default"),
1203 _(
"# Key value pairs included from configuration files are"),
1204 _(
"# processed in reading order as they are included."),
1206 _(
"# This is significant in the event that a key is included more"),
1207 _(
"# than once in the configuration file and / or included files."),
1208 _(
"# Only the last value read for a key will be used by C-Menu."),
1210 _(
"# If you want to override key values in the C-Menu configuration"),
1211 _(
"# file, you can do so by inserting an include statement for a"),
1212 _(
"# supplemental configuration file below the keys you want to"),
1213 _(
"# override in the C-Menu configuration file. Conversely, if you"),
1214 _(
"# want to use a supplemental configuration as the default,"),
1215 _(
"# include it first."),
1217 _(
"# Parsing: Lines beginning with # are comments and are ignored."),
1218 _(
"# Lines containing key=value pairs are parsed and the key and"),
1219 _(
"# value are extracted. Lines without an '=' are ignored. Values"),
1220 _(
"# are stripped of leading and trailing whitespace and quotes."),
1221 _(
"# Values can be enclosed in single or double quotes to preserve"),
1222 _(
"# leading and trailing whitespace. Values can also be specified"),
1223 _(
"# as hex color codes such as #ff0000 for red. If a value is"),
1224 _(
"# specified as a hex color code, it is parsed and stored as a"),
1225 _(
"# hex color code in the configuration. An unquoted '#' that is"),
1226 _(
"# not part of a six digit hex color code and after key values"),
1227 _(
"# have been extracted is the beginning of a comment."),
""};
1228 for (
int i = 0; doc_tbl[i][0] !=
'\0'; i++)
1229 (
void)fprintf(minitrc_fp,
"%s\n", doc_tbl[i]);
1230 (
void)fprintf(minitrc_fp,
"#\n");
1411 (
void)fprintf(minitrc_fp,
"%-34s # default theme file\n", config_s);
1421 (
void)fprintf(minitrc_fp,
"%-34s # %s\n", config_s, comment);
1423 (
void)fprintf(minitrc_fp,
"%-34s #\n", config_s);
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1441 if (!file_name || !*file_name) {
1448 e = getenv(
"MAPP_DIR");
1465
1466
1467
1469 fprintf(stdout,
"\nC-Menu %s\n",
CM_VERSION);
1470 fprintf(stdout,
"\nC-Menu %s\n",
CM_VERSION);
1471 fprintf(stdout,
"C version: %ld\n", __STDC_VERSION__);
1474
1475
1476
1477
1478
1479
1481 fprintf(stdout,
"%3s %-15s: %s\n", o, name, value);
1484
1485
1486
1487
1488
1489
1490
1492 fprintf(stdout,
"%3s %-15s: %s\n", o, name, value);
1495
1496
1497
1498
1499
1500
1501
1503 fprintf(stdout,
"%3s %-15s: %d\n", o, name, value);
1506
1507
1508
1509
1510
1511
1512
1514 fprintf(stdout,
"%3s %-15s: %0.2f\n", o, name, value);
1517
1518
1519
1520
1521
1522
1523
1524
1526 fprintf(stdout,
"%3s %-15s: %s\n", o, name, value ?
"true" :
"false");
bool str_to_bool(const char *)
Converts String to boolean true or false.
FILE * ui_open_log()
Open the log file for writing.
const char *const ui_log_level_s[]
UiLogLevel ui_min_log_level
void ui_abend(int ec, char *s)
Convert multibyte string to complex character array.
const char * argp_program_version
int process_config_file(char *, Init *)
void print_argp_doc(FILE *, char *, char *)
const char * argp_program_bug_address
size_t strnz__cpy(char *, const char *, size_t)
safer alternative to strncpy
bool str_to_upper(char *)
Converts a string to uppercase.
double str_to_double(char *)
converts string to double
size_t ssnprintf(char *, size_t, const char *,...)
ssnprintf was designed to be a safer alternative to snprintf.
bool expand_tilde(char *, uint)
Replaces "~/" in string with the user's home directory.
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.
int destroy_argv(uint argc, char **argv)
Deallocates memory allocated for argument strings in argv.
bool verify_dir(char *, uint)
Verifies that the directory specified by "spec" exists and is accessible with the permissions specifi...
bool trim_path(char *)
Trims trailing spaces and slashes from directory path in place.
bool unstr_hex_clr(char *, char *)
Validates that a string is a hex color code in the format "#RRGGBB".
void opt_prt_str(const char *o, const char *name, const char *value)
Print an option and its value in a formatted manner for integer values.
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.
void display_version()
Display the version information of the application.
void opt_prt_double(const char *o, const char *name, double value)
Print an option and its value in a formatted manner for double values.
void opt_prt_char(const char *o, const char *name, const char *value)
Print an option and its value in a formatted manner.
int write_config(Init *init)
Write the current configuration to a file specified in init->minitrc.
void opt_prt_bool(const char *o, const char *name, bool value)
Print an option and its value in a formatted manner for boolean values.
void opt_prt_int(const char *o, const char *name, int value)
Print an option and its value in a formatted manner for integer values.
int process_config_files(Init *)
parse the configuration file specified in init->minitrc and set Init struct values accordingly
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.
int ui_perror(char *emsg_str)
Display a simple error message window or print to stderr.
char log_file_spec[MAXLEN]
char receiver_cmd[MAXLEN]
char provider_cmd[MAXLEN]