diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-09-28 12:36:36 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-09-28 12:36:36 +0000 |
commit | 18950c7644481d5ea1a3789d8fc394404eca591d (patch) | |
tree | 145bf85cc054c8983f2dc35440caa7e4dee66bfe /src/util | |
parent | 15e0bcb27f2d9eede1f4ae2ce80bc87f2bca6c65 (diff) | |
download | gnunet-18950c7644481d5ea1a3789d8fc394404eca591d.tar.gz gnunet-18950c7644481d5ea1a3789d8fc394404eca591d.zip |
Passing -v or -h options to a command no longer returns error code
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/getopt.c | 4 | ||||
-rw-r--r-- | src/util/getopt_helpers.c | 8 | ||||
-rw-r--r-- | src/util/service.c | 11 | ||||
-rw-r--r-- | src/util/test_getopt.c | 4 |
4 files changed, 17 insertions, 10 deletions
diff --git a/src/util/getopt.c b/src/util/getopt.c index 415bb4b6b..b5dc3031b 100644 --- a/src/util/getopt.c +++ b/src/util/getopt.c | |||
@@ -939,8 +939,8 @@ GNUNET_GETOPT_run (const char *binaryOptions, | |||
939 | 939 | ||
940 | GNUNET_free (shorts); | 940 | GNUNET_free (shorts); |
941 | GNUNET_free (long_options); | 941 | GNUNET_free (long_options); |
942 | if (cont == GNUNET_SYSERR) | 942 | if (cont != GNUNET_OK) |
943 | return GNUNET_SYSERR; | 943 | return cont; |
944 | return GNoptind; | 944 | return GNoptind; |
945 | } | 945 | } |
946 | 946 | ||
diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c index a80bff4a3..1e3b05cb5 100644 --- a/src/util/getopt_helpers.c +++ b/src/util/getopt_helpers.c | |||
@@ -38,7 +38,7 @@ | |||
38 | * @param scls additional closure (points to version string) | 38 | * @param scls additional closure (points to version string) |
39 | * @param option name of the option | 39 | * @param option name of the option |
40 | * @param value not used (NULL) | 40 | * @param value not used (NULL) |
41 | * @return GNUNET_SYSERR (do not continue) | 41 | * @return GNUNET_NO (do not continue, not an error) |
42 | */ | 42 | */ |
43 | int | 43 | int |
44 | GNUNET_GETOPT_print_version_ (struct GNUNET_GETOPT_CommandLineProcessorContext | 44 | GNUNET_GETOPT_print_version_ (struct GNUNET_GETOPT_CommandLineProcessorContext |
@@ -48,7 +48,7 @@ GNUNET_GETOPT_print_version_ (struct GNUNET_GETOPT_CommandLineProcessorContext | |||
48 | const char *version = scls; | 48 | const char *version = scls; |
49 | 49 | ||
50 | printf ("%s v%s\n", ctx->binaryName, version); | 50 | printf ("%s v%s\n", ctx->binaryName, version); |
51 | return GNUNET_SYSERR; | 51 | return GNUNET_NO; |
52 | } | 52 | } |
53 | 53 | ||
54 | 54 | ||
@@ -62,7 +62,7 @@ GNUNET_GETOPT_print_version_ (struct GNUNET_GETOPT_CommandLineProcessorContext | |||
62 | * @param scls additional closure (points to about text) | 62 | * @param scls additional closure (points to about text) |
63 | * @param option name of the option | 63 | * @param option name of the option |
64 | * @param value not used (NULL) | 64 | * @param value not used (NULL) |
65 | * @return GNUNET_SYSERR (do not continue) | 65 | * @return GNUNET_NO (do not continue, not an error) |
66 | */ | 66 | */ |
67 | int | 67 | int |
68 | GNUNET_GETOPT_format_help_ (struct GNUNET_GETOPT_CommandLineProcessorContext | 68 | GNUNET_GETOPT_format_help_ (struct GNUNET_GETOPT_CommandLineProcessorContext |
@@ -152,7 +152,7 @@ OUTER: | |||
152 | printf ("Report bugs to gnunet-developers@gnu.org.\n" | 152 | printf ("Report bugs to gnunet-developers@gnu.org.\n" |
153 | "GNUnet home page: http://www.gnu.org/software/gnunet/\n" | 153 | "GNUnet home page: http://www.gnu.org/software/gnunet/\n" |
154 | "General help using GNU software: http://www.gnu.org/gethelp/\n"); | 154 | "General help using GNU software: http://www.gnu.org/gethelp/\n"); |
155 | return GNUNET_SYSERR; | 155 | return GNUNET_NO; |
156 | } | 156 | } |
157 | 157 | ||
158 | 158 | ||
diff --git a/src/util/service.c b/src/util/service.c index e2d056d7f..67d8583cc 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -1729,6 +1729,7 @@ GNUNET_SERVICE_run (int argc, char *const *argv, const char *service_name, | |||
1729 | #define HANDLE_ERROR do { GNUNET_break (0); goto shutdown; } while (0) | 1729 | #define HANDLE_ERROR do { GNUNET_break (0); goto shutdown; } while (0) |
1730 | 1730 | ||
1731 | int err; | 1731 | int err; |
1732 | int ret; | ||
1732 | char *cfg_fn; | 1733 | char *cfg_fn; |
1733 | char *loglev; | 1734 | char *loglev; |
1734 | char *logfile; | 1735 | char *logfile; |
@@ -1765,10 +1766,16 @@ GNUNET_SERVICE_run (int argc, char *const *argv, const char *service_name, | |||
1765 | sctx.task_cls = task_cls; | 1766 | sctx.task_cls = task_cls; |
1766 | sctx.service_name = service_name; | 1767 | sctx.service_name = service_name; |
1767 | sctx.cfg = cfg = GNUNET_CONFIGURATION_create (); | 1768 | sctx.cfg = cfg = GNUNET_CONFIGURATION_create (); |
1769 | |||
1768 | /* setup subsystems */ | 1770 | /* setup subsystems */ |
1769 | if (GNUNET_SYSERR == | 1771 | ret = GNUNET_GETOPT_run (service_name, service_options, argc, argv); |
1770 | GNUNET_GETOPT_run (service_name, service_options, argc, argv)) | 1772 | if (GNUNET_SYSERR == ret) |
1771 | goto shutdown; | 1773 | goto shutdown; |
1774 | if (GNUNET_NO == ret) | ||
1775 | { | ||
1776 | err = 0; | ||
1777 | goto shutdown; | ||
1778 | } | ||
1772 | if (GNUNET_OK != GNUNET_log_setup (service_name, loglev, logfile)) | 1779 | if (GNUNET_OK != GNUNET_log_setup (service_name, loglev, logfile)) |
1773 | HANDLE_ERROR; | 1780 | HANDLE_ERROR; |
1774 | if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cfg_fn)) | 1781 | if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cfg_fn)) |
diff --git a/src/util/test_getopt.c b/src/util/test_getopt.c index f068a6ab0..65c3b5d2e 100644 --- a/src/util/test_getopt.c +++ b/src/util/test_getopt.c | |||
@@ -89,7 +89,7 @@ testVersion () | |||
89 | GNUNET_GETOPT_OPTION_END | 89 | GNUNET_GETOPT_OPTION_END |
90 | }; | 90 | }; |
91 | 91 | ||
92 | if (-1 != GNUNET_GETOPT_run ("test_getopt", versionoptionlist, 2, myargv)) | 92 | if (0 != GNUNET_GETOPT_run ("test_getopt", versionoptionlist, 2, myargv)) |
93 | { | 93 | { |
94 | GNUNET_break (0); | 94 | GNUNET_break (0); |
95 | return 1; | 95 | return 1; |
@@ -111,7 +111,7 @@ testAbout () | |||
111 | GNUNET_GETOPT_OPTION_END | 111 | GNUNET_GETOPT_OPTION_END |
112 | }; | 112 | }; |
113 | 113 | ||
114 | if (-1 != GNUNET_GETOPT_run ("test_getopt", aboutoptionlist, 2, myargv)) | 114 | if (0 != GNUNET_GETOPT_run ("test_getopt", aboutoptionlist, 2, myargv)) |
115 | { | 115 | { |
116 | GNUNET_break (0); | 116 | GNUNET_break (0); |
117 | return 1; | 117 | return 1; |