[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: add flag for exlusive optio
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: add flag for exlusive options as program agruments |
Date: |
Sat, 22 Jun 2019 22:58:03 +0200 |
This is an automated email from the git hooks/post-receive script.
xrs pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new d6c25f604 add flag for exlusive options as program agruments
new ea20a6946 Merge branch 'master' of ssh://git.gnunet.org/gnunet
d6c25f604 is described below
commit d6c25f60406596d84900aa6ac012bf8ce111d57c
Author: xrs <address@hidden>
AuthorDate: Sat Jun 22 22:57:55 2019 +0200
add flag for exlusive options as program agruments
---
src/include/gnunet_getopt_lib.h | 7 ++++++-
src/util/getopt.c | 12 +++++++++++-
src/util/getopt_helpers.c | 1 +
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/include/gnunet_getopt_lib.h b/src/include/gnunet_getopt_lib.h
index ddeeffef4..17e36d889 100644
--- a/src/include/gnunet_getopt_lib.h
+++ b/src/include/gnunet_getopt_lib.h
@@ -135,6 +135,11 @@ struct GNUNET_GETOPT_CommandLineOption
*/
int option_mandatory;
+ /**
+ * Is the option exclusive?
+ */
+ int option_exclusive;
+
/**
* Handler for the option.
*/
@@ -424,7 +429,7 @@ GNUNET_GETOPT_option_mandatory (struct
GNUNET_GETOPT_CommandLineOption opt);
* Marker for the end of the list of options.
*/
#define GNUNET_GETOPT_OPTION_END \
- { '\0', NULL, NULL, NULL, 0, 0, NULL, NULL, NULL }
+ { '\0', NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL }
/**
diff --git a/src/util/getopt.c b/src/util/getopt.c
index 5e8571ee5..44f6dcda2 100644
--- a/src/util/getopt.c
+++ b/src/util/getopt.c
@@ -954,7 +954,16 @@ GNUNET_GETOPT_run (const char *binaryOptions,
if (GNUNET_YES == cont)
{
- for (count = 0; NULL != allOptions[count].name; count++)
+ for (count = 0; NULL != allOptions[count].name; count++)
+ {
+ if (allOptions[count].option_exclusive)
+ {
+ FPRINTF (stderr,
+ _("Option `%s' can't be used with other options.\n"),
+ allOptions[count].name);
+ cont = GNUNET_SYSERR;
+ }
+
if ( (0 == seen[count]) &&
(allOptions[count].option_mandatory) )
{
@@ -963,6 +972,7 @@ GNUNET_GETOPT_run (const char *binaryOptions,
allOptions[count].name);
cont = GNUNET_SYSERR;
}
+ }
}
GNUNET_free (seen);
diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c
index 77032e501..d6ba85733 100644
--- a/src/util/getopt_helpers.c
+++ b/src/util/getopt_helpers.c
@@ -68,6 +68,7 @@ GNUNET_GETOPT_option_version (const char *version)
.shortName = 'v',
.name = "version",
.description = gettext_noop("print the version number"),
+ .option_exclusive = 1,
.processor = &print_version,
.scls = (void *) version
};
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: add flag for exlusive options as program agruments,
gnunet <=