81 const char* description) {
82 int pre_length = 4 + 2 + 4 + strlen(lo);
84 printf(
" %s-%c%s %s--%s%s",
89 pre_length += 3 + strlen(args);
92 for(
int i = 39 - pre_length; i > 0; i--) {
101 printf(
" %s*%s Short and long options take the same arguments\n",
c(
YELLOW),
c(
RESET));
103 printf(
" %s*%s At least one odl file or odl string must be specified\n",
c(
YELLOW),
c(
RESET));
105 printf(
" %s*%s Each bus backend can only be specified once\n",
c(
YELLOW),
c(
RESET));
107 printf(
" %s*%s The process daemizes (-D) after the entry points are called, but before\n",
c(
YELLOW),
c(
RESET));
108 printf(
" the data model is registered to the busses.\n");
110 printf(
" %s*%s All command line options can be put in the config section of one\n",
c(
YELLOW),
c(
RESET));
111 printf(
" of the main odls.\n");
116 printf(
"%sExample config section:%s\n",
c(
CYAN),
c(
RESET));
119 printf(
" %suris%s = %s\"pcb:/var/run/pcb_sys,ubus:/var/run/ubus/ubus.sock\"%s;\n",
c(
BLUE),
c(
RESET),
c(
CYAN),
c(
RESET));
120 printf(
" %sbackends%s = %s\"/usr/bin/mods/amxb/mod-amxb-pcb.so,/usr/bin/mods/amxb/mod-amxb-ubus.so\"%s;\n",
c(
BLUE),
c(
RESET),
c(
CYAN),
c(
RESET));
139 const char* name = GET_CHAR(&
rt->
parser.config,
"name");
169 fprintf(stderr,
"\n%sConfiguration:%s\n",
c(
GREEN),
c(
RESET));
171 amxc_var_dump(&
rt->
parser.config, STDERR_FILENO);
180 vsyslog(LOG_USER | LOG_ERR, fmt, args);
186 vfprintf(stderr, fmt, args);
189 fprintf(stderr,
"%s\n",
c(
RESET));
199 vsyslog(LOG_USER | LOG_NOTICE,
"%s", args);
205 vfprintf(stderr, fmt, args);
208 fprintf(stderr,
"%s\n",
c(
RESET));
215 const char* msg = amxo_parser_get_message(parser);
218 syslog(LOG_USER | LOG_CRIT,
"Failed parsing - %s",
string == NULL ?
"###" :
string);
219 syslog(LOG_USER | LOG_CRIT,
"Reason - %s", msg == NULL ?
"###" : msg);
221 fprintf(stderr,
"%sERROR%s -- Failed parsing %s%s%s\n",
223 c(
CYAN),
string == NULL ?
"###" :
string,
c(
RESET));
225 fprintf(stderr,
"%sREASON%s -- %s%s%s\n",
#define COLOR_BRIGHT_YELLOW
#define COLOR_BRIGHT_GREEN
PRIVATE amxrt_t * amxrt_get(void)
#define COLOR_BRIGHT_WHITE
#define COLOR_BRIGHT_CYAN
#define COLOR_BRIGHT_BLUE
void amxrt_print_error(const char *fmt,...)
static void amxrt_print_config_example(void)
const char * get_color(uint32_t cc)
void amxrt_print_message(const char *fmt,...)
static void amxrt_print_notes(void)
static const char * colors[]
void amxrt_print_configuration(void)
static void amxrt_cmd_line_arg(const char so, const char *lo, const char *args, const char *description)
void amxrt_print_help(void)
void amxrt_print_failure(amxo_parser_t *parser, const char *string)
void amxrt_print_usage(void)
Prints the usage information and all available options to stdout.
amxc_var_t * amxrt_get_config(void)
Gets the htable variant containing the configuration options.
amxc_llist_t cmd_line_args