- Allocate buffer large enough to contain UNIX_PATH_MAX size pathnames in case of...
[oweals/gnunet.git] / src / util / getopt_helpers.c
index 5940c3ff970ea299e740761df0e6bc19b2dbac0d..798ced005de295068818aaee56b3ef4d290e485f 100644 (file)
@@ -4,7 +4,7 @@
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
+     by the Free Software Foundation; either version 3, or (at your
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
@@ -23,9 +23,7 @@
  * @brief implements command line that sets option
  * @author Christian Grothoff
  */
-
 #include "platform.h"
-#include "gnunet_common.h"
 #include "gnunet_util_lib.h"
 
 #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
@@ -234,6 +232,18 @@ GNUNET_GETOPT_set_string (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
 }
 
 
+int
+GNUNET_GETOPT_set_filename (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
+                            void *scls, const char *option, const char *value)
+{
+  char **val = scls;
+
+  GNUNET_assert (value != NULL);
+  GNUNET_free_non_null (*val);
+  *val = GNUNET_STRINGS_filename_expand (value);
+  return GNUNET_OK;
+}
+
 /**
  * Set an option of type 'unsigned long long' from the command line.
  * A pointer to this function should be passed as part of the