aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c10
1 files changed, 5 insertions, 5 deletions
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<ARRAY_LEN(toy_list); i++) {
+ else for (i=1; i<ARRAY_LEN(toy_list); i++) {
int fl = toy_list[i].flags;
if (fl & TOYMASK_LOCATION) {
if (toys.argv[1]) {