aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2012-11-01 16:43:07 +0000
committerLRN <lrn1986@gmail.com>2012-11-01 16:43:07 +0000
commitb9d0c35af63d28f00e1a482fe8e6047d1281d76c (patch)
treee4c8db625a6301027d2eb2d00b10cb8506de7a23 /src
parent6d6d82b6152c5dbcbc49d375b1ff34a75017c729 (diff)
downloadgnunet-b9d0c35af63d28f00e1a482fe8e6047d1281d76c.tar.gz
gnunet-b9d0c35af63d28f00e1a482fe8e6047d1281d76c.zip
More configuration debugging
Diffstat (limited to 'src')
-rw-r--r--src/util/configuration.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c
index 60ed484bb..5ce6db269 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -168,6 +168,7 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
168 int ret; 168 int ret;
169 char *section; 169 char *section;
170 170
171 LOG (GNUNET_ERROR_TYPE_DEBUG, "Deserializing config file\n");
171 ret = GNUNET_OK; 172 ret = GNUNET_OK;
172 section = GNUNET_strdup (""); 173 section = GNUNET_strdup ("");
173 nr = 0; 174 nr = 0;
@@ -222,6 +223,7 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
222 /* [value] */ 223 /* [value] */
223 GNUNET_free (section); 224 GNUNET_free (section);
224 section = GNUNET_strdup (value); 225 section = GNUNET_strdup (value);
226 LOG (GNUNET_ERROR_TYPE_DEBUG, "Config section `%s'\n", section);
225 } 227 }
226 else if (2 == SSCANF (line, " %63[^= ] = %191[^\n]", tag, value)) 228 else if (2 == SSCANF (line, " %63[^= ] = %191[^\n]", tag, value))
227 { 229 {
@@ -245,11 +247,13 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
245 else 247 else
246 i = 0; 248 i = 0;
247 } 249 }
250 LOG (GNUNET_ERROR_TYPE_DEBUG, "Config value %s=%s\n", tag, value);
248 GNUNET_CONFIGURATION_set_value_string (cfg, section, tag, &value[i]); 251 GNUNET_CONFIGURATION_set_value_string (cfg, section, tag, &value[i]);
249 } 252 }
250 else if (1 == SSCANF (line, " %63[^= ] =[^\n]", tag)) 253 else if (1 == SSCANF (line, " %63[^= ] =[^\n]", tag))
251 { 254 {
252 /* tag = */ 255 /* tag = */
256 LOG (GNUNET_ERROR_TYPE_DEBUG, "Config value %s is empty\n", tag);
253 GNUNET_CONFIGURATION_set_value_string (cfg, section, tag, ""); 257 GNUNET_CONFIGURATION_set_value_string (cfg, section, tag, "");
254 } 258 }
255 else 259 else
@@ -261,6 +265,7 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
261 break; 265 break;
262 } 266 }
263 } 267 }
268 LOG (GNUNET_ERROR_TYPE_DEBUG, "Finished deserializing config\n", tag);
264 GNUNET_free (section); 269 GNUNET_free (section);
265 GNUNET_assert (r_bytes == size); 270 GNUNET_assert (r_bytes == size);
266 return ret; 271 return ret;
@@ -286,7 +291,9 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
286 int dirty; 291 int dirty;
287 int ret; 292 int ret;
288 293
294 LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to parse config file `%s'\n", filename);
289 fn = GNUNET_STRINGS_filename_expand (filename); 295 fn = GNUNET_STRINGS_filename_expand (filename);
296 LOG (GNUNET_ERROR_TYPE_DEBUG, "Config file name expanded to `%s'\n", fn);
290 if (fn == NULL) 297 if (fn == NULL)
291 return GNUNET_SYSERR; 298 return GNUNET_SYSERR;
292 dirty = cfg->dirty; /* back up value! */ 299 dirty = cfg->dirty; /* back up value! */
@@ -314,6 +321,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
314 GNUNET_free (mem); 321 GNUNET_free (mem);
315 return GNUNET_SYSERR; 322 return GNUNET_SYSERR;
316 } 323 }
324 LOG (GNUNET_ERROR_TYPE_DEBUG, "Deserializing contents of file `%s'\n", fn);
317 GNUNET_free (fn); 325 GNUNET_free (fn);
318 ret = GNUNET_CONFIGURATION_deserialize (cfg, mem, fs, GNUNET_YES); 326 ret = GNUNET_CONFIGURATION_deserialize (cfg, mem, fs, GNUNET_YES);
319 GNUNET_free (mem); 327 GNUNET_free (mem);
@@ -890,13 +898,16 @@ GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Handle
890{ 898{
891 struct ConfigEntry *e; 899 struct ConfigEntry *e;
892 900
901 LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to retrieve string `%s' in section `%s'\n", option, section);
893 e = findEntry (cfg, section, option); 902 e = findEntry (cfg, section, option);
894 if ((e == NULL) || (e->val == NULL)) 903 if ((e == NULL) || (e->val == NULL))
895 { 904 {
905 LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to retrieve the string\n");
896 *value = NULL; 906 *value = NULL;
897 return GNUNET_SYSERR; 907 return GNUNET_SYSERR;
898 } 908 }
899 *value = GNUNET_strdup (e->val); 909 *value = GNUNET_strdup (e->val);
910 LOG (GNUNET_ERROR_TYPE_DEBUG, "Retrieved string `%s'\n", e->val);
900 return GNUNET_OK; 911 return GNUNET_OK;
901} 912}
902 913
@@ -1047,16 +1058,21 @@ GNUNET_CONFIGURATION_get_value_filename (const struct
1047 const char *option, char **value) 1058 const char *option, char **value)
1048{ 1059{
1049 char *tmp; 1060 char *tmp;
1050 1061
1062 LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to retrieve filename `%s' in section `%s'\n", option, section);
1051 if (GNUNET_OK != 1063 if (GNUNET_OK !=
1052 GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &tmp)) 1064 GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &tmp))
1053 { 1065 {
1066 LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to retrieve filename\n");
1054 *value = NULL; 1067 *value = NULL;
1055 return GNUNET_SYSERR; 1068 return GNUNET_SYSERR;
1056 } 1069 }
1070 LOG (GNUNET_ERROR_TYPE_DEBUG, "Retrieved filename `%s', $-expanding\n", tmp);
1057 tmp = GNUNET_CONFIGURATION_expand_dollar (cfg, tmp); 1071 tmp = GNUNET_CONFIGURATION_expand_dollar (cfg, tmp);
1072 LOG (GNUNET_ERROR_TYPE_DEBUG, "Expanded to filename `%s', *nix-expanding\n", tmp);
1058 *value = GNUNET_STRINGS_filename_expand (tmp); 1073 *value = GNUNET_STRINGS_filename_expand (tmp);
1059 GNUNET_free (tmp); 1074 GNUNET_free (tmp);
1075 LOG (GNUNET_ERROR_TYPE_DEBUG, "Filename result is `%s'\n", *value);
1060 if (*value == NULL) 1076 if (*value == NULL)
1061 return GNUNET_SYSERR; 1077 return GNUNET_SYSERR;
1062 return GNUNET_OK; 1078 return GNUNET_OK;