diff options
Diffstat (limited to 'src/util/gnunet-config.c')
-rw-r--r-- | src/util/gnunet-config.c | 57 |
1 files changed, 40 insertions, 17 deletions
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 5f7d9fc0d..4528bbe24 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2012 GNUnet e.V. | 3 | Copyright (C) 2012 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
@@ -77,12 +75,37 @@ print_option (void *cls, | |||
77 | const char *option, | 75 | const char *option, |
78 | const char *value) | 76 | const char *value) |
79 | { | 77 | { |
80 | (void) cls; | 78 | const struct GNUNET_CONFIGURATION_Handle *cfg = cls; |
79 | |||
81 | (void) section; | 80 | (void) section; |
82 | fprintf (stdout, | 81 | if (is_filename) |
83 | "%s = %s\n", | 82 | { |
84 | option, | 83 | char *value_fn; |
85 | value); | 84 | char *fn; |
85 | |||
86 | GNUNET_assert (GNUNET_OK == | ||
87 | GNUNET_CONFIGURATION_get_value_filename (cfg, | ||
88 | section, | ||
89 | option, | ||
90 | &value_fn)); | ||
91 | fn = GNUNET_STRINGS_filename_expand (value_fn); | ||
92 | if (NULL == fn) | ||
93 | fn = value_fn; | ||
94 | else | ||
95 | GNUNET_free (value_fn); | ||
96 | fprintf (stdout, | ||
97 | "%s = %s\n", | ||
98 | option, | ||
99 | fn); | ||
100 | GNUNET_free (fn); | ||
101 | } | ||
102 | else | ||
103 | { | ||
104 | fprintf (stdout, | ||
105 | "%s = %s\n", | ||
106 | option, | ||
107 | value); | ||
108 | } | ||
86 | } | 109 | } |
87 | 110 | ||
88 | 111 | ||
@@ -161,8 +184,8 @@ run (void *cls, | |||
161 | { | 184 | { |
162 | GNUNET_CONFIGURATION_iterate_section_values (cfg, | 185 | GNUNET_CONFIGURATION_iterate_section_values (cfg, |
163 | section, | 186 | section, |
164 | &print_option, | 187 | &print_option, |
165 | NULL); | 188 | (void *) cfg); |
166 | } | 189 | } |
167 | else | 190 | else |
168 | { | 191 | { |