aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2012-11-01 16:42:56 +0000
committerLRN <lrn1986@gmail.com>2012-11-01 16:42:56 +0000
commit6d6d82b6152c5dbcbc49d375b1ff34a75017c729 (patch)
treec67bba827dfd0cc37e86a462e6a0b206da497d4b /src
parent1181d4edb8477bda88f106cb35e1ff18dfd7b5a8 (diff)
downloadgnunet-6d6d82b6152c5dbcbc49d375b1ff34a75017c729.tar.gz
gnunet-6d6d82b6152c5dbcbc49d375b1ff34a75017c729.zip
Debug for dollar-expansion
Diffstat (limited to 'src')
-rw-r--r--src/util/configuration.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c
index de6e542e8..60ed484bb 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -983,8 +983,13 @@ GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle
983 const char *post; 983 const char *post;
984 const char *env; 984 const char *env;
985 985
986 LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to $-expand %s\n", orig);
987
986 if (orig[0] != '$') 988 if (orig[0] != '$')
989 {
990 LOG (GNUNET_ERROR_TYPE_DEBUG, "Doesn't start with $ - not expanding\n");
987 return orig; 991 return orig;
992 }
988 i = 0; 993 i = 0;
989 while ((orig[i] != '/') && (orig[i] != '\\') && (orig[i] != '\0')) 994 while ((orig[i] != '/') && (orig[i] != '\\') && (orig[i] != '\0'))
990 i++; 995 i++;
@@ -997,16 +1002,21 @@ GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle
997 orig[i] = '\0'; 1002 orig[i] = '\0';
998 post = &orig[i + 1]; 1003 post = &orig[i + 1];
999 } 1004 }
1005 LOG (GNUNET_ERROR_TYPE_DEBUG, "Split into `%s' and `%s'\n", orig, post);
1000 if (GNUNET_OK != 1006 if (GNUNET_OK !=
1001 GNUNET_CONFIGURATION_get_value_filename (cfg, "PATHS", &orig[1], &prefix)) 1007 GNUNET_CONFIGURATION_get_value_filename (cfg, "PATHS", &orig[1], &prefix))
1002 { 1008 {
1009 LOG (GNUNET_ERROR_TYPE_DEBUG, "Filename for `%s' is not in PATHS config section\n", &orig[1]);
1003 if (NULL == (env = getenv (&orig[1]))) 1010 if (NULL == (env = getenv (&orig[1])))
1004 { 1011 {
1012 LOG (GNUNET_ERROR_TYPE_DEBUG, "`%s' is not an environment variable\n", &orig[1]);
1005 orig[i] = DIR_SEPARATOR; 1013 orig[i] = DIR_SEPARATOR;
1014 LOG (GNUNET_ERROR_TYPE_DEBUG, "Expanded to `%s' (returning orig)\n", orig);
1006 return orig; 1015 return orig;
1007 } 1016 }
1008 prefix = GNUNET_strdup (env); 1017 prefix = GNUNET_strdup (env);
1009 } 1018 }
1019 LOG (GNUNET_ERROR_TYPE_DEBUG, "Prefix is `%s'\n", prefix);
1010 result = GNUNET_malloc (strlen (prefix) + strlen (post) + 2); 1020 result = GNUNET_malloc (strlen (prefix) + strlen (post) + 2);
1011 strcpy (result, prefix); 1021 strcpy (result, prefix);
1012 if ((strlen (prefix) == 0) || 1022 if ((strlen (prefix) == 0) ||
@@ -1015,6 +1025,7 @@ GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle
1015 strcat (result, post); 1025 strcat (result, post);
1016 GNUNET_free (prefix); 1026 GNUNET_free (prefix);
1017 GNUNET_free (orig); 1027 GNUNET_free (orig);
1028 LOG (GNUNET_ERROR_TYPE_DEBUG, "Expanded to `%s'\n", result);
1018 return result; 1029 return result;
1019} 1030}
1020 1031