|
|
983249 |
diff -up bltk-1.0.9/tools/bltk/parseconf.c.conf_home bltk-1.0.9/tools/bltk/parseconf.c
|
|
|
983249 |
--- bltk-1.0.9/tools/bltk/parseconf.c.conf_home 2009-07-31 10:11:51.812041537 +0200
|
|
|
983249 |
+++ bltk-1.0.9/tools/bltk/parseconf.c 2009-07-31 10:14:00.747294693 +0200
|
|
|
983249 |
@@ -47,7 +47,8 @@
|
|
|
983249 |
|
|
|
983249 |
#include "bltk.h"
|
|
|
983249 |
|
|
|
983249 |
-#define BLTK_CONF "/etc/bltk.conf"
|
|
|
983249 |
+#define BLTK_CONF "bltk.conf"
|
|
|
983249 |
+#define BLTK_HOME ".bltk"
|
|
|
983249 |
|
|
|
983249 |
typedef struct para_item_str_t
|
|
|
983249 |
{
|
|
|
983249 |
@@ -221,12 +222,24 @@ void
|
|
|
983249 |
param_load_conf()
|
|
|
983249 |
{
|
|
|
983249 |
char str[STR_LEN];
|
|
|
983249 |
+ char conf_file[STR_LEN];
|
|
|
983249 |
char name[STR_LEN], val[STR_LEN];
|
|
|
983249 |
int index, len;
|
|
|
983249 |
FILE *f;
|
|
|
983249 |
|
|
|
983249 |
- if ((f = fopen(BLTK_CONF, "rt")) != NULL)
|
|
|
983249 |
+
|
|
|
983249 |
+ sprintf(conf_file, "%s/%s/%s", getenv("HOME"), BLTK_HOME, BLTK_CONF);
|
|
|
983249 |
+ if ((f = fopen(conf_file, "rt")) == NULL)
|
|
|
983249 |
{
|
|
|
983249 |
+ sprintf(conf_file, "/etc/%s", BLTK_CONF);
|
|
|
983249 |
+ f = fopen(conf_file, "rt");
|
|
|
983249 |
+ }
|
|
|
983249 |
+
|
|
|
983249 |
+ if (f != NULL)
|
|
|
983249 |
+ {
|
|
|
983249 |
+ sprintf(str, "BLTK_CONF=%s", conf_file);
|
|
|
983249 |
+ putenv(strdup(str));
|
|
|
983249 |
+
|
|
|
983249 |
while (fgets(str, STR_LEN, f) != NULL)
|
|
|
983249 |
{
|
|
|
983249 |
if ((len = strlen(str)) > 0 && str[len-1] == '\n')
|
|
|
983249 |
@@ -264,7 +277,7 @@ param_load_defaults()
|
|
|
983249 |
|
|
|
983249 |
if (bltk_home == NULL)
|
|
|
983249 |
{
|
|
|
983249 |
- sprintf(str, "%s/.bltk", getenv("HOME"));
|
|
|
983249 |
+ sprintf(str, "%s/%s", getenv("HOME"), BLTK_HOME);
|
|
|
983249 |
bltk_home = strdup(str);
|
|
|
983249 |
} else if (bltk_home[0] == '~') {
|
|
|
983249 |
sprintf(str, "%s%s", getenv("HOME"), bltk_home+1);
|