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 {
"mapp_spec",
'd',
"file_spec", 0,
"description file spec", 3},
132 {
"provider_cmd",
'S',
"file_spec", 0,
"execute provider of piped input", 3},
133 {
"receiver_cmd",
'R',
"file_spec", 0,
"execute receiver of piped output", 3},
134 {
"select_max",
'n',
"number", 0,
"number of selections", 5},
135 {
"f_erase_remainder",
'e',
"bool", OPTION_ARG_OPTIONAL,
"erase remainder of line on enter", 5},
136 {
"f_strip_ansi",
'j',
"bool", OPTION_ARG_OPTIONAL,
"always strip ansi when writing", 5},
137 {
"f_multiple_cmd_args",
'M',
"bool", OPTION_ARG_OPTIONAL,
"allow multiple command arguments", 5},
138 {
"f_read_theme",
'r',
"bool", OPTION_ARG_OPTIONAL,
"read and process theme file", 5},
139 {
"f_squeeze",
's',
"bool", OPTION_ARG_OPTIONAL,
"squeeze multiple blank lines", 5},
140 {
"f_ignore_case",
'x',
"bool", OPTION_ARG_OPTIONAL,
"ignore case in search", 5},
141 {
"p_view_files",
'v',
"bool", OPTION_ARG_OPTIONAL,
"File View in Pick", 5},
142 {
"wrap",
'w',
"bool", OPTION_ARG_OPTIONAL,
"view wrap lines", 5},
143 {
"f_ln",
'N',
"bool", OPTION_ARG_OPTIONAL,
"line numbers in view", 5},
144 {
"fill_char",
'f',
"char", 0,
"field fill_char (_,.,empty)", 5},
145 {
"brackets",
'u',
"text", 0,
"brackets around fields ([]{}<>)", 5},
146 {
"editor",
CM_EDITOR,
"text", 0,
"default editor", 5},
147 {
"tab_stop",
't',
"number", 0,
"number of spaces per tab (4)", 5},
148 {
"timeout_secs",
'Z',
"text", 0,
"seconds to wait for input", 3},
149 {
"h_shift",
'z',
"number", 0,
"horizontal shift width (16)", 5},
150 {
"border",
'b',
"text", 0,
"single, rounded, double, heavy, none", 5},
151 {
"bg",
BG,
"hex_clr", 0,
"Terminal (stdscr) background (#000000)", 6},
152 {
"fg",
FG,
"hex_clr", 0,
"Terminal (stdscr) foreground (#d0d0d0)", 6},
153 {
"box_fg",
BOX_FG,
"hex_clr", 0,
"box foreground (#d0d0d0)", 6},
154 {
"box_bg",
BOX_BG,
"hex_clr", 0,
"box background (#000000)", 6},
155 {
"ind_fg",
IND_FG,
"hex_clr", 0,
"indicator foreground (#d0d0d0)", 6},
156 {
"ind_bg",
IND_BG,
"hex_clr", 0,
"indicator background (#000000)", 6},
157 {
"brackets_fg",
BRACKETS_FG,
"hex_clr", 0,
"brackets foreground (#d0d0d0)", 6},
158 {
"brackets_bg",
BRACKETS_BG,
"hex_clr", 0,
"brackets background (#000000)", 6},
159 {
"fill_char_fg",
FILL_CHAR_FG,
"hex_clr", 0,
"fill character foreground (#d0d0d0)", 6},
160 {
"fill_char_bg",
FILL_CHAR_BG,
"hex_clr", 0,
"fill character background (#000000)", 6},
161 {
"nt_fg",
NT_FG,
"hex_clr", 0,
"normal foreground (#d0d0d0)", 6},
162 {
"nt_bg",
NT_BG,
"hex_clr", 0,
"normal background (#000000)", 6},
163 {
"nt_rev_fg",
NT_REV_FG,
"hex_clr", 0,
"normal reverse foreground (#000000)", 6},
164 {
"nt_rev_bg",
NT_REV_BG,
"hex_clr", 0,
"normal reverse background (#d0d0d0)", 6},
165 {
"nt_hl_fg",
NT_HL_FG,
"hex_clr", 0,
"normal highlight foreground (#ffffff)", 6},
166 {
"nt_hl_bg",
NT_HL_BG,
"hex_clr", 0,
"normal highlight background (#000000)", 6},
167 {
"nt_hl_rev_fg",
NT_HL_REV_FG,
"hex_clr", 0,
"normal highlight reverse foreground (#f00000)", 6},
168 {
"nt_hl_rev_bg",
NT_HL_REV_BG,
"hex_clr", 0,
"normal highlight reverse background (#d0d0d0)", 6},
169 {
"ln_fg",
LN_FG,
"hex_clr", 0,
"line number foreground (#0000b0)", 6},
170 {
"ln_bg",
LN_BG,
"hex_clr", 0,
"line number background (#202020)", 6},
171 {
"cmdln_fg",
CMDLN_FG,
"hex_clr", 0,
"line number foreground (#0000b0)", 6},
172 {
"cmdln_bg",
CMDLN_BG,
"hex_clr", 0,
"line number background (#202020)", 6},
173 {
"title_fg",
TITLE_FG,
"hex_clr", 0,
"title foreground (#d0d0d0)", 6},
174 {
"title_bg",
TITLE_BG,
"hex_clr", 0,
"title background (#000000)", 6},
175 {
"ran_fg",
RAN_FG,
"hex_clr", 0,
"ran foreground (#d0d0d0)", 6},
176 {
"ran_bg",
RAN_BG,
"hex_clr", 0,
"ran background (#000000)", 6},
177 {
"blue_gamma",
GM_BLUE,
"float", 0,
"blue_gamma (1.2)", 7},
178 {
"gray_gamma",
GM_GRAY,
"float", 0,
"gray gamma (1.2)", 7},
179 {
"green_gamma",
GM_GREEN,
"float", 0,
"green gamma (1.2)", 7},
180 {
"red_gamma",
GM_RED,
"float", 0,
"red gamma (View)", 7},
181 {
"black",
XBLACK,
"hex_clr", 0,
"black (#000000)", 8},
182 {
"red",
XRED,
"hex_clr", 0,
"red (#bf0000)", 8},
183 {
"green",
XGREEN,
"hex_clr", 0,
"green (#00cf00)", 8},
184 {
"yellow",
XYELLOW,
"hex_clr", 0,
"yellow (#efbf00)", 8},
185 {
"blue",
XBLUE,
"hex_clr", 0,
"blue (#0000FF)", 8},
186 {
"magenta",
XMAGENTA,
"hex_clr", 0,
"magenta (#9f009f)", 8},
187 {
"cyan",
XCYAN,
"hex_clr", 0,
"cyan (#00dfdf)", 8},
188 {
"white",
XWHITE,
"hex_clr", 0,
"white (#d0d0d0)", 8},
189 {
"bblack",
XBBLACK,
"hex_clr", 0,
"bright black (#7f7f7f)", 8},
190 {
"bred",
XBRED,
"hex_clr", 0,
"bright red (#FF3737)", 8},
191 {
"bgreen",
XBGREEN,
"hex_clr", 0,
"bright green (#00FF7f)", 8},
192 {
"byellow",
XBYELLOW,
"hex_clr", 0,
"bright yellow (#FFeF00)", 8},
193 {
"bblue",
XBBLUE,
"hex_clr", 0,
"bright blue (#00cfFF)", 8},
194 {
"bmagenta",
XMAGENTA,
"hex_clr", 0,
"bright magenta (#FF00FF)", 8},
195 {
"bcyan",
XBCYAN,
"hex_clr", 0,
"bright cyan (#00FFFF)", 8},
196 {
"bwhite",
XBWHITE,
"hex_clr", 0,
"bright white (#FFFFFF)", 8},
197 {
"mapp_data",
MAPP_DATA,
"directory", 0,
"data directory", 9},
198 {
"mapp_help",
MAPP_HELP,
"directory", 0,
"help directory", 9},
199 {
"mapp_home",
MAPP_HOME,
"directory", 0,
"home directory", 9},
200 {
"mapp_msrc",
MAPP_MSRC,
"directory", 0,
"source directory", 9},
201 {
"mapp_user",
MAPP_USER,
"directory", 0,
"user directory", 9},
202 {
"mapp_theme",
MAPP_THEME,
"file", 0,
"default theme file", 9},
207parse_opt(
int key,
char *arg,
struct argp_state *state) {
208 Init *init = state->input;
209 SIO *sio = init
->sio;
252 if (!strcmp(arg,
"SILENT"))
254 else if (!strcmp(arg,
"DEBUG"))
256 else if (!strcmp(arg,
"INFO"))
258 else if (!strcmp(arg,
"WARN"))
260 else if (!strcmp(arg,
"ERROR"))
262 else if (!strcmp(arg,
"FATAL"))
294 if (arg && arg[0] ==
't')
296 else if (arg && arg[0] ==
'f')
324 if (arg && arg[0] ==
't')
326 else if (arg && arg[0] ==
'f')
337 sscanf(arg,
"#%06x", &sio
->bg);
340 sscanf(arg,
"#%06x", &sio
->fg);
344 if (c ==
'r' || c ==
'R')
346 else if (c ==
's' || c ==
'S')
348 else if (c ==
'd' || c ==
'D')
350 else if (c ==
'h' || c ==
'H')
380 sscanf(arg,
"#%06x", &sio
->nt_fg);
383 sscanf(arg,
"#%06x", &sio
->nt_bg);
410 sscanf(arg,
"#%06x", &sio
->ln_fg);
413 sscanf(arg,
"#%06x", &sio
->ln_bg);
464 if (state->arg_num >= 35)
466 init
->argv[state->arg_num] = strdup(arg);
469 init
->argc = state->arg_num;
470 init
->argv[state->arg_num + 1] =
nullptr;
473 return ARGP_ERR_UNKNOWN;
478static struct argp argp = {options, parse_opt, args_doc, doc,
479 nullptr,
nullptr,
nullptr};
482
483
484
485
486
487
488
489
490
491
492
493
498 setlocale(LC_ALL,
"en_US.UTF-8");
500 init
->sio = (SIO *)calloc(1,
sizeof(SIO));
505 SIO *sio = init
->sio;
508 _(
"init struct not allocated on entry"));
512 e = getenv(
"CMENU_HOME");
513 if (!e || *e ==
'\0')
524 e = getenv(
"CMENU_RC");
525 if (!e || *e ==
'\0') {
583 if (e ==
nullptr || *e ==
'\0')
587 e = getenv(
"EDITOR");
595 ui_log(INFO,
"mapp_initialization");
596 ui_log(INFO,
_(
"config files processed"));
599 argp_parse(&argp, argc, argv, 0, 0, init);
608
609
610
611
612
613
614
615
616
617
620 argp_parse(&argp, argc, argv, 0, 0, init);
625
626
627
628
629
630
631
632
659
660
661
662
663
664
665
666
667
668
670 char config_file_name[
MAXLEN];
673 char *e = getenv(
"MINITRC");
691 char include_file_name[
MAXLEN];
694 SIO *sio = init
->sio;
698 FILE *config_fp = fopen(config_file_name,
"r");
699 char quote_char =
'\0';
701 fprintf(stderr,
"failed to read file: %s %s\n", config_file_name, strerror(errno));
704 while (fgets(tmp_str,
sizeof(tmp_str), config_fp)) {
705 bool inquotes =
false;
706 if (tmp_str[0] ==
'#')
712 while (*src_p !=
'\0') {
720 if (*src_p ==
'"' && *src_p ==
' ') {
729 while (*src_p !=
'\0') {
730 if ((*src_p ==
'"' || *src_p ==
'\'') && (*(src_p + 1) !=
'\\')) {
733 quote_char = *src_p++;
734 }
else if (*src_p == quote_char) {
743 dp = value + strlen(value);
748 if (*src_p ==
' ' || *src_p ==
';') {
752 if (*src_p ==
'\n') {
761 if (value[0] ==
'\0')
763 if (!strcmp(key,
"include")) {
769 if (!strcmp(key,
"minitrc")) {
773 if (!strcmp(key,
"lines")) {
777 if (!strcmp(key,
"cols")) {
781 if (!strcmp(key,
"begy")) {
785 if (!strcmp(key,
"begx")) {
789 if (!strcmp(key,
"f_ln")) {
793 if (!strcmp(key,
"f_at_end_remove")) {
797 if (!strcmp(key,
"f_erase_remainder")) {
801 if (!strcmp(key,
"brackets")) {
805 if (!strcmp(key,
"fill_char")) {
806 if (strlen(value) > 1)
808 if (wcwidth((
int)value[0]) > 1)
813 if (!strcmp(key,
"f_ignore_case")) {
817 if (!strcmp(key,
"p_view_files")) {
821 if (!strcmp(key,
"f_read_theme")) {
825 if (!strcmp(key,
"f_squeeze")) {
829 if (!strcmp(key,
"f_strip_ansi")) {
833 if (!strcmp(key,
"f_multiple_cmd_args")) {
837 if (!strcmp(key,
"select_max")) {
841 if (!strcmp(key,
"tab_stop")) {
845 if (!strcmp(key,
"timeout_secs")) {
849 if (!strcmp(key,
"h_shift")) {
853 if (!strcmp(key,
"wrap")) {
857 if (!strcmp(key,
"title")) {
861 if (!strcmp(key,
"cmd")) {
865 if (!strcmp(key,
"cmd_all")) {
869 if (!strcmp(key,
"parent_cmd")) {
873 if (!strcmp(key,
"provider_cmd")) {
877 if (!strcmp(key,
"receiver_cmd")) {
881 if (!strcmp(key,
"editor")) {
885 if (!strcmp(key,
"border")) {
887 if (c ==
'r' || c ==
'R')
889 else if (c ==
's' || c ==
'S')
891 else if (c ==
'd' || c ==
'D')
893 else if (c ==
'h' || c ==
'H')
899 if (!strcmp(key,
"fg")) {
900 sscanf(value,
"#%06x", &sio
->fg);
903 if (!strcmp(key,
"bg")) {
904 sscanf(value,
"#%06x", &sio
->bg);
907 if (!strcmp(key,
"box_fg")) {
908 sscanf(value,
"#%06x", &sio
->fg);
911 if (!strcmp(key,
"box_bg")) {
912 sscanf(value,
"#%06x", &sio
->box_bg);
915 if (!strcmp(key,
"ind_fg")) {
916 sscanf(value,
"#%06x", &sio
->ind_fg);
919 if (!strcmp(key,
"ind_bg")) {
920 sscanf(value,
"#%06x", &sio
->ind_bg);
923 if (!strcmp(key,
"brackets_fg")) {
927 if (!strcmp(key,
"brackets_bg")) {
931 if (!strcmp(key,
"fill_char_fg")) {
935 if (!strcmp(key,
"fill_char_bg")) {
939 if (!strcmp(key,
"ln_fg")) {
940 sscanf(value,
"#%06x", &sio
->ln_fg);
943 if (!strcmp(key,
"ln_bg")) {
944 sscanf(value,
"#%06x", &sio
->ln_bg);
947 if (!strcmp(key,
"cmdln_fg")) {
951 if (!strcmp(key,
"cmdln_bg")) {
955 if (!strcmp(key,
"nt_fg")) {
956 sscanf(value,
"#%06x", &sio
->nt_fg);
959 if (!strcmp(key,
"nt_bg")) {
960 sscanf(value,
"#%06x", &sio
->nt_bg);
963 if (!strcmp(key,
"nt_rev_fg")) {
967 if (!strcmp(key,
"nt_rev_bg")) {
971 if (!strcmp(key,
"nt_hl_fg")) {
975 if (!strcmp(key,
"nt_hl_bg")) {
979 if (!strcmp(key,
"nt_hl_rev_fg")) {
983 if (!strcmp(key,
"nt_hl_rev_bg")) {
987 if (!strcmp(key,
"title_fg")) {
991 if (!strcmp(key,
"title_bg")) {
995 if (!strcmp(key,
"ran_fg")) {
996 sscanf(value,
"#%06x", &sio
->ran_fg);
999 if (!strcmp(key,
"ran_bg")) {
1000 sscanf(value,
"#%06x", &sio
->ran_bg);
1003 if (!strcmp(key,
"red_gamma")) {
1007 if (!strcmp(key,
"green_gamma")) {
1011 if (!strcmp(key,
"blue_gamma")) {
1015 if (!strcmp(key,
"gray_gamma")) {
1019 if (!strcmp(key,
"black")) {
1020 sscanf(value,
"#%06x", &sio
->black);
1023 if (!strcmp(key,
"red")) {
1024 sscanf(value,
"#%06x", &sio
->red);
1027 if (!strcmp(key,
"green")) {
1028 sscanf(value,
"#%06x", &sio
->green);
1031 if (!strcmp(key,
"yellow")) {
1032 sscanf(value,
"#%06x", &sio
->yellow);
1035 if (!strcmp(key,
"blue")) {
1036 sscanf(value,
"#%06x", &sio
->blue);
1039 if (!strcmp(key,
"magenta")) {
1043 if (!strcmp(key,
"cyan")) {
1044 sscanf(value,
"#%06x", &sio
->cyan);
1047 if (!strcmp(key,
"white")) {
1048 sscanf(value,
"#%06x", &sio
->white);
1051 if (!strcmp(key,
"orange")) {
1052 sscanf(value,
"#%06x", &sio
->orange);
1055 if (!strcmp(key,
"bblack")) {
1056 sscanf(value,
"#%06x", &sio
->bblack);
1059 if (!strcmp(key,
"bred")) {
1060 sscanf(value,
"#%06x", &sio
->bred);
1063 if (!strcmp(key,
"bgreen")) {
1064 sscanf(value,
"#%06x", &sio
->bgreen);
1067 if (!strcmp(key,
"byellow")) {
1071 if (!strcmp(key,
"bblue")) {
1072 sscanf(value,
"#%06x", &sio
->bblue);
1075 if (!strcmp(key,
"bmagenta")) {
1079 if (!strcmp(key,
"bcyan")) {
1080 sscanf(value,
"#%06x", &sio
->bcyan);
1083 if (!strcmp(key,
"bwhite")) {
1084 sscanf(value,
"#%06x", &sio
->bwhite);
1087 if (!strcmp(key,
"borange")) {
1091 if (!strcmp(key,
"mapp_spec")) {
1095 if (!strcmp(key,
"mapp_data")) {
1099 if (!strcmp(key,
"mapp_help")) {
1103 if (!strcmp(key,
"mapp_home")) {
1107 if (!strcmp(key,
"mapp_msrc")) {
1111 if (!strcmp(key,
"mapp_user")) {
1115 if (!strcmp(key,
"mapp_theme")) {
1119 if (!strcmp(key,
"log_level")) {
1121 if (!strcmp(value,
"SILENT"))
1123 else if (!strcmp(value,
"DEBUG"))
1125 else if (!strcmp(value,
"INFO"))
1127 else if (!strcmp(value,
"WARN"))
1129 else if (!strcmp(value,
"ERROR"))
1131 else if (!strcmp(value,
"FATAL"))
1138 (
void)fclose(config_fp);
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1154 char minitrc_dmp[
MAXLEN];
1156 SIO *sio = init
->sio;
1157 e = getenv(
"CMENU_HOME");
1158 minitrc_dmp[0] =
'\0';
1165 ui_log(INFO,
_(
"writing config file to: %s"), minitrc_dmp);
1166 FILE *minitrc_fp = fopen(minitrc_dmp,
"w");
1167 if (minitrc_fp == (FILE *)0) {
1169 ui_log(ERROR,
"em0");
1172 (
void)fprintf(minitrc_fp,
"# %s\n", minitrc_dmp);
1173 char *doc_tbl[50] = {
1174 _(
"# C-Menu example configuration file"),
1176 _(
"# This file is generated by C-Menu when run with the -W option."),
1177 _(
"# Copy this file and edit the copy because this file will be"),
1178 _(
"# overwritten each time C-Menu is run with the - W option."),
1180 _(
"# C-Menu processes key value pairs in reading order from its"),
1181 _(
"# main configuraiton file, ~/ menuapp /.minitrc, and any other"),
1182 _(
"# configuration files sourced with include statements such as"),
1183 _(
"# the following:"),
1185 _(
"# include = ~/menuapp/theme/default"),
1187 _(
"# Assuming your configuration file is in ~/menuapp/theme/Red,"),
1188 _(
"# you could create a symbolic link named default that points to"),
1189 _(
"# Red, and then include default in your main configuration file."),
1190 _(
"# (Actually ~/menuapp/.minitrc already includes default, so you"),
1191 _(
"# would only need to create the theme file and the symbolic link."),
1193 _(
"# ln -s Red default"),
1195 _(
"# Key value pairs included from configuration files are"),
1196 _(
"# processed in reading order as they are included."),
1198 _(
"# This is significant in the event that a key is included more"),
1199 _(
"# than once in the configuration file and / or included files."),
1200 _(
"# Only the last value read for a key will be used by C-Menu."),
1202 _(
"# If you want to override key values in the C-Menu configuration"),
1203 _(
"# file, you can do so by inserting an include statement for a"),
1204 _(
"# supplemental configuration file below the keys you want to"),
1205 _(
"# override in the C-Menu configuration file. Conversely, if you"),
1206 _(
"# want to use a supplemental configuration as the default,"),
1207 _(
"# include it first."),
1209 _(
"# Parsing: Lines beginning with # are comments and are ignored."),
1210 _(
"# Lines containing key=value pairs are parsed and the key and"),
1211 _(
"# value are extracted. Lines without an '=' are ignored. Values"),
1212 _(
"# are stripped of leading and trailing whitespace and quotes."),
1213 _(
"# Values can be enclosed in single or double quotes to preserve"),
1214 _(
"# leading and trailing whitespace. Values can also be specified"),
1215 _(
"# as hex color codes such as #ff0000 for red. If a value is"),
1216 _(
"# specified as a hex color code, it is parsed and stored as a"),
1217 _(
"# hex color code in the configuration. An unquoted '#' that is"),
1218 _(
"# not part of a six digit hex color code and after key values"),
1219 _(
"# have been extracted is the beginning of a comment."),
""};
1220 for (
int i = 0; doc_tbl[i][0] !=
'\0'; i++)
1221 (
void)fprintf(minitrc_fp,
"%s\n", doc_tbl[i]);
1222 (
void)fprintf(minitrc_fp,
"#\n");
1401 (
void)fprintf(minitrc_fp,
"%-34s # default theme file\n", config_s);
1411 (
void)fprintf(minitrc_fp,
"%-34s # %s\n", config_s, comment);
1413 (
void)fprintf(minitrc_fp,
"%-34s #\n", config_s);
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1431 if (!file_name || !*file_name) {
1438 e = getenv(
"MAPP_DIR");
1455
1456
1457
1459 fprintf(stdout,
"\nC-Menu %s\n",
CM_VERSION);
1460 fprintf(stdout,
"\nC-Menu %s\n",
CM_VERSION);
1461 fprintf(stdout,
"C version: %ld\n", __STDC_VERSION__);
1464
1465
1466
1467
1468
1469
1471 fprintf(stdout,
"%3s %-15s: %s\n", o, name, value);
1474
1475
1476
1477
1478
1479
1480
1482 fprintf(stdout,
"%3s %-15s: %s\n", o, name, value);
1485
1486
1487
1488
1489
1490
1491
1493 fprintf(stdout,
"%3s %-15s: %d\n", o, name, value);
1496
1497
1498
1499
1500
1501
1502
1504 fprintf(stdout,
"%3s %-15s: %0.2f\n", o, name, value);
1507
1508
1509
1510
1511
1512
1513
1514
1516 fprintf(stdout,
"%3s %-15s: %s\n", o, name, value ?
"true" :
"false");
bool str_to_bool(const char *)
Converts String to boolean true or false.
void ui_abend(int ec, char *s)
Convert multibyte string to complex character array.
int ui_open_log()
Open the log file for writing.
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 *,...)
Custom safe string formatting utility (Variadic version).
bool expand_tilde(char *, uint)
Expand a tilde (~) in a file path to 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 receiver_cmd[MAXLEN]
char provider_cmd[MAXLEN]
char * level[LOG_LEVEL_COUNT]