[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r26935 - in gnunet/src: include util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r26935 - in gnunet/src: include util |
Date: |
Thu, 18 Apr 2013 16:48:42 +0200 |
Author: bartpolot
Date: 2013-04-18 16:48:42 +0200 (Thu, 18 Apr 2013)
New Revision: 26935
Modified:
gnunet/src/include/gnunet_getopt_lib.h
gnunet/src/util/getopt_helpers.c
Log:
Add filename getopt operator
Modified: gnunet/src/include/gnunet_getopt_lib.h
===================================================================
--- gnunet/src/include/gnunet_getopt_lib.h 2013-04-18 13:34:15 UTC (rev
26934)
+++ gnunet/src/include/gnunet_getopt_lib.h 2013-04-18 14:48:42 UTC (rev
26935)
@@ -304,7 +304,26 @@
GNUNET_GETOPT_set_string (struct GNUNET_GETOPT_CommandLineProcessorContext
*ctx,
void *scls, const char *option, const char *value);
+
/**
+ * Set an option of type 'char *' from the command line doing fs expansion.
+ * A pointer to this function should be passed as part of the
+ * 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options
+ * of this type. It should be followed by a pointer to a value of
+ * type 'char *', which will be allocated with the requested string.
+ *
+ * @param ctx command line processing context
+ * @param scls additional closure (will point to the 'char *',
+ * which will be allocated)
+ * @param option name of the option
+ * @param value actual value of the option (a string)
+ * @return GNUNET_OK
+ */
+int
+GNUNET_GETOPT_set_filename (struct GNUNET_GETOPT_CommandLineProcessorContext
*ctx,
+ void *scls, const char *option, const char *value);
+
+/**
* Set an option of type 'unsigned int' from the command line. Each
* time the option flag is given, the value is incremented by one.
* A pointer to this function should be passed as part of the
Modified: gnunet/src/util/getopt_helpers.c
===================================================================
--- gnunet/src/util/getopt_helpers.c 2013-04-18 13:34:15 UTC (rev 26934)
+++ gnunet/src/util/getopt_helpers.c 2013-04-18 14:48:42 UTC (rev 26935)
@@ -234,6 +234,18 @@
}
+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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r26935 - in gnunet/src: include util,
gnunet <=