config: file name expansion in all -f cases
authorJulius Bünger <buenger@mytum.de>
Thu, 7 Jun 2018 15:22:22 +0000 (17:22 +0200)
committerJulius Bünger <buenger@mytum.de>
Thu, 7 Jun 2018 15:23:34 +0000 (17:23 +0200)
src/util/gnunet-config.c

index 81e09fdbf83fc62b0cc667dd93d24f092049bf44..c01528a45069611fde13b602cba097c67f6cbc36 100644 (file)
@@ -72,12 +72,28 @@ print_option (void *cls,
              const char *option,
              const char *value)
 {
-  (void) cls;
   (void) section;
-  fprintf (stdout,
-          "%s = %s\n",
-          option,
-          value);
+  const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
+  char *value_fn;
+  if (is_filename)
+  {
+    GNUNET_assert (GNUNET_OK ==
+        GNUNET_CONFIGURATION_get_value_filename (cfg,
+                                                 section,
+                                                 option,
+                                                 &value_fn));
+    fprintf (stdout,
+       "%s = %s\n",
+       option,
+       GNUNET_STRINGS_filename_expand (value_fn));
+  }
+  else
+  {
+    fprintf (stdout,
+       "%s = %s\n",
+       option,
+       value);
+  }
 }
 
 
@@ -156,8 +172,8 @@ run (void *cls,
     {
       GNUNET_CONFIGURATION_iterate_section_values (cfg,
                                                    section,
-                                                  &print_option,
-                                                   NULL);
+                                                  &print_option,
+                                                   (void *) cfg);
     }
     else
     {