hi,
when no config file is found strange letters are printed on stderr.
cause for that is the loop in luaA_parserc which should be
top-controlled.
also awesome just stays but does not allow any interaction - i would
prefere a logg-message and terminate awesome in that case.
see the patch attched, best regards,
michael
>From 975b6c0629d34a254d879ae5e0544d6939180747 Mon Sep 17 00:00:00 2001
From: M. Dietrich <[email protected]>
Date: Mon, 1 Jun 2009 13:01:31 +0200
Subject: [PATCH] fix loop over config files if none was found
if no file was found the string is just "\0" and neads a head
controled while
if no config file was found exit awesome with an error message
(fail early!)
add success logging when a file was found
---
awesome.c | 3 ++-
luaa.c | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/awesome.c b/awesome.c
index 321d98e..4e0775f 100644
--- a/awesome.c
+++ b/awesome.c
@@ -513,7 +513,8 @@ main(int argc, char **argv)
spawn_init();
/* Parse and run configuration file */
- luaA_parserc(&xdg, confpath, true);
+ if (!luaA_parserc(&xdg, confpath, true))
+ fatal("couldn't find any rc file");
xdgWipeHandle(&xdg);
diff --git a/luaa.c b/luaa.c
index 46dbee2..45b83d4 100644
--- a/luaa.c
+++ b/luaa.c
@@ -835,17 +835,18 @@ luaA_parserc(xdgHandle* xdg, const char *confpatharg, bool run)
char *tmp = confpath;
/* confpath is "string1\0string2\0string3\0\0" */
- do
+ while(*tmp != 0)
{
if(luaA_loadrc(tmp, run))
{
+ fprintf(stderr, "found & loaded rcfile from %s\n", tmp);
ret = true;
goto bailout;
}
else if(!run)
goto bailout;
tmp += a_strlen(tmp) + 1;
- } while(*tmp != 0);
+ }
bailout:
--
1.6.3.1