summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2016-06-16 15:49:34 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2016-06-16 15:49:34 +0200
commit701e3f7750ea58d774651174dc2edeacc64e156f (patch)
tree1a2693dd3d740ed0b22dee6315ac87a4cc529769 /bin
parent453f0efd295332f23a3aadc6f7c29505b6c09167 (diff)
Show version information consistently
Diffstat (limited to 'bin')
-rw-r--r--bin/ufo-launch.c18
-rw-r--r--bin/ufo-query.c15
-rw-r--r--bin/ufod.c11
3 files changed, 27 insertions, 17 deletions
diff --git a/bin/ufo-launch.c b/bin/ufo-launch.c
index 5b7b0c7..886e7cd 100644
--- a/bin/ufo-launch.c
+++ b/bin/ufo-launch.c
@@ -25,6 +25,8 @@
#include <ufo/ufo.h>
#include "ufo/compat.h"
+#include "config.h"
+
typedef struct {
char *name;
@@ -326,14 +328,16 @@ main(int argc, char* argv[])
static gboolean quiet = FALSE;
static gboolean trace = FALSE;
+ static gboolean version = FALSE;
static gchar **addresses = NULL;
static gchar *dump = NULL;
static GOptionEntry entries[] = {
- { "quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, "be quiet", NULL },
- { "trace", 't', 0, G_OPTION_ARG_NONE, &trace, "enable tracing", NULL },
+ { "quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, "be quiet", NULL },
+ { "trace", 't', 0, G_OPTION_ARG_NONE, &trace, "enable tracing", NULL },
{ "address", 'a', 0, G_OPTION_ARG_STRING_ARRAY, &addresses, "Address of remote server running `ufod'", NULL },
- { "dump", 'd', 0, G_OPTION_ARG_STRING, &dump, "Dump to JSON file", NULL },
+ { "dump", 'd', 0, G_OPTION_ARG_STRING, &dump, "Dump to JSON file", NULL },
+ { "version", 0, 0, G_OPTION_ARG_NONE, &version, "Show version information", NULL },
{ NULL }
};
@@ -349,8 +353,8 @@ main(int argc, char* argv[])
return 1;
}
- if (argc == 1) {
- g_print ("%s", g_option_context_get_help (context, TRUE, NULL));
+ if (version) {
+ g_print ("%s version " UFO_VERSION "\n", argv[0]);
return 0;
}
@@ -370,8 +374,8 @@ main(int argc, char* argv[])
leaves = ufo_graph_get_leaves (UFO_GRAPH (graph));
if (leaves == NULL) {
- g_print ("Incomplete pipeline specification, no leaves found.\n");
- return 1;
+ g_print ("%s", g_option_context_get_help (context, TRUE, NULL));
+ return 0;
}
nodes = ufo_graph_get_nodes (UFO_GRAPH (graph));
diff --git a/bin/ufo-query.c b/bin/ufo-query.c
index febdb15..42612bd 100644
--- a/bin/ufo-query.c
+++ b/bin/ufo-query.c
@@ -17,7 +17,8 @@
* License along with runjson. If not, see <http://www.gnu.org/licenses/>.
*/
-/* #include <stdlib.h> */
+#include "config.h"
+
#include <ufo/ufo.h>
#include "ufo/compat.h"
@@ -25,6 +26,7 @@
static gboolean list = FALSE;
static gchar *prop_name = NULL;
static gboolean verbose = FALSE;
+static gboolean version = FALSE;
static void
@@ -86,9 +88,10 @@ main(int argc, char* argv[])
GError *error = NULL;
static GOptionEntry entries[] = {
- { "list", 'l', 0, G_OPTION_ARG_NONE, &list, "list available tasks", NULL },
- { "props", 'p', 0, G_OPTION_ARG_STRING, &prop_name, "Properties of given task", NULL },
+ { "list", 'l', 0, G_OPTION_ARG_NONE, &list, "list available tasks", NULL },
+ { "props", 'p', 0, G_OPTION_ARG_STRING, &prop_name, "Properties of given task", NULL },
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL },
+ { "version", 0, 0, G_OPTION_ARG_NONE, &version, "Show version information", NULL },
{ NULL }
};
@@ -104,6 +107,12 @@ main(int argc, char* argv[])
return 1;
}
+ if (version) {
+ g_print ("%s version " UFO_VERSION "\n", argv[0]);
+ return 0;
+ }
+
+
pm = ufo_plugin_manager_new ();
if (list)
diff --git a/bin/ufod.c b/bin/ufod.c
index 9cb9367..94830c8 100644
--- a/bin/ufod.c
+++ b/bin/ufod.c
@@ -49,12 +49,9 @@ opts_parse (gint *argc, gchar ***argv)
opts = g_new0 (Options, 1);
GOptionEntry entries[] = {
- { "listen", 'l', 0, G_OPTION_ARG_STRING, &opts->addr,
- "Address to listen on (see http://api.zeromq.org/3-2:zmq-tcp)", NULL },
- { "path", 'p', 0, G_OPTION_ARG_STRING_ARRAY, &opts->paths,
- "Path to node plugins or OpenCL kernels", NULL },
- { "version", 'v', 0, G_OPTION_ARG_NONE, &show_version,
- "Show version information", NULL },
+ { "listen", 'l', 0, G_OPTION_ARG_STRING, &opts->addr, "Address to listen on (see http://api.zeromq.org/3-2:zmq-tcp)", NULL },
+ { "path", 'p', 0, G_OPTION_ARG_STRING_ARRAY, &opts->paths, "Path to node plugins or OpenCL kernels", NULL },
+ { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, "Show version information", NULL },
{ NULL }
};
@@ -68,7 +65,7 @@ opts_parse (gint *argc, gchar ***argv)
}
if (show_version) {
- g_print ("ufod %s\n", UFO_VERSION);
+ g_print ("%s version " UFO_VERSION "\n", argv[0][0]);
exit (EXIT_SUCCESS);
}