C-Menu 0.2.9
A User Interface Toolkit
Loading...
Searching...
No Matches
init.c
Go to the documentation of this file.
1/** @file init.c
2 @brief Initialization for Menu Application Programs
3 @author Bill Waller
4 Copyright (c) 2025
5 MIT License
6 billxwaller@gmail.com
7 @date 2026-02-09
8 */
9
10/**
11 @defgroup init C-Menu Initialization
12 @brief Capture Data from the Environment, Command Line, and
13 Configuration File and Populate the Init and SIO Data Structures
14 @verbatim
15 SIO Struct for screen I/O settings (colors, gamma, etc.)
16 Init Struct for application settings (file paths, commands, flags, etc.)
17 @endverbatim
18 */
19
20#include <argp.h>
21#include <common.h>
22#include <locale.h>
23#include <stdlib.h>
24#include <string.h>
25#include <time.h>
26#include <unistd.h>
27
28typedef enum {
29 IN_SPEC = 257,
66} InitVariables;
67
68bool f_write_config = false;
69bool f_dump_config = false;
70
71int write_config(Init *init);
72void display_version();
73
74Init *init = nullptr;
75void mapp_initialization(Init *, int, char **);
76void zero_opt_args(Init *);
77int parse_config(Init *);
78int parse_opt_args(Init *, int, char **);
79void dump_config(Init *, char *);
80
81bool derive_file_spec(char *, char *, char *);
82int executor = 0;
83
85const char *argp_program_bug_address = "billxwaller@gmail.com";
86static char doc[] = "C-Menu - User Interface Toolkit";
87static char args_doc[] = "[INPUT] [OUTPUT] [HELP] [ARG4] [ARG5]";
88// const int opt_doc_col = 33;
89
90static struct argp_option options[] = {
91 {"f_dump_config", 'D', 0, 0, "dump configuration", 0},
92 {"f_write_config", 'W', 0, 0, "write configuration", 0},
93 {"minitrc", 'a', "file_spec", 0, "configuration file spec", 1},
94 {"parent_cmd", 'k', 0, 0, "parent command", 1},
95 {"begx", 'X', "number", 0, "begin on column", 2},
96 {"begy", 'Y', "number", 0, "begin on line", 2},
97 {"cols", 'C', "number", 0, "width in columns", 2},
98 {"lines", 'L', "number", 0, "height in lines", 2},
99 {"out_spec", 'o', "file_spec", 0, "output spec", 2},
100 {"select_max", 'n', "number", 0, "number of selections", 2},
101 {"cmd", 'c', "file_spec", 0, "view cmd, first file", 3},
102 {"cmd_all", 'A', "file_spec", 0, "view cmd, all files", 3},
103 {"help_spec", 'H', "file_spec", 0, "help spec", 3},
104 {"in_spec", 'i', "file_spec", 0, "input spec", 3},
105 {"mapp_spec", 'd', "file_spec", 0, "description spec", 3},
106 {"provider_cmd", 'S', "file_spec", 0, "execute provider of piped input", 3},
107 {"receiver_cmd", 'R', "file_spec", 0, "execute receiver of piped output",
108 3},
109 {"title", 'T', "text", 0, "Window title", 3},
110 {"wait_timeout", 'w', "seconds", 0, "Wait timer", 3},
111 {"f_erase_remainder", 'e', "bool", 0, "erase remainder of line on enter",
112 4},
113 {"f_strip_ansi", 'j', "bool", 0, "always strip ansi when writing", 4},
114 {"f_squeeze", 's', "bool", 0, "squeeze multiple blank lines", 4},
115 {"f_ignore_case", 'x', "bool", 0, "ignore case in search", 4},
116 {"f_ln", 'N', "bool", OPTION_ARG_OPTIONAL, "line numbers in view", 5},
117 {"fill_char", 'f', "char", 0, "field fill_char", 5},
118 {"brackets", 'u', "text", 0, "brackets around fields", 5},
119 {"editor", CM_EDITOR, "text", 0, "default editor", 8},
120 {"tab_stop", 't', "number", 0, "number of spaces per tab", 5},
121 {"bg_clr_x", BG_XCLR, "hex_clr", 0, "background color", 6},
122 {"bo_clr_x", BO_XCLR, "hex_clr", 0, "border color", 6},
123 {"fg_clr_x", FG_XCLR, "hex_clr", 0, "foreground color", 6},
124 {"ln__bg_clr_x", LN_BG_CLR, "hex_clr", 0, "line number background", 6},
125 {"ln_clr_x", LN_XCLR, "hex_clr", 0, "line number color", 6},
126 {"blue_gamma", GM_BLUE, "float", 0, "blue_gamma (View)", 7},
127 {"gray_gamma", GM_GRAY, "float", 0, "gray gamma (View)", 7},
128 {"green_gamma", GM_GREEN, "float", 0, "green gamma (View)", 7},
129 {"red_gamma", GM_RED, "float", 0, "red gamma (View)", 7},
130 {"black", XBLACK, "hex_clr", 0, "black (#000000)", 8},
131 {"red", XRED, "hex_clr", 0, "red (#bf0000)", 8},
132 {"green", XGREEN, "hex_clr", 0, "green (#00cf00)", 8},
133 {"yellow", XYELLOW, "hex_clr", 0, "yellow (#efbf00)", 8},
134 {"blue", XBLUE, "hex_clr", 0, "blue (#0000FF)", 8},
135 {"magenta", XMAGENTA, "hex_clr", 0, "magenta (#9f009f)", 8},
136 {"cyan", XCYAN, "hex_clr", 0, "cyan (#00dfdf)", 8},
137 {"white", XWHITE, "hex_clr", 0, "white (#d0d0d0)", 8},
138 {"bblack", XBBLACK, "hex_clr", 0, "bright black (#7f7f7f)", 8},
139 {"bred", XBRED, "hex_clr", 0, "bright red (#FF3737)", 8},
140 {"bgreen", XBGREEN, "hex_clr", 0, "bright green (#00FF7f)", 8},
141 {"byellow", XBYELLOW, "hex_clr", 0, "bright yellow (#FFeF00)", 8},
142 {"bblue", XBBLUE, "hex_clr", 0, "bright blue (#00cfFF)", 8},
143 {"bmagenta", XMAGENTA, "hex_clr", 0, "bright magenta (#FF00FF)", 8},
144 {"bcyan", XBCYAN, "hex_clr", 0, "bright cyan (#00FFFF)", 8},
145 {"bwhite", XBWHITE, "hex_clr", 0, "bright white (#FFFFFF)", 8},
146 {"mapp_data", MAPP_DATA, "directory", 0, "data directory", 9},
147 {"mapp_help", MAPP_HELP, "directory", 0, "help directory", 9},
148 {"mapp_home", MAPP_HOME, "directory", 0, "home directory", 9},
149 {"mapp_msrc", MAPP_MSRC, "directory", 0, "source directory", 9},
150 {"mapp_user", MAPP_USER, "directory", 0, "user directory", 9},
151 {0},
152};
153
154static error_t parse_opt(int key, char *arg, struct argp_state *state) {
155 Init *init = state->input;
156 SIO *sio = init->sio;
157 switch (key) {
158 case 'a':
160 break;
161 case 'b':
163 break;
164 case 'c':
165 strnz__cpy(init->cmd, arg, MAXLEN - 1);
166 break;
167 case 'd':
169 break;
170 case 'e':
172 break;
173 case 'f':
175 break;
176 case 'g':
178 break;
179 case 'i':
181 break;
182 case 'j':
183 init->f_strip_ansi = true;
184 break;
185 case 'k':
187 break;
188 case 'm':
190 break;
191 case 'n':
192 init->select_max = atoi(arg);
193 break;
194 case 'o':
196 break;
197 case 'r':
199 break;
200 case 's':
201 init->f_squeeze = str_to_bool(arg);
202 break;
203 case 't':
204 init->tab_stop = atoi(arg);
205 if (init->tab_stop < 1)
206 init->tab_stop = 1;
207 break;
208 case 'w':
209 wait_timeout = atoi(arg);
212 break;
213 case 'u':
214 strnz__cpy(init->brackets, arg, 2);
215 break;
216 case 'x':
218 break;
219 case 'A':
221 break;
222 case 'B':
224 break;
225 case 'C':
226 init->cols = atoi(arg);
227 break;
228 case 'D':
229 f_dump_config = true;
230 break;
231 case 'F':
233 break;
234 case 'G':
236 break;
237 case 'H':
239 break;
240 case 'L':
241 init->lines = atoi(arg);
242 break;
243 case 'M':
245 break;
246 case 'N':
247 if (arg)
248 init->f_ln = str_to_bool(arg);
249 else
250 init->f_ln = true;
251 break;
252 case 'O':
254 break;
255 case 'R':
257 break;
258 case 'S':
260 break;
261 case 'T':
262 strnz__cpy(init->title, arg, MAXLEN - 1);
263 break;
264 case 'U':
266 break;
267 case 'W':
268 f_write_config = true;
269 break;
270 case 'X':
271 init->begx = atoi(arg);
272 break;
273 case 'Y':
274 init->begy = atoi(arg);
275 break;
276 case MAPP_DATA_DIR:
278 break;
279 case MAPP_HELP_DIR:
281 break;
282 case MAPP_SPEC:
284 break;
285 case HELP_SPEC:
287 break;
288 case IN_SPEC:
290 break;
291 case OUT_SPEC:
293 break;
294 case MAPP_MSRC:
296 break;
297 case ARGP_KEY_ARG:
298 if (state->arg_num >= 35)
299 argp_usage(state);
300 init->argv[state->arg_num] = strdup(arg);
301 break;
302 case ARGP_KEY_END:
303 init->argc = state->arg_num;
304 init->argv[state->arg_num + 1] = nullptr;
305 break;
306 default:
307 return ARGP_ERR_UNKNOWN;
308 }
309 return 0;
310}
311
312static struct argp argp = {options, parse_opt, args_doc, doc,
314
315/** @brief Main initialization function for MAPP - Menu Application
316 @ingroup init
317 @param init - pointer to Init struct to be initialized
318 @param argc - argument count from main()
319 @param argv - argument vector from main()
320 @code
321 1. Read environment variables and set defaults
322 2. Parse configuration file
323 3. Parse command-line options
324 4. Set up SIO struct with colors and other settings
325 5. Handle special options like help and version
326 @endcode
327 */
328void mapp_initialization(Init *init, int argc, char **argv) {
329 char term[MAXLEN];
330 char tmp_str[MAXLEN];
331 char *e;
332 setlocale(LC_ALL, "en_US.UTF-8");
333 SIO *sio = init->sio;
334 if (!init) {
335 ssnprintf(tmp_str, sizeof(tmp_str), "%s",
336 "init struct not allocated on entry");
337 abend(-1, tmp_str);
338 exit(-1);
339 }
340#ifdef DEBUG_LOG
341 open_cmenu_log();
342#endif
343 e = getenv("CMENU_HOME");
344 if (!e || *e == '\0')
345 strnz__cpy(init->mapp_home, "~/menuapp", MAXLEN);
346 else
348
349 if (init->mapp_home[0] != '\0') {
351 if (!verify_dir(init->mapp_home, R_OK))
352 abend(-1, "MAPP_HOME directory invalid");
353 }
354 // CMENU_RC should be an absolute path
355 e = getenv("CMENU_RC");
356 if (!e || *e == '\0') {
358 strnz__cat(init->minitrc, "/.minitrc", MAXLEN);
359 } else
361 if (init->mapp_user[0] == '\0') {
363 strnz__cat(init->mapp_user, "/user", MAXLEN - 1);
364 }
365 if (init->mapp_msrc[0] == '\0') {
367 strnz__cat(init->mapp_msrc, "/msrc", MAXLEN - 1);
368 }
369 if (init->mapp_data[0] == '\0') {
371 strnz__cat(init->mapp_data, "/data", MAXLEN - 1);
372 }
373 if (init->mapp_help[0] == '\0') {
375 strnz__cat(init->mapp_help, "/help", MAXLEN - 1);
376 }
377 init->mapp_spec[0] = '\0'; /**< menu specification file */
378 // Set default colors and settings in SIO struct
379 // These can be overridden by the config file or command-line options
380 // Included here to ensure SIO has valid defaults even if config parsing fails
381 strnz__cpy(sio->bg_clr_x, "#000007",
382 COLOR_LEN - 1); /**< background color */
383 strnz__cpy(sio->fg_clr_x, "#c0c0c0",
384 COLOR_LEN - 1); /**< foreground color */
385 strnz__cpy(sio->bo_clr_x, "#f00000", COLOR_LEN - 1); /**< bold color */
386 strnz__cpy(sio->ln_clr_x, "#0070ff",
387 COLOR_LEN - 1); /**< line number olor */
388 strnz__cpy(sio->ln_bg_clr_x, "#101010",
389 COLOR_LEN - 1); /**< line number background */
390 init->f_erase_remainder = true; /**< erase remainder on enter */
391 init->brackets[0] = '\0'; /**< field enclosure brackets */
392 strnz__cpy(init->fill_char, "_", MAXLEN - 1); /**< field fill character */
393 e = getenv("TERM");
394 if (e == nullptr || *e == '\0')
395 strnz__cpy(term, "xterm-256color", MAXLEN);
396 else
397 strnz__cpy(term, e, MAXLEN - 1);
398 e = getenv("EDITOR");
399 if (e && *e != '\0')
400 strnz__cpy(init->editor, "vi", MAXLEN - 1);
401 else
403 parse_config(init);
404 init->mapp_spec[0] = '\0';
405 init->argc = argc;
406 argp_parse(&argp, argc, argv, 0, 0, init);
407 if (f_write_config) {
408 write_config(init);
409 exit(EXIT_SUCCESS);
410 }
411 if (f_dump_config) {
412 dump_config(init, "Current Configuration");
413 exit(EXIT_SUCCESS);
414 }
415}
416/** @brief Parse command-line options and set Init struct values accordingly
417 @ingroup init
418 @param init - pointer to Init struct to be populated with option values
419 @param argc - argument count from main()
420 @param argv - argument vector from main()
421 @returns 0 on success, -1 on failure
422 @details This function uses the argp library to parse command-line
423 options defined in the options array. It updates the Init struct with
424 values from the options and handles any special flags for dumping or
425 writing configuration.
426 */
427int parse_opt_args(Init *init, int argc, char **argv) {
428 init->argc = destroy_argv(init->argc, init->argv);
429 argp_parse(&argp, argc, argv, 0, 0, init);
430 return 0;
431}
432
433/** @brief Initialize optional arguments in the Init struct to default
434 values
435 @ingroup init
436 @param init - pointer to Init struct to be initialized This function
437 sets all optional argument fields in the Init struct to their default
438 values before parsing command-line options or configuration file. This
439 ensures that any fields not specified by the user will have known default
440 values.
441 */
442void zero_opt_args(Init *init) {
443 init->lines = 0;
444 init->cols = 0;
445 init->begx = 0;
446 init->begy = 0;
447 init->f_mapp_desc = false;
448 init->f_provider_cmd = false;
449 init->f_receiver_cmd = false;
450 init->f_title = false;
451 init->f_mapp_spec = false;
452 init->f_help_spec = false;
453 init->f_in_spec = false;
454 init->f_out_spec = false;
455 init->mapp_spec[0] = init->help_spec[0] = '\0';
456 init->provider_cmd[0] = init->receiver_cmd[0] = '\0';
457 init->title[0] = '\0';
458 init->cmd[0] = init->cmd_all[0] = '\0';
459 init->parent_cmd[0] = '\0';
460 init->in_spec[0] = init->out_spec[0] = '\0';
461 init->help_spec[0] = '\0';
462 init->in_spec[0] = '\0';
463 init->out_spec[0] = '\0';
464}
465/** @brief parse the configuration file specified in init->minitrc and set
466 Init struct values accordingly
467 @ingroup init
468 @returns on success, -1 on failure
469 @details Lines beginning with '#" are comments, discard.
470 Copy line to tmp_str removing quotes, spaces, semicolons, and
471 newlines.
472 Record structure is "parse key=value pairs".
473 Skip lines without '='.
474 Set init struct values based on key.
475 Skip unknown keys. */
476int parse_config(Init *init) {
477 char ts[MAXLEN];
478 char *sp, *dp;
479 char tmp_str[MAXLEN];
480 SIO *sio = init->sio;
481 if (!init->minitrc[0]) {
482 char *e = getenv("MINITRC");
483 if (e)
485 else
486 strnz__cpy(init->minitrc, "~/.minitrc", MAXLEN - 1);
487 }
489 FILE *config_fp = fopen(init->minitrc, "r");
490 if (!config_fp) {
491 fprintf(stderr, "failed to read file: %s\n", init->minitrc);
492 return (-1);
493 }
494 while (fgets(ts, sizeof(ts), config_fp)) {
495 if (ts[0] != '#') {
496 sp = ts;
497 dp = tmp_str;
498 while (*sp != '\0') {
499 if (*sp == '\n') {
500 *dp = *sp = '\0';
501 } else {
502 if (*sp != '"' && *sp != ' ' && *sp != ';') {
503 *dp++ = *sp;
504 }
505 sp++;
506 }
507 }
508 *dp = '\0';
509 char *key = strtok(tmp_str, "=");
510 char *value = strtok(nullptr, "=");
511 if (value == nullptr)
512 continue;
513 if (!strcmp(key, "minitrc")) {
514 strnz__cpy(init->minitrc, value, MAXLEN - 1);
515 continue;
516 }
517 if (!strcmp(key, "lines")) {
518 init->lines = atoi(value);
519 continue;
520 }
521 if (!strcmp(key, "cols")) {
522 init->cols = atoi(value);
523 continue;
524 }
525 if (!strcmp(key, "begy")) {
526 init->begy = atoi(value);
527 continue;
528 }
529 if (!strcmp(key, "begx")) {
530 init->begx = atoi(value);
531 continue;
532 }
533 if (!strcmp(key, "fg_clr_x")) {
535 continue;
536 }
537 if (!strcmp(key, "bg_clr_x")) {
539 continue;
540 }
541 if (!strcmp(key, "f_ln")) {
542 init->f_ln = str_to_bool(value);
543 continue;
544 }
545 if (!strcmp(key, "bo_clr_x")) {
547 continue;
548 }
549 if (!strcmp(key, "ln_clr_x")) {
551 continue;
552 }
553 if (!strcmp(key, "ln_bg_clr_x")) {
555 continue;
556 }
557 if (!strcmp(key, "red_gamma")) {
559 continue;
560 }
561 if (!strcmp(key, "green_gamma")) {
563 continue;
564 }
565 if (!strcmp(key, "blue_gamma")) {
567 continue;
568 }
569 if (!strcmp(key, "gray_gamma")) {
571 continue;
572 }
573 if (!strcmp(key, "f_at_end_remove")) {
575 continue;
576 }
577 if (!strcmp(key, "f_erase_remainder")) {
579 continue;
580 }
581 if (!strcmp(key, "brackets")) {
582 strnz__cpy(init->brackets, value, 2);
583 continue;
584 }
585 if (!strcmp(key, "fill_char")) {
586 strnz__cpy(init->fill_char, value, 2);
587 continue;
588 }
589 if (!strcmp(key, "f_ignore_case")) {
591 continue;
592 }
593 if (!strcmp(key, "f_squeeze")) {
594 init->f_squeeze = str_to_bool(value);
595 continue;
596 }
597 if (!strcmp(key, "f_strip_ansi")) {
598 init->f_strip_ansi = str_to_bool(value);
599 continue;
600 }
601 if (!strcmp(key, "select_max")) {
602 init->select_max = atoi(value);
603 continue;
604 }
605 if (!strcmp(key, "tab_stop")) {
606 init->tab_stop = atoi(value);
607 continue;
608 }
609 if (!strcmp(key, "wait_timeout")) {
610 wait_timeout = atoi(value);
611 continue;
612 }
613 if (!strcmp(key, "title")) {
614 strnz__cpy(init->title, value, MAXLEN - 1);
615 continue;
616 }
617 if (!strcmp(key, "cmd")) {
618 strnz__cpy(init->cmd, value, MAXLEN - 1);
619 continue;
620 }
621 if (!strcmp(key, "cmd_all")) {
622 strnz__cpy(init->cmd_all, value, MAXLEN - 1);
623 continue;
624 }
625 if (!strcmp(key, "parent_cmd")) {
627 continue;
628 }
629 if (!strcmp(key, "provider_cmd")) {
631 continue;
632 }
633 if (!strcmp(key, "receiver_cmd")) {
635 continue;
636 }
637 if (!strcmp(key, "nt_fg")) {
638 strnz__cpy(sio->nt_fg, value, COLOR_LEN - 1);
639 continue;
640 }
641 if (!strcmp(key, "nt_bg")) {
642 strnz__cpy(sio->nt_bg, value, COLOR_LEN - 1);
643 continue;
644 }
645 if (!strcmp(key, "nt_rev_fg")) {
647 continue;
648 }
649 if (!strcmp(key, "nt_rev_bg")) {
651 continue;
652 }
653 if (!strcmp(key, "nt_hl_fg")) {
655 continue;
656 }
657 if (!strcmp(key, "nt_hl_bg")) {
659 continue;
660 }
661 if (!strcmp(key, "nt_hl_rev_fg")) {
663 continue;
664 }
665 if (!strcmp(key, "nt_hl_rev_bg")) {
667 continue;
668 }
669 if (!strcmp(key, "nt_hl_rev_fg")) {
671 continue;
672 }
673 if (!strcmp(key, "bg")) {
674 strnz__cpy(sio->bg, value, COLOR_LEN - 1);
675 continue;
676 }
677 if (!strcmp(key, "black")) {
678 strnz__cpy(sio->black, value, COLOR_LEN - 1);
679 continue;
680 }
681 if (!strcmp(key, "red")) {
682 strnz__cpy(sio->red, value, COLOR_LEN - 1);
683 continue;
684 }
685 if (!strcmp(key, "green")) {
686 strnz__cpy(sio->green, value, COLOR_LEN - 1);
687 continue;
688 }
689 if (!strcmp(key, "yellow")) {
691 continue;
692 }
693 if (!strcmp(key, "blue")) {
694 strnz__cpy(sio->blue, value, COLOR_LEN - 1);
695 continue;
696 }
697 if (!strcmp(key, "magenta")) {
699 continue;
700 }
701 if (!strcmp(key, "cyan")) {
702 strnz__cpy(sio->cyan, value, COLOR_LEN - 1);
703 continue;
704 }
705 if (!strcmp(key, "white")) {
706 strnz__cpy(sio->white, value, COLOR_LEN - 1);
707 continue;
708 }
709 if (!strcmp(key, "orange")) {
711 continue;
712 }
713 if (!strcmp(key, "bblack")) {
715 continue;
716 }
717 if (!strcmp(key, "bred")) {
718 strnz__cpy(sio->bred, value, COLOR_LEN - 1);
719 continue;
720 }
721 if (!strcmp(key, "bgreen")) {
723 continue;
724 }
725 if (!strcmp(key, "byellow")) {
727 continue;
728 }
729 if (!strcmp(key, "bblue")) {
730 strnz__cpy(sio->bblue, value, COLOR_LEN - 1);
731 continue;
732 }
733 if (!strcmp(key, "bmagenta")) {
735 continue;
736 }
737 if (!strcmp(key, "bcyan")) {
738 strnz__cpy(sio->bcyan, value, COLOR_LEN - 1);
739 continue;
740 }
741 if (!strcmp(key, "bwhite")) {
743 continue;
744 }
745 if (!strcmp(key, "borange")) {
747 continue;
748 }
749 if (!strcmp(key, "bg")) {
750 strnz__cpy(sio->bg, value, COLOR_LEN - 1);
751 continue;
752 }
753 if (!strcmp(key, "editor")) {
754 strnz__cpy(init->editor, value, MAXLEN - 1);
755 continue;
756 }
757 if (!strcmp(key, "mapp_spec")) {
758 strnz__cpy(init->mapp_spec, value, MAXLEN - 1);
759 continue;
760 }
761 if (!strcmp(key, "mapp_data")) {
762 strnz__cpy(init->mapp_data, value, MAXLEN - 1);
763 continue;
764 }
765 if (!strcmp(key, "mapp_help")) {
766 strnz__cpy(init->mapp_help, value, MAXLEN - 1);
767 continue;
768 }
769 if (!strcmp(key, "mapp_home")) {
770 strnz__cpy(init->mapp_home, value, MAXLEN - 1);
771 continue;
772 }
773 if (!strcmp(key, "mapp_msrc")) {
774 strnz__cpy(init->mapp_msrc, value, MAXLEN - 1);
775 continue;
776 }
777 if (!strcmp(key, "mapp_user")) {
778 strnz__cpy(init->mapp_user, value, MAXLEN - 1);
779 continue;
780 }
781 }
782 }
783 (void)fclose(config_fp);
784 return 0;
785}
786/** @brief Write the current configuration to a file specified in
787 init->minitrc
788 @ingroup init
789 @param init - pointer to Init struct containing current configuration
790 @returns 0 on success, -1 on failure
791 @details The configuration is written in key=value format, one per line.
792 Lines beginning with '#' are comments and are ignored when reading
793 the config file.
794 The file is created if it does not exist, and overwritten if it
795 does exist
796 */
797int write_config(Init *init) {
798 char *e;
799 char minitrc_dmp[MAXLEN];
800 char tmp_str[MAXLEN];
801 SIO *sio = init->sio;
802 e = getenv("HOME");
803 if (e) {
804 strnz__cpy(minitrc_dmp, e, MAXLEN - 1);
805 strnz__cat(minitrc_dmp, "/", MAXLEN - 1);
806 strnz__cat(minitrc_dmp, "menuapp/minitrc.dmp", MAXLEN - 1);
807 ;
808 } else {
809 strnz__cpy(minitrc_dmp, "./minitrc.dmp", MAXLEN - 1);
810 }
811 FILE *minitrc_fp = fopen(minitrc_dmp, "w");
812 if (minitrc_fp == (FILE *)0) {
813 fprintf(stderr, "failed to open file: %s\n", minitrc_dmp);
814 return (-1);
815 }
816 (void)fprintf(minitrc_fp, "# %s\n", "~/.minitrc");
817 (void)fprintf(minitrc_fp, "%s=%s\n", "parent_cmd", init->parent_cmd);
818 (void)fprintf(minitrc_fp, "%s=%d\n", "cols", init->cols);
819 (void)fprintf(minitrc_fp, "%s=%d\n", "lines", init->lines);
820 (void)fprintf(minitrc_fp, "%s=%d\n", "select_max", init->select_max);
821 (void)fprintf(minitrc_fp, "%s=%s\n", "out_spec", init->out_spec);
822 (void)fprintf(minitrc_fp, "%s=%d\n", "begx", init->begx);
823 (void)fprintf(minitrc_fp, "%s=%d\n", "begy", init->begy);
824 (void)fprintf(minitrc_fp, "%s=%s\n", "cmd_all", init->cmd_all);
825 (void)fprintf(minitrc_fp, "%s=%s\n", "cmd", init->cmd);
826 (void)fprintf(minitrc_fp, "%s=%s\n", "mapp_spec", init->mapp_spec);
827 (void)fprintf(minitrc_fp, "%s=%s\n", "help_spec", init->help_spec);
828 (void)fprintf(minitrc_fp, "%s=%s\n", "in_spec", init->in_spec);
829 (void)fprintf(minitrc_fp, "%s=%s\n", "receiver_cmd", init->receiver_cmd);
830 (void)fprintf(minitrc_fp, "%s=%s\n", "provider_cmd", init->provider_cmd);
831 (void)fprintf(minitrc_fp, "%s=%s\n", "title", init->title);
832 (void)fprintf(minitrc_fp, "%s=%s\n", "f_erase_remainder",
833 init->f_erase_remainder ? "true" : "false");
834 (void)fprintf(minitrc_fp, "%s=%s\n", "f_strip_ansi",
835 init->f_strip_ansi ? "true" : "false");
836 (void)fprintf(minitrc_fp, "%s=%s\n", "f_squeeze",
837 init->f_squeeze ? "true" : "false");
838 (void)fprintf(minitrc_fp, "%s=%s\n", "f_ignore_case",
839 init->f_ignore_case ? "true" : "false");
840 (void)fprintf(minitrc_fp, "%s=%s\n", "f_ln", init->f_ln ? "true" : "false");
841 (void)fprintf(minitrc_fp, "%s=%s\n", "brackets", init->brackets);
842 (void)fprintf(minitrc_fp, "%s=%s\n", "fill_char", init->fill_char);
843 (void)fprintf(minitrc_fp, "%s=%s\n", "editor", init->editor);
844 (void)fprintf(minitrc_fp, "%s=%d\n", "tab_stop", init->tab_stop);
845 (void)fprintf(minitrc_fp, "%s=%d\n", "wait_timeout", wait_timeout);
846 (void)fprintf(minitrc_fp, "%s=%s\n", "bg_clr_x", sio->bg_clr_x);
847 (void)fprintf(minitrc_fp, "%s=%s\n", "bo_clr_x", sio->bo_clr_x);
848 (void)fprintf(minitrc_fp, "%s=%s\n", "fg_clr_x", sio->fg_clr_x);
849 (void)fprintf(minitrc_fp, "%s=%s\n", "ln_bg_clr_x", sio->ln_bg_clr_x);
850 (void)fprintf(minitrc_fp, "%s=%s\n", "ln_clr_x", sio->ln_clr_x);
851 (void)fprintf(minitrc_fp, "%s=%0.2f\n", "blue_gamma", sio->blue_gamma);
852 (void)fprintf(minitrc_fp, "%s=%0.2f\n", "gray_gamma", sio->gray_gamma);
853 (void)fprintf(minitrc_fp, "%s=%0.2f\n", "green_gamma", sio->green_gamma);
854 (void)fprintf(minitrc_fp, "%s=%0.2f\n", "red_gamma", sio->red_gamma);
855
856 (void)fprintf(minitrc_fp, "%s=%s\n", "nt_fg", sio->nt_fg);
857 (void)fprintf(minitrc_fp, "%s=%s\n", "nt_bg", sio->nt_bg);
858
859 (void)fprintf(minitrc_fp, "%s=%s\n", "nt_hl_fg", sio->nt_hl_fg);
860 (void)fprintf(minitrc_fp, "%s=%s\n", "nt_hl_bg", sio->nt_hl_bg);
861
862 (void)fprintf(minitrc_fp, "%s=%s\n", "nt_rev_fg", sio->nt_rev_fg);
863 (void)fprintf(minitrc_fp, "%s=%s\n", "nt_rev_bg", sio->nt_rev_bg);
864
865 (void)fprintf(minitrc_fp, "%s=%s\n", "nt_hl_rev_fg", sio->nt_hl_rev_fg);
866 (void)fprintf(minitrc_fp, "%s=%s\n", "nt_hl_rev_bg", sio->nt_hl_rev_bg);
867
868 (void)fprintf(minitrc_fp, "%s=%s\n", "black", sio->black);
869 (void)fprintf(minitrc_fp, "%s=%s\n", "red", sio->red);
870 (void)fprintf(minitrc_fp, "%s=%s\n", "green", sio->green);
871 (void)fprintf(minitrc_fp, "%s=%s\n", "yellow", sio->yellow);
872 (void)fprintf(minitrc_fp, "%s=%s\n", "blue", sio->blue);
873 (void)fprintf(minitrc_fp, "%s=%s\n", "magenta", sio->magenta);
874 (void)fprintf(minitrc_fp, "%s=%s\n", "cyan", sio->cyan);
875 (void)fprintf(minitrc_fp, "%s=%s\n", "white", sio->white);
876 (void)fprintf(minitrc_fp, "%s=%s\n", "bblack", sio->bblack);
877 (void)fprintf(minitrc_fp, "%s=%s\n", "bred", sio->bred);
878 (void)fprintf(minitrc_fp, "%s=%s\n", "bgreen", sio->bgreen);
879 (void)fprintf(minitrc_fp, "%s=%s\n", "byellow", sio->byellow);
880 (void)fprintf(minitrc_fp, "%s=%s\n", "bblue", sio->bblue);
881 (void)fprintf(minitrc_fp, "%s=%s\n", "bmagenta", sio->bmagenta);
882 (void)fprintf(minitrc_fp, "%s=%s\n", "bcyan", sio->bcyan);
883 (void)fprintf(minitrc_fp, "%s=%s\n", "bwhite", sio->bwhite);
884 (void)fprintf(minitrc_fp, "%s=%s\n", "editor", init->editor);
885 (void)fprintf(minitrc_fp, "%s=%s\n", "mapp_data", init->mapp_data);
886 (void)fprintf(minitrc_fp, "%s=%s\n", "mapp_help", init->mapp_help);
887 (void)fprintf(minitrc_fp, "%s=%s\n", "mapp_home", init->mapp_home);
888 (void)fprintf(minitrc_fp, "%s=%s\n", "mapp_msrc", init->mapp_msrc);
889 (void)fprintf(minitrc_fp, "%s=%s\n", "mapp_user", init->mapp_user);
890 (void)fclose(minitrc_fp);
891 strnz__cpy(tmp_str, "Configuration written to file: ", MAXLEN - 1);
892 strnz__cat(tmp_str, minitrc_dmp, MAXLEN - 1);
893 Perror(tmp_str);
894 return 0;
895}
896/** @brief Derive full file specification from directory and file name
897 @ingroup init
898 @param file_spec - output full file specification
899 @param dir - directory path
900 @param file_name - file name
901 @returns true if file_spec is derived, false otherwise
902 @details If dir is nullptr, use MAPP_DIR environment variable or default
903 directory, ~/menuapp.
904 file_spec should be a pre-allocated char array of size MAXLEN to
905 hold the resulting file specification
906 */
907bool derive_file_spec(char *file_spec, char *dir, char *file_name) {
908 char ts[MAXLEN];
909 char ts2[MAXLEN];
910 char *e;
911
912 if (!file_name || !*file_name) {
913 *file_spec = '\0';
914 return false;
915 }
916 if (dir) {
917 strnz__cpy(ts, dir, MAXLEN - 1);
918 } else {
919 e = getenv("MAPP_DIR");
920 if (e) {
921 strnz__cpy(ts, e, MAXLEN - 1);
922 } else {
923 strnz__cpy(ts, "~/menuapp", MAXLEN - 1);
924 }
925 }
926 trim_path(ts);
927 strnz__cpy(ts2, ts, MAXLEN - 1);
928 // construct the full file specification
929 // check that the file exists and is readable
930 strnz__cpy(file_spec, ts2, MAXLEN - 1);
931 strnz__cat(file_spec, "/", MAXLEN - 1);
932 strnz__cat(file_spec, file_name, MAXLEN - 1);
933 return true;
934}
935/** @brief Display the version information of the application
936 @ingroup init
937 @details The version information is defined in the mapp_version variable
938 and is printed to stdout when this function is called. */
940 fprintf(stdout, "\nC-Menu %s\n", CM_VERSION);
941 fprintf(stdout, "\nC-Menu %s\n", CM_VERSION);
942 fprintf(stdout, "C version: %ld\n", __STDC_VERSION__);
943}
944/** @brief Print an option and its value in a formatted manner
945 @ingroup init
946 @param o - option flag (e.g., "-a:")
947 @param name - option name (e.g., "--minitrc")
948 @param value - option value to print
949 @details This function is used to display the current configuration options
950 and their values in a readable format. */
951void opt_prt_char(const char *o, const char *name, const char *value) {
952 fprintf(stdout, "%3s %-15s: %s\n", o, name, value);
953}
954/** @brief Print an option and its value in a formatted manner for integer
955 values
956 @ingroup init
957 @param o - option flag (e.g., "-C:")
958 @param name - option name (e.g., "--cols")
959 @param value - integer option value to print
960 @details This function is used to display the current configuration options
961 and their integer values in a readable format. */
962void opt_prt_str(const char *o, const char *name, const char *value) {
963 fprintf(stdout, "%3s %-15s: %s\n", o, name, value);
964}
965/** @brief Print an option and its value in a formatted manner for integer
966 values
967 @ingroup init
968 @param o - option flag (e.g., "-C:")
969 @param name - option name (e.g., "--cols")
970 @param value - integer option value to print
971 @details This function is used to display the current configuration options
972 and their integer values in a readable format. */
973void opt_prt_int(const char *o, const char *name, int value) {
974 fprintf(stdout, "%3s %-15s: %d\n", o, name, value);
975}
976/** @brief Print an option and its value in a formatted manner for double
977 values
978 @ingroup init
979 @param o - option flag (e.g., "-r:")
980 @param name - option name (e.g., "red_gamma")
981 @param value - double option value to print
982 @details This function is used to display the current configuration options
983 and their double values in a readable format. */
984void opt_prt_double(const char *o, const char *name, double value) {
985 fprintf(stdout, "%3s %-15s: %0.2f\n", o, name, value);
986}
987/** @brief Print an option and its value in a formatted manner for boolean
988 values
989 @ingroup init
990 @param o - option flag (e.g., "-z")
991 @param name - option name (e.g., "f_squeeze")
992 @param value - boolean option value to print
993 @details This function is used to display the current configuration options
994 and their boolean values in a readable format, printing "true" or "false"
995 based on the value. */
996void opt_prt_bool(const char *o, const char *name, bool value) {
997 fprintf(stdout, "%3s %-15s: %s\n", o, name, value ? "true" : "false");
998}
999/** @brief Dump the current configuration to stdout for debugging purposes
1000 @ingroup init
1001 @param init - pointer to Init struct containing the current
1002 configuration
1003 @param msg - string to print before dumping the configuration to stdout
1004 in a readable format, prefixed by the provided title string. */
1005void dump_config(Init *init, char *msg) {
1006 SIO *sio = init->sio;
1007 opt_prt_str("-a:", "--minitrc", init->minitrc);
1008 opt_prt_str("-k:", " parent_cmd", init->parent_cmd);
1009 opt_prt_int("-C:", " cols", init->cols);
1010 opt_prt_int("-L:", " lines", init->lines);
1011 opt_prt_int("-n:", " select_max", init->select_max);
1012 opt_prt_str("-o:", " out_spec", init->out_spec);
1013 opt_prt_int("-X:", " begx", init->begx);
1014 opt_prt_int("-Y:", " begy", init->begy);
1015 opt_prt_str("-A:", " cmd_all", init->cmd_all);
1016 opt_prt_str("-c:", " cmd", init->cmd);
1017 opt_prt_str("-d:", "--mapp_spec", init->mapp_spec);
1018 opt_prt_str(" ", " help_spec", init->help_spec);
1019 opt_prt_str("-i:", " in_spec", init->in_spec);
1020 opt_prt_str("-R:", " receiver_cmd", init->receiver_cmd);
1021 opt_prt_str("-S:", " provider_cmd", init->provider_cmd);
1022 opt_prt_str(" ", " title", init->title);
1023 opt_prt_bool("-e:", " f_erase_remainder", init->f_erase_remainder);
1024 opt_prt_bool("-a ", " f_strip_ansi", init->f_strip_ansi);
1025 opt_prt_bool("-s ", " f_squeeze", init->f_squeeze);
1026 opt_prt_bool("-x:", " f_ignore_case", init->f_ignore_case);
1027 opt_prt_bool("-N:", " f_ln", init->f_ln);
1028 opt_prt_int("-t:", " tab_stop", init->tab_stop);
1029 opt_prt_int("-w:", " wait_timeout", wait_timeout);
1030 opt_prt_str("-u ", " brackets", init->brackets);
1031 opt_prt_str("-f:", " fill_char", init->fill_char);
1032 opt_prt_str(" ", " editor", init->editor);
1033 opt_prt_str(" ", " bg_clr_x", sio->bg_clr_x);
1034 opt_prt_str(" ", " bo_clr_x", sio->bo_clr_x);
1035 opt_prt_str(" ", " fg_clr_x", sio->fg_clr_x);
1036 opt_prt_str(" ", " ln_bg_clr_x", sio->ln_bg_clr_x);
1037 opt_prt_str(" ", " ln_clr_x", sio->ln_clr_x);
1038 opt_prt_double(" ", " blue_gamma", sio->blue_gamma);
1039 opt_prt_double(" ", " gray_gamma", sio->gray_gamma);
1040 opt_prt_double(" ", " green_gamma", sio->green_gamma);
1041 opt_prt_double(" ", " red_gamma", sio->red_gamma);
1042 opt_prt_str(" ", " black", sio->black);
1043 opt_prt_str(" ", " red", sio->red);
1044 opt_prt_str(" ", " green", sio->green);
1045 opt_prt_str(" ", " yellow", sio->yellow);
1046 opt_prt_str(" ", " blue", sio->blue);
1047 opt_prt_str(" ", " magenta", sio->magenta);
1048 opt_prt_str(" ", " cyan", sio->cyan);
1049 opt_prt_str(" ", " white", sio->white);
1050 opt_prt_str(" ", " orange", sio->orange);
1051 opt_prt_str(" ", " bblack", sio->bblack);
1052 opt_prt_str(" ", " bred", sio->bred);
1053 opt_prt_str(" ", " bgreen", sio->bgreen);
1054 opt_prt_str(" ", " byellow", sio->byellow);
1055 opt_prt_str(" ", " bblue", sio->bblue);
1056 opt_prt_str(" ", " bmagenta", sio->bmagenta);
1057 opt_prt_str(" ", " bcyan", sio->bcyan);
1058 opt_prt_str(" ", " bwhite", sio->bwhite);
1059 opt_prt_str(" ", " borange", sio->borange);
1060 opt_prt_str(" ", "--mapp_data", init->mapp_data);
1061 opt_prt_str(" ", "--mapp_help", init->mapp_help);
1062 opt_prt_str(" ", "--mapp_home", init->mapp_home);
1063 opt_prt_str(" ", "--mapp_msrc", init->mapp_msrc);
1064 opt_prt_str(" ", "--mapp_user", init->mapp_user);
1065 (void)fprintf(stdout, "\n%s\n\n", msg);
1066}
Init * init
Definition init.c:74
int wait_timeout
Definition futil.c:144
#define COLOR_LEN
Definition cm.h:216
#define nullptr
Definition cm.h:25
#define min(x, y)
min macro evaluates two expressions, returning least result
Definition cm.h:56
bool str_to_bool(const char *)
Converts String to boolean true or false.
Definition futil.c:875
#define max(a, b)
max macro evaluates two expressions, returning greatest result.
Definition cm.h:49
#define CM_VERSION
Definition version.h:7
#define MAXLEN
Definition curskeys.c:15
bool f_dump_config
Definition init.c:69
const char * argp_program_version
Definition init.c:84
@ XBRED
Definition init.c:47
@ MAPP_HOME
Definition init.c:59
@ XGREEN
Definition init.c:52
@ XRED
Definition init.c:54
@ MAPP_DATA
Definition init.c:57
@ XBCYAN
Definition init.c:42
@ XYELLOW
Definition init.c:56
@ FG_XCLR
Definition init.c:33
@ MAPP_SPEC
Definition init.c:64
@ XBYELLOW
Definition init.c:49
@ BO_XCLR
Definition init.c:32
@ GM_BLUE
Definition init.c:36
@ XCYAN
Definition init.c:50
@ XBBLACK
Definition init.c:40
@ XBLUE
Definition init.c:45
@ XWHITE
Definition init.c:55
@ GM_GRAY
Definition init.c:37
@ GM_GREEN
Definition init.c:38
@ BG_XCLR
Definition init.c:31
@ HELP_SPEC
Definition init.c:65
@ OUT_SPEC
Definition init.c:30
@ LN_BG_CLR
Definition init.c:34
@ XBWHITE
Definition init.c:48
@ MAPP_DATA_DIR
Definition init.c:63
@ MAPP_USER
Definition init.c:61
@ XBGREEN
Definition init.c:43
@ MAPP_HELP_DIR
Definition init.c:62
@ MAPP_MSRC
Definition init.c:60
@ XBLACK
Definition init.c:44
@ XBMAGENTA
Definition init.c:46
@ XBBLUE
Definition init.c:41
@ IN_SPEC
Definition init.c:29
@ LN_XCLR
Definition init.c:35
@ GM_RED
Definition init.c:39
@ CM_EDITOR
Definition init.c:51
@ XMAGENTA
Definition init.c:53
@ MAPP_HELP
Definition init.c:58
int executor
Definition init.c:82
const char * argp_program_bug_address
Definition init.c:85
bool f_write_config
Definition init.c:68
int Perror(char *)
Display a simple error message window or print to stderr.
Definition dwin.c:1162
void abend(int, char *)
Abnormal program termination.
Definition dwin.c:1588
size_t strnz__cpy(char *, const char *, size_t)
safer alternative to strncpy
Definition futil.c:435
int destroy_argv(int argc, char **argv)
Deallocates memory allocated for argument strings in argv.
Definition futil.c:385
double str_to_double(char *)
converts string to double
Definition futil.c:863
size_t ssnprintf(char *, size_t, const char *,...)
ssnprintf was designed to be a safer alternative to snprintf.
Definition futil.c:311
bool expand_tilde(char *, int)
Replaces "~/" in string with the user's home directory.
Definition futil.c:904
size_t strnz__cat(char *, const char *, size_t)
safer alternative to strncat
Definition futil.c:464
bool verify_dir(char *, int)
Verifies that the directory specified by "spec" exists and is accessible with the permissions specifi...
Definition futil.c:1050
bool trim_path(char *)
Trims trailing spaces and slashes from directory path in place.
Definition futil.c:922
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.
Definition init.c:962
int parse_opt_args(Init *, int, char **)
Parse command-line options and set Init struct values accordingly.
Definition init.c:427
void dump_config(Init *, char *)
Dump the current configuration to stdout for debugging purposes.
Definition init.c:1005
bool derive_file_spec(char *, char *, char *)
Derive full file specification from directory and file name.
Definition init.c:907
void display_version()
Display the version information of the application.
Definition init.c:939
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.
Definition init.c:984
void opt_prt_char(const char *o, const char *name, const char *value)
Print an option and its value in a formatted manner.
Definition init.c:951
int write_config(Init *)
Write the current configuration to a file specified in init->minitrc.
Definition init.c:797
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.
Definition init.c:996
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.
Definition init.c:973
int parse_config(Init *)
parse the configuration file specified in init->minitrc and set Init struct values accordingly
Definition init.c:476
void mapp_initialization(Init *, int, char **)
Main initialization function for MAPP - Menu Application.
Definition init.c:328
void zero_opt_args(Init *)
Initialize optional arguments in the Init struct to default values.
Definition init.c:442
char title[MAXLEN]
Definition common.h:120
char mapp_data[MAXLEN]
Definition common.h:136
char minitrc[MAXLEN]
Definition common.h:161
bool f_out_spec
Definition common.h:158
char mapp_help[MAXLEN]
Definition common.h:137
int begx
Definition common.h:109
bool f_title
Definition common.h:153
SIO * sio
Definition common.h:105
char in_spec[MAXLEN]
Definition common.h:155
char cmd_all[MAXLEN]
Definition common.h:114
int argc
Definition common.h:121
char fill_char[2]
Definition common.h:134
char mapp_msrc[MAXLEN]
Definition common.h:138
int cols
Definition common.h:107
int tab_stop
Definition common.h:168
bool f_erase_remainder
Definition common.h:131
bool f_mapp_desc
Definition common.h:148
char mapp_home[MAXLEN]
Definition common.h:135
bool f_squeeze
Definition common.h:127
int begy
Definition common.h:108
char parent_cmd[MAXLEN]
Definition common.h:115
char mapp_spec[MAXLEN]
Definition common.h:163
char receiver_cmd[MAXLEN]
Definition common.h:112
bool f_multiple_cmd_args
Definition common.h:129
int select_max
Definition common.h:166
bool f_ln
Definition common.h:132
bool f_mapp_spec
Definition common.h:143
char provider_cmd[MAXLEN]
Definition common.h:111
char out_spec[MAXLEN]
Definition common.h:156
bool f_strip_ansi
Definition common.h:126
bool f_at_end_remove
Definition common.h:125
char brackets[3]
Definition common.h:133
bool f_ignore_case
Definition common.h:124
char ** argv
Definition common.h:122
int lines
Definition common.h:106
char mapp_user[MAXLEN]
Definition common.h:139
char cmd[MAXLEN]
Definition common.h:113
bool f_help_spec
Definition common.h:154
bool f_receiver_cmd
Definition common.h:150
bool f_provider_cmd
Definition common.h:149
char help_spec[MAXLEN]
Definition common.h:164
char editor[MAXLEN]
Definition common.h:159
bool f_in_spec
Definition common.h:157
char nt_hl_rev_bg[COLOR_LEN]
Definition cm.h:735
double green_gamma
Definition cm.h:698
char nt_rev_bg[COLOR_LEN]
Definition cm.h:729
char black[COLOR_LEN]
Definition cm.h:701
char bg_clr_x[COLOR_LEN]
Definition cm.h:722
char fg_clr_x[COLOR_LEN]
Definition cm.h:721
double blue_gamma
Definition cm.h:699
char bred[COLOR_LEN]
Definition cm.h:711
char yellow[COLOR_LEN]
Definition cm.h:704
char nt_hl_bg[COLOR_LEN]
Definition cm.h:731
char nt_hl_fg[COLOR_LEN]
Definition cm.h:730
char bo_clr_x[COLOR_LEN]
Definition cm.h:723
char bcyan[COLOR_LEN]
Definition cm.h:716
char borange[COLOR_LEN]
Definition cm.h:718
double red_gamma
Definition cm.h:697
char red[COLOR_LEN]
Definition cm.h:702
char nt_fg[COLOR_LEN]
Definition cm.h:726
char magenta[COLOR_LEN]
Definition cm.h:706
char bgreen[COLOR_LEN]
Definition cm.h:712
char nt_rev_fg[COLOR_LEN]
Definition cm.h:728
char ln_clr_x[COLOR_LEN]
Definition cm.h:724
char byellow[COLOR_LEN]
Definition cm.h:713
char bwhite[COLOR_LEN]
Definition cm.h:717
char ln_bg_clr_x[COLOR_LEN]
Definition cm.h:725
char cyan[COLOR_LEN]
Definition cm.h:707
char orange[COLOR_LEN]
Definition cm.h:709
char green[COLOR_LEN]
Definition cm.h:703
char white[COLOR_LEN]
Definition cm.h:708
char bg[COLOR_LEN]
Definition cm.h:719
char bblue[COLOR_LEN]
Definition cm.h:714
char bmagenta[COLOR_LEN]
Definition cm.h:715
char blue[COLOR_LEN]
Definition cm.h:705
char nt_hl_rev_fg[COLOR_LEN]
Definition cm.h:733
double gray_gamma
Definition cm.h:700
char bblack[COLOR_LEN]
Definition cm.h:710
char nt_bg[COLOR_LEN]
Definition cm.h:727