C-Menu 0.2.9
A User Interface Toolkit
Loading...
Searching...
No Matches
init.c File Reference

Initialization for Menu Application Programs. More...

#include <argp.h>
#include <common.h>
#include <locale.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
Include dependency graph for init.c:

Go to the source code of this file.

Enumerations

enum  {
  IN_SPEC = 257 , OUT_SPEC , BG_XCLR , BO_XCLR ,
  FG_XCLR , LN_BG_CLR , LN_XCLR , GM_BLUE ,
  GM_GRAY , GM_GREEN , GM_RED , XBBLACK ,
  XBBLUE , XBCYAN , XBGREEN , XBLACK ,
  XBLUE , XBMAGENTA , XBRED , XBWHITE ,
  XBYELLOW , XCYAN , CM_EDITOR , XGREEN ,
  XMAGENTA , XRED , XWHITE , XYELLOW ,
  MAPP_DATA , MAPP_HELP , MAPP_HOME , MAPP_MSRC ,
  MAPP_USER , MAPP_HELP_DIR , MAPP_DATA_DIR , MAPP_SPEC ,
  HELP_SPEC
}

Functions

int write_config (Init *init)
 Write the current configuration to a file specified in init->minitrc.
void display_version ()
 Display the version information of the application.
void mapp_initialization (Init *init, int argc, char **argv)
 Main initialization function for MAPP - Menu Application.
void zero_opt_args (Init *init)
 Initialize optional arguments in the Init struct to default values.
int parse_config (Init *init)
 parse the configuration file specified in init->minitrc and set Init struct values accordingly
int parse_opt_args (Init *, int, char **)
void dump_config (Init *init, char *msg)
 Dump the current configuration to stdout for debugging purposes.
bool derive_file_spec (char *file_spec, char *dir, char *file_name)
 Derive full file specification from directory and file name.
void opt_prt_char (const char *o, const char *name, const char *value)
 Print an option and its value in a formatted manner.
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.
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.
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_bool (const char *o, const char *name, bool value)
 Print an option and its value in a formatted manner for boolean values.

Variables

bool f_write_config = false
bool f_dump_config = false
Initinit = NULL
int executor = 0
const char * argp_program_version = CM_VERSION
const char * argp_program_bug_address = "billxwaller@gmail.com"
const int opt_doc_col = 33

Detailed Description

Initialization for Menu Application Programs.

Author
Bill Waller Copyright (c) 2025 MIT License billx.nosp@m.wall.nosp@m.er@gm.nosp@m.ail..nosp@m.com
Date
2026-02-09

Definition in file init.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
IN_SPEC 
OUT_SPEC 
BG_XCLR 
BO_XCLR 
FG_XCLR 
LN_BG_CLR 
LN_XCLR 
GM_BLUE 
GM_GRAY 
GM_GREEN 
GM_RED 
XBBLACK 
XBBLUE 
XBCYAN 
XBGREEN 
XBLACK 
XBLUE 
XBMAGENTA 
XBRED 
XBWHITE 
XBYELLOW 
XCYAN 
CM_EDITOR 
XGREEN 
XMAGENTA 
XRED 
XWHITE 
XYELLOW 
MAPP_DATA 
MAPP_HELP 
MAPP_HOME 
MAPP_MSRC 
MAPP_USER 
MAPP_HELP_DIR 
MAPP_DATA_DIR 
MAPP_SPEC 
HELP_SPEC 

Definition at line 27 of file init.c.

27 {
28 IN_SPEC = 257,
30 BG_XCLR,
31 BO_XCLR,
32 FG_XCLR,
34 LN_XCLR,
35 GM_BLUE,
36 GM_GRAY,
38 GM_RED,
39 XBBLACK,
40 XBBLUE,
41 XBCYAN,
42 XBGREEN,
43 XBLACK,
44 XBLUE,
46 XBRED,
47 XBWHITE,
49 XCYAN,
51 XGREEN,
53 XRED,
54 XWHITE,
55 XYELLOW,
65};
@ XBRED
Definition init.c:46
@ MAPP_HOME
Definition init.c:58
@ XGREEN
Definition init.c:51
@ XRED
Definition init.c:53
@ MAPP_DATA
Definition init.c:56
@ XBCYAN
Definition init.c:41
@ XYELLOW
Definition init.c:55
@ FG_XCLR
Definition init.c:32
@ MAPP_SPEC
Definition init.c:63
@ XBYELLOW
Definition init.c:48
@ BO_XCLR
Definition init.c:31
@ GM_BLUE
Definition init.c:35
@ XCYAN
Definition init.c:49
@ XBBLACK
Definition init.c:39
@ XBLUE
Definition init.c:44
@ XWHITE
Definition init.c:54
@ GM_GRAY
Definition init.c:36
@ GM_GREEN
Definition init.c:37
@ BG_XCLR
Definition init.c:30
@ HELP_SPEC
Definition init.c:64
@ OUT_SPEC
Definition init.c:29
@ LN_BG_CLR
Definition init.c:33
@ XBWHITE
Definition init.c:47
@ MAPP_DATA_DIR
Definition init.c:62
@ MAPP_USER
Definition init.c:60
@ XBGREEN
Definition init.c:42
@ MAPP_HELP_DIR
Definition init.c:61
@ MAPP_MSRC
Definition init.c:59
@ XBLACK
Definition init.c:43
@ XBMAGENTA
Definition init.c:45
@ XBBLUE
Definition init.c:40
@ IN_SPEC
Definition init.c:28
@ LN_XCLR
Definition init.c:34
@ GM_RED
Definition init.c:38
@ CM_EDITOR
Definition init.c:50
@ XMAGENTA
Definition init.c:52
@ MAPP_HELP
Definition init.c:57

Function Documentation

◆ parse_opt_args()

int parse_opt_args ( Init * init,
int argc,
char ** argv )

Definition at line 393 of file init.c.

393 {
394 init->argc = 0;
395 argp_parse(&argp, argc, argv, 0, 0, init);
396 return 0;
397}
Init * init
Definition common.h:186

References Init::argc.

Referenced by menu_cmd_processor(), popup_form(), popup_menu(), popup_pick(), and popup_view().

Here is the caller graph for this function:

Variable Documentation

◆ argp_program_bug_address

const char* argp_program_bug_address = "billxwaller@gmail.com"

Definition at line 84 of file init.c.

◆ argp_program_version

const char* argp_program_version = CM_VERSION

Definition at line 83 of file init.c.

◆ executor

int executor = 0

Definition at line 81 of file init.c.

◆ f_dump_config

bool f_dump_config = false

Definition at line 68 of file init.c.

Referenced by mapp_initialization().

◆ f_write_config

bool f_write_config = false

Definition at line 67 of file init.c.

Referenced by mapp_initialization().

◆ init

Init* init = NULL

Definition at line 73 of file init.c.

◆ opt_doc_col

const int opt_doc_col = 33

Definition at line 87 of file init.c.