[awesome-message] config_parse() now returns status as int

That allows us to check if the config parsing is ok and exit
properly otherwise.
This commit is contained in:
Julien Danjou 2008-03-04 20:40:37 +01:00
parent 9d98d71ad1
commit fc7244758a
1 changed files with 7 additions and 4 deletions

View File

@ -66,7 +66,7 @@ exit_help(int exit_code)
exit(exit_code); exit(exit_code);
} }
static void static int
config_parse(const char *confpatharg) config_parse(const char *confpatharg)
{ {
int ret; int ret;
@ -91,7 +91,7 @@ config_parse(const char *confpatharg)
} }
if(ret) if(ret)
exit(ret); return ret;
/* get global screen section */ /* get global screen section */
cfg_screen = cfg_getsec(cfg, "screen"); cfg_screen = cfg_getsec(cfg, "screen");
@ -116,6 +116,8 @@ config_parse(const char *confpatharg)
cfg_getstr(cfg_general, "font")); cfg_getstr(cfg_general, "font"));
p_delete(&confpath); p_delete(&confpath);
return ret;
} }
static void static void
@ -133,7 +135,7 @@ main(int argc, char **argv)
XEvent ev; XEvent ev;
Area geometry = { 0, 0, 200, 50, NULL }, Area geometry = { 0, 0, 200, 50, NULL },
icon_geometry = { -1, -1, -1, -1, NULL }; icon_geometry = { -1, -1, -1, -1, NULL };
int opt; int opt, ret;
int delay = 0; int delay = 0;
char *configfile = NULL; char *configfile = NULL;
static struct option long_options[] = static struct option long_options[] =
@ -175,7 +177,8 @@ main(int argc, char **argv)
if(argc - optind < 1) if(argc - optind < 1)
exit_help(EXIT_FAILURE); exit_help(EXIT_FAILURE);
config_parse(configfile); if((ret = config_parse(configfile)))
return ret;
geometry.width = draw_textwidth(disp, globalconf.font, argv[optind]); geometry.width = draw_textwidth(disp, globalconf.font, argv[optind]);
geometry.height = globalconf.font->height * 1.5; geometry.height = globalconf.font->height * 1.5;