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 <time.h>
#include <unistd.h>
Include dependency graph for init.c:

Go to the source code of this file.

Enumerations

enum  InitVariables {
  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

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

Variables

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

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

◆ InitVariables

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 28 of file init.c.

28 {
29 IN_SPEC = 257,
31 BG_XCLR,
32 BO_XCLR,
33 FG_XCLR,
35 LN_XCLR,
36 GM_BLUE,
37 GM_GRAY,
39 GM_RED,
40 XBBLACK,
41 XBBLUE,
42 XBCYAN,
43 XBGREEN,
44 XBLACK,
45 XBLUE,
47 XBRED,
48 XBWHITE,
50 XCYAN,
52 XGREEN,
54 XRED,
55 XWHITE,
56 XYELLOW,
InitVariables
Definition init.c:28
@ 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

Variable Documentation

◆ argp_program_bug_address

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

Definition at line 85 of file init.c.

◆ argp_program_version

const char* argp_program_version = CM_VERSION

Definition at line 84 of file init.c.

◆ executor

int executor = 0

Definition at line 82 of file init.c.

◆ f_dump_config

bool f_dump_config = false

Definition at line 69 of file init.c.

Referenced by mapp_initialization().

◆ f_write_config

bool f_write_config = false

Definition at line 68 of file init.c.

Referenced by mapp_initialization().

◆ init

Init* init = nullptr

Definition at line 74 of file init.c.

Referenced by main().