From: Ola Olsson Date: Mon, 12 Oct 2015 20:32:10 +0000 (+0200) Subject: iw: add helpful hints for vendor cmd X-Git-Tag: v4.7~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6cd36342fcbf21bfb89cddaefe7b3d5f58d355e6;p=thirdparty%2Fiw.git iw: add helpful hints for vendor cmd Without having access to the source, it was hard to know the format of vendor oui and sub cmd. This commit fixes that by returning the right error code to print the help text. Signed-off-by: Ola Olsson Signed-off-by: Johannes Berg --- diff --git a/vendor.c b/vendor.c index d0b4f9e..86c03d1 100644 --- a/vendor.c +++ b/vendor.c @@ -55,15 +55,19 @@ static int handle_vendor(struct nl80211_state *state, FILE *file = NULL; if (argc < 3) - return -EINVAL; + return 1; res = sscanf(argv[0], "0x%x", &oui); - if (res != 1) - return -EINVAL; + if (res != 1) { + printf("Vendor command must start with 0x\n"); + return 2; + } res = sscanf(argv[1], "0x%x", &subcmd); - if (res != 1) - return -EINVAL; + if (res != 1) { + printf("Sub command must start with 0x\n"); + return 2; + } if (!strcmp(argv[2], "-")) file = stdin;