GNUnet  0.11.x
getopt_helpers.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2006, 2011, 2020 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
26 #include "platform.h"
27 #include "gnunet_util_lib.h"
28 
29 #define LOG(kind, ...) GNUNET_log_from (kind, "util-getopt", __VA_ARGS__)
30 
31 
41 static int
43  void *scls,
44  const char *option,
45  const char *value)
46 {
47  const char *version = scls;
48 
49  (void) option;
50  (void) value;
51  printf ("%s v%s\n", ctx->binaryName, version);
52  return GNUNET_NO;
53 }
54 
55 
63 GNUNET_GETOPT_option_version (const char *version)
64 {
65  struct GNUNET_GETOPT_CommandLineOption clo = {
66  .shortName = 'v',
67  .name = "version",
68  .description = gettext_noop (
69  "print the version number"),
70  .option_exclusive = 1,
71  .processor = &print_version,
72  .scls = (void *) version
73  };
74 
75  return clo;
76 }
77 
78 
82 #define BORDER 29
83 
93 static int
95  void *scls,
96  const char *option,
97  const char *value)
98 {
99  const char *about = scls;
100  size_t slen;
101  unsigned int i;
102  int j;
103  size_t ml;
104  size_t p;
105  char *scp;
106  const char *trans;
107  const struct GNUNET_GETOPT_CommandLineOption *opt;
108  const struct GNUNET_OS_ProjectData *pd;
109 
110  (void) option;
111  (void) value;
112  if (NULL != about)
113  {
114  printf ("%s\n%s\n", ctx->binaryOptions, gettext (about));
115  printf (_ (
116  "Arguments mandatory for long options are also mandatory for short options.\n"));
117  }
118  i = 0;
119  opt = ctx->allOptions;
120  while (NULL != opt[i].description)
121  {
122  if (opt[i].shortName == '\0')
123  printf (" ");
124  else
125  printf (" -%c, ", opt[i].shortName);
126  printf ("--%s", opt[i].name);
127  slen = 8 + strlen (opt[i].name);
128  if (NULL != opt[i].argumentHelp)
129  {
130  printf ("=%s", opt[i].argumentHelp);
131  slen += 1 + strlen (opt[i].argumentHelp);
132  }
133  if (slen > BORDER)
134  {
135  printf ("\n%*s", BORDER, "");
136  slen = BORDER;
137  }
138  if (slen < BORDER)
139  {
140  printf ("%*s", (int) (BORDER - slen), "");
141  slen = BORDER;
142  }
143  if (0 < strlen (opt[i].description))
144  trans = gettext (opt[i].description);
145  else
146  trans = "";
147  ml = strlen (trans);
148  p = 0;
149 OUTER:
150  while (ml - p > 78 - slen)
151  {
152  for (j = p + 78 - slen; j > (int) p; j--)
153  {
154  if (isspace ((unsigned char) trans[j]))
155  {
156  scp = GNUNET_malloc (j - p + 1);
157  GNUNET_memcpy (scp, &trans[p], j - p);
158  scp[j - p] = '\0';
159  printf ("%s\n%*s", scp, BORDER + 2, "");
160  GNUNET_free (scp);
161  p = j + 1;
162  slen = BORDER + 2;
163  goto OUTER;
164  }
165  }
166  /* could not find space to break line */
167  scp = GNUNET_malloc (78 - slen + 1);
168  GNUNET_memcpy (scp, &trans[p], 78 - slen);
169  scp[78 - slen] = '\0';
170  printf ("%s\n%*s", scp, BORDER + 2, "");
171  GNUNET_free (scp);
172  slen = BORDER + 2;
173  p = p + 78 - slen;
174  }
175  /* print rest */
176  if (p < ml)
177  printf ("%s\n", &trans[p]);
178  if (strlen (trans) == 0)
179  printf ("\n");
180  i++;
181  }
183  printf ("Report bugs to %s.\n"
184  "Home page: %s\n",
185  pd->bug_email,
186  pd->homepage);
187 
188  if (0 != pd->is_gnu)
189  printf ("General help using GNU software: http://www.gnu.org/gethelp/\n");
190 
191  return GNUNET_NO;
192 }
193 
194 
202 GNUNET_GETOPT_option_help (const char *about)
203 {
204  struct GNUNET_GETOPT_CommandLineOption clo = {
205  .shortName = 'h',
206  .name = "help",
207  .description = gettext_noop (
208  "print this help"),
209  .option_exclusive = 1,
210  .processor = format_help,
211  .scls = (void *) about
212  };
213 
214  return clo;
215 }
216 
217 
232 static int
234  void *scls,
235  const char *option,
236  const char *value)
237 {
238  unsigned int *val = scls;
239 
240  (void) ctx;
241  (void) option;
242  (void) value;
243  (*val)++;
244  return GNUNET_OK;
245 }
246 
247 
259  const char *name,
260  const char *description,
261  unsigned int *val)
262 {
263  struct GNUNET_GETOPT_CommandLineOption clo = {
264  .shortName = shortName,
265  .name = name,
266  .description = description,
267  .processor = &increment_value,
268  .scls = (void *) val
269  };
270 
271  return clo;
272 }
273 
274 
282 GNUNET_GETOPT_option_verbose (unsigned int *level)
283 {
284  struct GNUNET_GETOPT_CommandLineOption clo = {
285  .shortName = 'V',
286  .name = "verbose",
287  .description =
288  gettext_noop ("be verbose"),
289  .processor = &increment_value,
290  .scls = (void *) level
291  };
292 
293  return clo;
294 }
295 
296 
311 static int
313  void *scls,
314  const char *option,
315  const char *value)
316 {
317  int *val = scls;
318 
319  (void) ctx;
320  (void) option;
321  (void) value;
322  *val = 1;
323  return GNUNET_OK;
324 }
325 
326 
339  const char *name,
340  const char *description,
341  int *val)
342 {
343  struct GNUNET_GETOPT_CommandLineOption clo = {
344  .shortName = shortName,
345  .name = name,
346  .description = description,
347  .processor = &set_one,
348  .scls = (void *) val
349  };
350 
351  return clo;
352 }
353 
354 
369 static int
371  void *scls,
372  const char *option,
373  const char *value)
374 {
375  char **val = scls;
376 
377  (void) ctx;
378  (void) option;
379  GNUNET_assert (NULL != value);
380  GNUNET_free (*val);
381  *val = GNUNET_strdup (value);
382  return GNUNET_OK;
383 }
384 
385 
397  const char *name,
398  const char *argumentHelp,
399  const char *description,
400  char **str)
401 {
402  struct GNUNET_GETOPT_CommandLineOption clo = {
403  .shortName = shortName,
404  .name = name,
405  .argumentHelp = argumentHelp,
406  .description = description,
407  .require_argument = 1,
408  .processor = &set_string,
409  .scls = (void *) str
410  };
411 
412  return clo;
413 }
414 
415 
424 {
425  struct GNUNET_GETOPT_CommandLineOption clo = {
426  .shortName = 'L',
427  .name = "log",
428  .argumentHelp = "LOGLEVEL",
429  .description = gettext_noop ("configure logging to use LOGLEVEL"),
430  .require_argument = 1,
431  .processor = &set_string,
432  .scls = (void *) level
433  };
434 
435  return clo;
436 }
437 
438 
450 static int
452  void *scls,
453  const char *option,
454  const char *value)
455 {
456  char **val = scls;
457 
458  (void) ctx;
459  (void) option;
460  GNUNET_assert (NULL != value);
461  GNUNET_free (*val);
462  *val = GNUNET_STRINGS_filename_expand (value);
463  return GNUNET_OK;
464 }
465 
466 
478  const char *name,
479  const char *argumentHelp,
480  const char *description,
481  char **str)
482 {
483  struct GNUNET_GETOPT_CommandLineOption clo = {
484  .shortName = shortName,
485  .name = name,
486  .argumentHelp = argumentHelp,
487  .description = description,
488  .require_argument = 1,
489  .processor = &set_filename,
490  .scls = (void *) str
491  };
492 
493  return clo;
494 }
495 
496 
504 {
505  struct GNUNET_GETOPT_CommandLineOption clo = {
506  .shortName = 'l',
507  .name = "logfile",
508  .argumentHelp = "FILENAME",
509  .description =
510  gettext_noop ("configure logging to write logs to FILENAME"),
511  .require_argument = 1,
512  .processor = &set_filename,
513  .scls = (void *) logfn
514  };
515 
516  return clo;
517 }
518 
519 
527 {
528  struct GNUNET_GETOPT_CommandLineOption clo = {
529  .shortName = 'c',
530  .name = "config",
531  .argumentHelp = "FILENAME",
532  .description = gettext_noop ("use configuration file FILENAME"),
533  .require_argument = 1,
534  .processor = &set_filename,
535  .scls = (void *) fn
536  };
537 
538  return clo;
539 }
540 
541 
555 static int
557  void *scls,
558  const char *option,
559  const char *value)
560 {
561  unsigned long long *val = scls;
562  char dummy[2];
563 
564  (void) ctx;
565  if (1 != sscanf (value, "%llu%1s", val, dummy))
566  {
567  fprintf (stderr,
568  _ ("You must pass a number to the `%s' option.\n"),
569  option);
570  return GNUNET_SYSERR;
571  }
572  return GNUNET_OK;
573 }
574 
575 
587  const char *name,
588  const char *argumentHelp,
589  const char *description,
590  unsigned long long *val)
591 {
592  struct GNUNET_GETOPT_CommandLineOption clo = {
593  .shortName = shortName,
594  .name = name,
595  .argumentHelp = argumentHelp,
596  .description = description,
597  .require_argument = 1,
598  .processor = &set_ulong,
599  .scls = (void *) val
600  };
601 
602  return clo;
603 }
604 
605 
619 static int
621  void *scls,
622  const char *option,
623  const char *value)
624 {
625  long long delta;
626  long long minus;
627  struct GNUNET_TIME_Relative rt;
628 
629  (void) scls;
630  (void) ctx;
631  while (isspace (value[0]))
632  value++;
633  minus = 1;
634  if (value[0] == '-')
635  {
636  minus = -1;
637  value++;
638  }
639  else if (value[0] == '+')
640  {
641  value++;
642  }
643  if (GNUNET_OK !=
645  &rt))
646  {
647  fprintf (stderr,
648  _ (
649  "You must pass a relative time (optionally with sign) to the `%s' option.\n"),
650  option);
651  return GNUNET_SYSERR;
652  }
653  if (rt.rel_value_us > LLONG_MAX)
654  {
655  fprintf (stderr,
656  _ ("Value given for time travel `%s' option is too big.\n"),
657  option);
658  return GNUNET_SYSERR;
659  }
660  delta = (long long) rt.rel_value_us;
661  delta *= minus;
662  GNUNET_TIME_set_offset (delta);
663  return GNUNET_OK;
664 }
665 
666 
678  const char *name)
679 {
680  struct GNUNET_GETOPT_CommandLineOption clo = {
681  .shortName = shortName,
682  .name = name,
683  .argumentHelp = _ ("[+/-]MICROSECONDS"),
684  .description = _ (
685  "modify system time by given offset (for debugging/testing only)"),
686  .require_argument = 1,
687  .processor =
689  };
690 
691  return clo;
692 }
693 
694 
708 static int
710  void *scls,
711  const char *option,
712  const char *value)
713 {
714  struct GNUNET_TIME_Relative *val = scls;
715 
716  (void) ctx;
718  {
719  fprintf (stderr,
720  _ ("You must pass relative time to the `%s' option.\n"),
721  option);
722  return GNUNET_SYSERR;
723  }
724  return GNUNET_OK;
725 }
726 
727 
740  const char *name,
741  const char *argumentHelp,
742  const char *description,
743  struct GNUNET_TIME_Relative *val)
744 {
745  struct GNUNET_GETOPT_CommandLineOption clo = {
746  .shortName = shortName,
747  .name = name,
748  .argumentHelp = argumentHelp,
749  .description = description,
750  .require_argument = 1,
751  .processor =
753  .scls = (void *) val
754  };
755 
756  return clo;
757 }
758 
759 
773 static int
775  void *scls,
776  const char *option,
777  const char *value)
778 {
779  struct GNUNET_TIME_Absolute *val = scls;
780 
781  (void) ctx;
783  {
784  fprintf (stderr,
785  _ ("You must pass absolute time to the `%s' option.\n"),
786  option);
787  return GNUNET_SYSERR;
788  }
789  return GNUNET_OK;
790 }
791 
792 
805  const char *name,
806  const char *argumentHelp,
807  const char *description,
808  struct GNUNET_TIME_Absolute *val)
809 {
810  struct GNUNET_GETOPT_CommandLineOption clo = {
811  .shortName = shortName,
812  .name = name,
813  .argumentHelp = argumentHelp,
814  .description = description,
815  .require_argument = 1,
816  .processor =
818  .scls = (void *) val
819  };
820 
821  return clo;
822 }
823 
824 
838 static int
840  void *scls,
841  const char *option,
842  const char *value)
843 {
844  unsigned int *val = scls;
845  char dummy[2];
846 
847  (void) ctx;
848  if ('-' == *value)
849  {
850  fprintf (stderr,
851  _ (
852  "Your input for the '%s' option has to be a non negative number\n"),
853  option);
854  return GNUNET_SYSERR;
855  }
856  if (1 != sscanf (value, "%u%1s", val, dummy))
857  {
858  fprintf (stderr,
859  _ ("You must pass a number to the `%s' option.\n"),
860  option);
861  return GNUNET_SYSERR;
862  }
863  return GNUNET_OK;
864 }
865 
866 
878  const char *name,
879  const char *argumentHelp,
880  const char *description,
881  unsigned int *val)
882 {
883  struct GNUNET_GETOPT_CommandLineOption clo = {
884  .shortName = shortName,
885  .name = name,
886  .argumentHelp = argumentHelp,
887  .description = description,
888  .require_argument = 1,
889  .processor = &set_uint,
890  .scls = (void *) val
891  };
892 
893  return clo;
894 }
895 
896 
910 static int
912  void *scls,
913  const char *option,
914  const char *value)
915 {
916  uint16_t *val = scls;
917  unsigned int v;
918  char dummy[2];
919 
920  (void) ctx;
921  if (1 != sscanf (value, "%u%1s", &v, dummy))
922  {
923  fprintf (stderr,
924  _ ("You must pass a number to the `%s' option.\n"),
925  option);
926  return GNUNET_SYSERR;
927  }
928  if (v > UINT16_MAX)
929  {
930  fprintf (stderr,
931  _ ("You must pass a number below %u to the `%s' option.\n"),
932  (unsigned int) UINT16_MAX,
933  option);
934  return GNUNET_SYSERR;
935  }
936  *val = (uint16_t) v;
937  return GNUNET_OK;
938 }
939 
940 
952  const char *name,
953  const char *argumentHelp,
954  const char *description,
955  uint16_t *val)
956 {
957  struct GNUNET_GETOPT_CommandLineOption clo = {
958  .shortName = shortName,
959  .name = name,
960  .argumentHelp = argumentHelp,
961  .description = description,
962  .require_argument = 1,
963  .processor = &set_uint16,
964  .scls = (void *) val
965  };
966 
967  return clo;
968 }
969 
970 
975 {
979  void *val;
980 
984  size_t val_size;
985 };
986 
987 
1001 static int
1003  void *scls,
1004  const char *option,
1005  const char *value)
1006 {
1007  struct Base32Context *bc = scls;
1008 
1009  (void) ctx;
1011  strlen (value),
1012  bc->val,
1013  bc->val_size))
1014  {
1015  fprintf (
1016  stderr,
1017  _ (
1018  "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n"),
1019  option);
1020  return GNUNET_SYSERR;
1021  }
1022  return GNUNET_OK;
1023 }
1024 
1025 
1032 static void
1033 free_bc (void *cls)
1034 {
1035  GNUNET_free (cls);
1036 }
1037 
1038 
1052  const char *name,
1053  const char *argumentHelp,
1054  const char *description,
1055  void *val,
1056  size_t val_size)
1057 {
1058  struct Base32Context *bc = GNUNET_new (struct Base32Context);
1059  struct GNUNET_GETOPT_CommandLineOption clo = {
1060  .shortName = shortName,
1061  .name = name,
1062  .argumentHelp = argumentHelp,
1063  .description = description,
1064  .require_argument = 1,
1065  .processor = &set_base32,
1066  .cleaner = &free_bc,
1067  .scls = (void *) bc
1068  };
1069 
1070  bc->val = val;
1071  bc->val_size = val_size;
1072  return clo;
1073 }
1074 
1075 
1084 {
1085  opt.option_mandatory = 1;
1086  return opt;
1087 }
1088 
1089 
1098 {
1099  opt.option_exclusive = 1;
1100  return opt;
1101 }
1102 
1103 
1104 /* end of getopt_helpers.c */
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_relative_time(char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_TIME_Relative *val)
Allow user to specify a struct GNUNET_TIME_Relative (using human-readable "fancy" time)...
static int set_absolute_time(struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value)
Set an option of type &#39;struct GNUNET_TIME_Absolute&#39; from the command line.
General context for command line processors.
static int increment_value(struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value)
Set an option of type &#39;unsigned int&#39; from the command line.
static int print_version(struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value)
Print out program version (implements –version).
static int set_relative_time(struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value)
Set an option of type &#39;struct GNUNET_TIME_Relative&#39; from the command line.
static int set_timetravel_time(struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value)
Set an option of type &#39;struct GNUNET_TIME_Relative&#39; from the command line.
Project-specific data used to help the OS subsystem find installation paths.
const char * argumentHelp
Name of the argument for the user in help text.
uint64_t rel_value_us
The actual value.
static struct GNUNET_TIME_Relative delta
Definition: speedup.c:35
void * scls
Specific closure to pass to the processor.
static int set_one(struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value)
Set an option of type &#39;int&#39; from the command line to 1 if the given option is present.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_help(const char *about)
Defining the option to print the command line help text (-h option).
static int format_help(struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value)
Print out details on command line options (implements –help).
const char * binaryName
Name of the application.
const char * description
Help text for the option (description)
static int set_string(struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value)
Set an option of type &#39;char *&#39; from the command line.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_verbose(unsigned int *level)
Define the &#39;-V&#39; verbosity option.
#define gettext(Msgid)
Definition: gettext.h:45
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_increment_uint(char shortName, const char *name, const char *description, unsigned int *val)
Increment val each time the option flag is given by one.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
int GNUNET_STRINGS_fancy_time_to_relative(const char *fancy_time, struct GNUNET_TIME_Relative *rtime)
Convert a given fancy human-readable time to our internal representation.
Definition: strings.c:356
const struct GNUNET_GETOPT_CommandLineOption * allOptions
Array with all command line options.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
int GNUNET_STRINGS_fancy_time_to_absolute(const char *fancy_time, struct GNUNET_TIME_Absolute *atime)
Convert a given fancy human-readable time to our internal representation.
Definition: strings.c:407
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_base32_fixed_size(char shortName, const char *name, const char *argumentHelp, const char *description, void *val, size_t val_size)
Allow user to specify a binary value using Crockford Base32 encoding.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Definition of a command line option.
void GNUNET_TIME_set_offset(long long offset)
Set the timestamp offset for this instance.
Definition: time.c:53
Closure for set_base32().
const char shortName
Short name of the option.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_logfile(char **logfn)
Allow user to specify log file name (-l option)
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_string(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a string.
#define _(String)
GNU gettext support macro.
Definition: platform.h:184
int is_gnu
Non-zero means this project is part of GNU.
const char * bug_email
E-mail address for reporting bugs.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_version(const char *version)
Define the option to print the version of the application (-v option)
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_filename(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a filename (automatically path expanded).
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
static char * value
Value of the record to add/remove.
static char * fn
Filename of the unique file.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_absolute_time(char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_TIME_Absolute *val)
Allow user to specify a struct GNUNET_TIME_Absolute (using human-readable "fancy" time)...
int option_exclusive
Is the option exclusive?
#define BORDER
At what offset does the help text start?
static char * option
Name of the option.
Definition: gnunet-config.c:38
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_loglevel(char **level)
Define the &#39;-L&#39; log level option.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_mandatory(struct GNUNET_GETOPT_CommandLineOption opt)
Make the given option mandatory.
static void free_bc(void *cls)
Helper function to clean up after GNUNET_GETOPT_option_base32_fixed_size.
static int set_uint16(struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value)
Set an option of type &#39;uint16_t&#39; from the command line.
size_t val_size
Number of bytes expected for val.
static int set_base32(struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value)
Set an option of type &#39;unsigned int&#39; from the command line.
static int set_filename(struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value)
Set an option of type &#39;char *&#39; from the command line with filename expansion a la GNUNET_STRINGS_file...
char * GNUNET_STRINGS_filename_expand(const char *fil)
Complete filename (a la shell) from abbrevition.
Definition: strings.c:618
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_ulong(char shortName, const char *name, const char *argumentHelp, const char *description, unsigned long long *val)
Allow user to specify an unsigned long long
void * val
Value to initialize (already allocated)
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_cfgfile(char **fn)
Allow user to specify configuration file name (-c option)
static struct in_addr dummy
Target "dummy" address of the packet we pretend to respond to.
const char * homepage
Project homepage.
const char * binaryOptions
Name of application with option summary.
static int set_uint(struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value)
Set an option of type &#39;unsigned int&#39; from the command line.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_exclusive(struct GNUNET_GETOPT_CommandLineOption opt)
Make the given option mutually exclusive with other options.
const char * name
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_timetravel(char shortName, const char *name)
Allow user to specify a long long with an offset to add to the current system time to construct the t...
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_get(void)
Time for absolute times used by GNUnet, in microseconds.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_uint(char shortName, const char *name, const char *argumentHelp, const char *description, unsigned int *val)
Allow user to specify an unsigned integer.
#define GNUNET_malloc(size)
Wrapper around malloc.
int GNUNET_STRINGS_string_to_data(const char *enc, size_t enclen, void *out, size_t out_size)
Convert CrockfordBase32 encoding back to data.
Definition: strings.c:972
static int set_ulong(struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value)
Set an option of type &#39;unsigned long long&#39; from the command line.
#define GNUNET_free(ptr)
Wrapper around free.
Time for relative time used by GNUnet, in microseconds.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_uint16(char shortName, const char *name, const char *argumentHelp, const char *description, uint16_t *val)
Allow user to specify an uint16_t.
#define gettext_noop(String)
Definition: gettext.h:69
int option_mandatory
Is the presence of this option mandatory?