comparison cinst/mozilla.c @ 228:19de529ce7fb

Moved debug prefix to macro and added component specific prefix.
author Sascha Wilde <wilde@intevation.de>
date Thu, 27 Mar 2014 18:31:26 +0100
parents 29467940b07b
children e99e39d72af2
comparison
equal deleted inserted replaced
227:29467940b07b 228:19de529ce7fb
62 #include "debug.h" 62 #include "debug.h"
63 #include "errorcodes.h" 63 #include "errorcodes.h"
64 #include "portpath.h" 64 #include "portpath.h"
65 #include "strhelp.h" 65 #include "strhelp.h"
66 66
67 #define DEBUGPREFIX "MOZ-"
68
67 #ifndef _WIN32 69 #ifndef _WIN32
68 #define CONFDIRS ".mozilla", ".thunderbird" 70 #define CONFDIRS ".mozilla", ".thunderbird"
69 #define TARGET_LINUX 1 71 #define TARGET_LINUX 1
70 #else 72 #else
71 #define CONFDIRS "Mozilla", "Thunderbird" 73 #define CONFDIRS "Mozilla", "Thunderbird"
102 104
103 if ((cdir = getenv(envvar)) != NULL) 105 if ((cdir = getenv(envvar)) != NULL)
104 return cdir; 106 return cdir;
105 else 107 else
106 { 108 {
107 DEBUGPRINTF("DEBUG: FATAL! No %s in environment.\n", envvar); 109 DEBUGPRINTF("FATAL! No %s in environment.\n", envvar);
108 exit(ERR_MOZ_HOMELESS); 110 exit(ERR_MOZ_HOMELESS);
109 } 111 }
110 } 112 }
111 113
112 /** 114 /**
133 bool inprofile = false; 135 bool inprofile = false;
134 bool relative_path = false; 136 bool relative_path = false;
135 137
136 if ((inifile = fopen(inifile_name, "r")) != NULL) 138 if ((inifile = fopen(inifile_name, "r")) != NULL)
137 { 139 {
138 DEBUGPRINTF("DEBUG: Searching for profile paths in: '%s'\n", inifile_name); 140 DEBUGPRINTF("Searching for profile paths in: '%s'\n", inifile_name);
139 141
140 inifile_dirname = port_dirname(inifile_name); 142 inifile_dirname = port_dirname(inifile_name);
141 while (fgets(line, LINEBUFLEN, inifile) != NULL) 143 while (fgets(line, LINEBUFLEN, inifile) != NULL)
142 { 144 {
143 /* Determine if we are in an profile section */ 145 /* Determine if we are in an profile section */
161 snprintf(path, LINEBUFLEN, "%s/%s", inifile_dirname, value); 163 snprintf(path, LINEBUFLEN, "%s/%s", inifile_dirname, value);
162 else 164 else
163 strncpy(path, value, LINEBUFLEN); 165 strncpy(path, value, LINEBUFLEN);
164 if ((fqpath = port_realpath(path)) != NULL) 166 if ((fqpath = port_realpath(path)) != NULL)
165 { 167 {
166 DEBUGPRINTF("DEBUG: Found profile path: '%s'\n", fqpath); 168 DEBUGPRINTF("Found profile path: '%s'\n", fqpath);
167 strv_append(&dirs, fqpath, strlen(fqpath)); 169 strv_append(&dirs, fqpath, strlen(fqpath));
168 free (fqpath); 170 free (fqpath);
169 } 171 }
170 else 172 else
171 { 173 {
172 DEBUGPRINTF("DEBUG: WARN! Non existent profile path: '%s'\n", path); 174 DEBUGPRINTF("WARN! Non existent profile path: '%s'\n", path);
173 return_code |= WARN_MOZ_PROFILE_DOES_NOT_EXIST; 175 return_code |= WARN_MOZ_PROFILE_DOES_NOT_EXIST;
174 } 176 }
175 } 177 }
176 else if (str_equal(key, "IsRelative") && 178 else if (str_equal(key, "IsRelative") &&
177 str_starts_with(value, "1")) 179 str_starts_with(value, "1"))
180 } 182 }
181 fclose(inifile); 183 fclose(inifile);
182 } 184 }
183 else 185 else
184 { 186 {
185 DEBUGPRINTF("DEBUG: WARN! Could not open ini file: '%s'\n", inifile_name); 187 DEBUGPRINTF("WARN! Could not open ini file: '%s'\n", inifile_name);
186 return_code |= WARN_MOZ_FAILED_TO_OPEN_INI; 188 return_code |= WARN_MOZ_FAILED_TO_OPEN_INI;
187 } 189 }
188 return dirs; 190 return dirs;
189 } 191 }
190 192
228 snprintf(path, LINEBUFLEN, "%s/%s/%s/%s", 230 snprintf(path, LINEBUFLEN, "%s/%s/%s/%s",
229 confbase, 231 confbase,
230 confdirs[i], 232 confdirs[i],
231 mozdirent->d_name, 233 mozdirent->d_name,
232 "profiles.ini"); 234 "profiles.ini");
233 DEBUGPRINTF("DEBUG: checking for %s...\n", path); 235 DEBUGPRINTF("checking for %s...\n", path);
234 if ((fqpath = port_realpath(path)) != NULL) 236 if ((fqpath = port_realpath(path)) != NULL)
235 { 237 {
236 strv_append(&inis, fqpath, strlen(fqpath)); 238 strv_append(&inis, fqpath, strlen(fqpath));
237 DEBUGPRINTF("DEBUG: Found mozilla ini file: '%s'\n", fqpath); 239 DEBUGPRINTF("Found mozilla ini file: '%s'\n", fqpath);
238 free(fqpath); 240 free(fqpath);
239 } 241 }
240 } 242 }
241 } 243 }
242 closedir(mozdir); 244 closedir(mozdir);
243 } 245 }
244 else 246 else
245 { 247 {
246 DEBUGPRINTF("DEBUG: Could not open %s/%s\n", confbase, confdirs[i]); 248 DEBUGPRINTF("Could not open %s/%s\n", confbase, confdirs[i]);
247 } 249 }
248 } 250 }
249 if (inis == NULL) 251 if (inis == NULL)
250 { 252 {
251 DEBUGPRINTF("DEBUG: No ini files found - will do nothing!\n"); 253 DEBUGPRINTF("No ini files found - will do nothing!\n");
252 exit(WARN_MOZ_NO_PROFILES); 254 exit(WARN_MOZ_NO_PROFILES);
253 } 255 }
254 return inis; 256 return inis;
255 } 257 }
256 258

http://wald.intevation.org/projects/trustbridge/