gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r24098 - in gnunet/src: include util


From: gnunet
Subject: [GNUnet-SVN] r24098 - in gnunet/src: include util
Date: Fri, 28 Sep 2012 14:36:36 +0200

Author: bartpolot
Date: 2012-09-28 14:36:36 +0200 (Fri, 28 Sep 2012)
New Revision: 24098

Modified:
   gnunet/src/include/gnunet_getopt_lib.h
   gnunet/src/util/getopt.c
   gnunet/src/util/getopt_helpers.c
   gnunet/src/util/service.c
   gnunet/src/util/test_getopt.c
Log:
Passing -v or -h options to a command no longer returns error code

Modified: gnunet/src/include/gnunet_getopt_lib.h
===================================================================
--- gnunet/src/include/gnunet_getopt_lib.h      2012-09-28 12:31:30 UTC (rev 
24097)
+++ gnunet/src/include/gnunet_getopt_lib.h      2012-09-28 12:36:36 UTC (rev 
24098)
@@ -333,7 +333,7 @@
  * @param scls additional closure (points to about text)
  * @param option name of the option
  * @param value not used (NULL)
- * @return GNUNET_SYSERR (do not continue)
+ * @return GNUNET_NO (do not continue, not an error)
  */
 int
 GNUNET_GETOPT_format_help_ (struct GNUNET_GETOPT_CommandLineProcessorContext
@@ -347,7 +347,7 @@
  * @param scls additional closure (points to version string)
  * @param option name of the option
  * @param value not used (NULL)
- * @return GNUNET_SYSERR (do not continue)
+ * @return GNUNET_NO (do not continue, not an error)
  */
 int
 GNUNET_GETOPT_print_version_ (struct GNUNET_GETOPT_CommandLineProcessorContext

Modified: gnunet/src/util/getopt.c
===================================================================
--- gnunet/src/util/getopt.c    2012-09-28 12:31:30 UTC (rev 24097)
+++ gnunet/src/util/getopt.c    2012-09-28 12:36:36 UTC (rev 24098)
@@ -939,8 +939,8 @@
 
   GNUNET_free (shorts);
   GNUNET_free (long_options);
-  if (cont == GNUNET_SYSERR)
-    return GNUNET_SYSERR;
+  if (cont != GNUNET_OK)
+    return cont;
   return GNoptind;
 }
 

Modified: gnunet/src/util/getopt_helpers.c
===================================================================
--- gnunet/src/util/getopt_helpers.c    2012-09-28 12:31:30 UTC (rev 24097)
+++ gnunet/src/util/getopt_helpers.c    2012-09-28 12:36:36 UTC (rev 24098)
@@ -38,7 +38,7 @@
  * @param scls additional closure (points to version string)
  * @param option name of the option
  * @param value not used (NULL)
- * @return GNUNET_SYSERR (do not continue)
+ * @return GNUNET_NO (do not continue, not an error)
  */
 int
 GNUNET_GETOPT_print_version_ (struct GNUNET_GETOPT_CommandLineProcessorContext
@@ -48,7 +48,7 @@
   const char *version = scls;
 
   printf ("%s v%s\n", ctx->binaryName, version);
-  return GNUNET_SYSERR;
+  return GNUNET_NO;
 }
 
 
@@ -62,7 +62,7 @@
  * @param scls additional closure (points to about text)
  * @param option name of the option
  * @param value not used (NULL)
- * @return GNUNET_SYSERR (do not continue)
+ * @return GNUNET_NO (do not continue, not an error)
  */
 int
 GNUNET_GETOPT_format_help_ (struct GNUNET_GETOPT_CommandLineProcessorContext
@@ -152,7 +152,7 @@
   printf ("Report bugs to address@hidden"
           "GNUnet home page: http://www.gnu.org/software/gnunet/\n";
           "General help using GNU software: http://www.gnu.org/gethelp/\n";);
-  return GNUNET_SYSERR;
+  return GNUNET_NO;
 }
 
 

Modified: gnunet/src/util/service.c
===================================================================
--- gnunet/src/util/service.c   2012-09-28 12:31:30 UTC (rev 24097)
+++ gnunet/src/util/service.c   2012-09-28 12:36:36 UTC (rev 24098)
@@ -1729,6 +1729,7 @@
 #define HANDLE_ERROR do { GNUNET_break (0); goto shutdown; } while (0)
 
   int err;
+  int ret;
   char *cfg_fn;
   char *loglev;
   char *logfile;
@@ -1765,10 +1766,16 @@
   sctx.task_cls = task_cls;
   sctx.service_name = service_name;
   sctx.cfg = cfg = GNUNET_CONFIGURATION_create ();
+
   /* setup subsystems */
-  if (GNUNET_SYSERR ==
-      GNUNET_GETOPT_run (service_name, service_options, argc, argv))
+  ret = GNUNET_GETOPT_run (service_name, service_options, argc, argv);
+  if (GNUNET_SYSERR == ret)
     goto shutdown;
+  if (GNUNET_NO == ret)
+  {
+    err = 0;
+    goto shutdown;
+  }
   if (GNUNET_OK != GNUNET_log_setup (service_name, loglev, logfile))
     HANDLE_ERROR;
   if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cfg_fn))

Modified: gnunet/src/util/test_getopt.c
===================================================================
--- gnunet/src/util/test_getopt.c       2012-09-28 12:31:30 UTC (rev 24097)
+++ gnunet/src/util/test_getopt.c       2012-09-28 12:36:36 UTC (rev 24098)
@@ -89,7 +89,7 @@
     GNUNET_GETOPT_OPTION_END
   };
 
-  if (-1 != GNUNET_GETOPT_run ("test_getopt", versionoptionlist, 2, myargv))
+  if (0 != GNUNET_GETOPT_run ("test_getopt", versionoptionlist, 2, myargv))
   {
     GNUNET_break (0);
     return 1;
@@ -111,7 +111,7 @@
     GNUNET_GETOPT_OPTION_END
   };
 
-  if (-1 != GNUNET_GETOPT_run ("test_getopt", aboutoptionlist, 2, myargv))
+  if (0 != GNUNET_GETOPT_run ("test_getopt", aboutoptionlist, 2, myargv))
   {
     GNUNET_break (0);
     return 1;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]