[PATCH 28/29] of_* commands: print usage when insufficient arguments are given
Sascha Hauer
s.hauer at pengutronix.de
Tue Feb 26 15:18:55 EST 2013
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
commands/of_node.c | 3 +++
commands/of_property.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/commands/of_node.c b/commands/of_node.c
index 27f070d..0249d97 100644
--- a/commands/of_node.c
+++ b/commands/of_node.c
@@ -53,6 +53,9 @@ static int do_of_node(int argc, char *argv[])
}
}
+ if (optind == argc)
+ return COMMAND_ERROR_USAGE;
+
if (optind < argc) {
path = argv[optind];
}
diff --git a/commands/of_property.c b/commands/of_property.c
index 1b968d8..5d35bb4 100644
--- a/commands/of_property.c
+++ b/commands/of_property.c
@@ -191,6 +191,9 @@ static int do_of_property(int argc, char *argv[])
}
}
+ if (optind == argc)
+ return COMMAND_ERROR_USAGE;
+
root = of_get_root_node();
if (!root) {
printf("root node not set\n");
--
1.7.10.4
More information about the barebox
mailing list