]>
Commit | Line | Data |
---|---|---|
587244be | 1 | diff -Nru althea-0.5.7/load_config.cpp althea-0.5.7.new/load_config.cpp |
2 | --- althea-0.5.7/load_config.cpp Tue Jan 22 17:30:15 2002 | |
3 | +++ althea-0.5.7.new/load_config.cpp Sat Mar 22 20:30:52 2003 | |
4 | @@ -22,14 +22,28 @@ | |
5 | ||
6 | bool savepassword=1, usessl=0, usesmtps=0; | |
7 | ||
8 | - // Get the environment variable HOME, this is POSIX and Windows Compliant | |
9 | - home_directory=(char *)malloc(255); | |
10 | - strcpy(home_directory,getenv ("HOME")); | |
11 | - strcat(home_directory, "/"); | |
12 | - strcat(home_directory, LOCAL_CONFIG_FILE); | |
13 | + char *etc_dir = getenv("ETC_DIR"); | |
14 | + if (etc_dir) | |
15 | + { | |
16 | + home_directory=(char *)malloc(255); | |
17 | + strcpy(home_directory,etc_dir); | |
18 | + strcat(home_directory, "/"); | |
19 | + strcat(home_directory, ETC_DIR_CONFIG_FILE); | |
20 | ||
21 | - local_config_in.open(home_directory); | |
22 | - free(home_directory); | |
23 | + local_config_in.open(home_directory); | |
24 | + free(home_directory); | |
25 | + } | |
26 | + else | |
27 | + { | |
28 | + // Get the environment variable HOME, this is POSIX and Windows Compliant | |
29 | + home_directory=(char *)malloc(255); | |
30 | + strcpy(home_directory,getenv ("HOME")); | |
31 | + strcat(home_directory, "/"); | |
32 | + strcat(home_directory, LOCAL_CONFIG_FILE); | |
33 | + | |
34 | + local_config_in.open(home_directory); | |
35 | + free(home_directory); | |
36 | + } | |
37 | rc_config_in.open(RC_CONFIG_FILE); | |
38 | ||
39 | ||
40 | diff -Nru althea-0.5.7/load_config.h althea-0.5.7.new/load_config.h | |
41 | --- althea-0.5.7/load_config.h Tue Jan 22 17:30:15 2002 | |
42 | +++ althea-0.5.7.new/load_config.h Sat Mar 22 20:28:33 2003 | |
43 | @@ -20,6 +20,7 @@ | |
44 | #include "promptwindow.h" | |
45 | ||
46 | #define LOCAL_CONFIG_FILE ".althearc" | |
47 | +#define ETC_DIR_CONFIG_FILE "althearc" | |
48 | #define RC_CONFIG_FILE "/etc/althearc" | |
49 | ||
50 | extern Althea gAlthea; | |
51 | diff -Nru althea-0.5.7/save_config.cpp althea-0.5.7.new/save_config.cpp | |
52 | --- althea-0.5.7/save_config.cpp Tue Jan 22 17:30:15 2002 | |
53 | +++ althea-0.5.7.new/save_config.cpp Sat Mar 22 20:33:17 2003 | |
54 | @@ -16,12 +16,24 @@ | |
55 | char* file_name; | |
56 | Configuration *config; | |
57 | ||
58 | - // Get the environment variable HOME, this is POSIX and Windows Compliant | |
59 | - file_name=(char *)malloc (255); | |
60 | - strcpy(file_name, getenv ("HOME")); | |
61 | - strcat(file_name, "/"); | |
62 | - strcat(file_name,LOCAL_CONFIG_FILE); | |
63 | - config_file.open(file_name); | |
64 | + char *etc_dir = getenv("ETC_DIR"); | |
65 | + if (etc_dir) | |
66 | + { | |
67 | + file_name=(char *)malloc (255); | |
68 | + strcpy(file_name, etc_dir); | |
69 | + strcat(file_name, "/"); | |
70 | + strcat(file_name,ETC_DIR_CONFIG_FILE); | |
71 | + config_file.open(file_name); | |
72 | + } | |
73 | + else | |
74 | + { | |
75 | + // Get the environment variable HOME, this is POSIX and Windows Compliant | |
76 | + file_name=(char *)malloc (255); | |
77 | + strcpy(file_name, getenv ("HOME")); | |
78 | + strcat(file_name, "/"); | |
79 | + strcat(file_name,LOCAL_CONFIG_FILE); | |
80 | + config_file.open(file_name); | |
81 | + } | |
82 | if (gAlthea.get_Verbose()) | |
83 | cout << "Saveing to " << file_name << endl; | |
84 | ||
85 | diff -Nru althea-0.5.7/save_config.h althea-0.5.7.new/save_config.h | |
86 | --- althea-0.5.7/save_config.h Tue Jan 22 17:30:15 2002 | |
87 | +++ althea-0.5.7.new/save_config.h Sat Mar 22 20:31:26 2003 | |
88 | @@ -17,6 +17,7 @@ | |
89 | #include "crypto.h" | |
90 | ||
91 | #define LOCAL_CONFIG_FILE ".althearc" | |
92 | +#define ETC_DIR_CONFIG_FILE "althearc" | |
93 | #define RC_CONFIG_FILE "/etc/althearc" | |
94 | ||
95 | // The master function that saves the config in memory to disk |