From ad602aa127e44eade76fbb05fd27ee8f5825282a Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 5 Apr 2015 19:23:36 -0500 Subject: Add --version to multiplexer. Can't think of a better place to stick the actual version info than a #define at the top of main. Makefile and toys.h are equally awkward, querying git tags wouldn't work if building a release tarball... watch me forget to update this when cutting a release. --- main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 4644d198..dbc39bec 100644 --- a/main.c +++ b/main.c @@ -5,6 +5,8 @@ #include "toys.h" +#define TOYBOX_VERSION "0.5.2" + // Populate toy_list[]. #undef NEWTOY @@ -155,14 +157,12 @@ void toybox_main(void) if (toys.argv[1]) { toys.optc = toys.recursion = 0; toy_exec(toys.argv+1); - if (toys.argv[1][0] == '-') goto list; - - error_exit("Unknown command %s",toys.argv[1]); + if (toys.argv[1][0] != '-') error_exit("Unknown command %s", toys.argv[1]); } -list: + if (!strcmp("--version", toys.argv[1])) printf(TOYBOX_VERSION); // Output list of command. - for (i=1; i