]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: add helpful hints for vendor cmd
authorOla Olsson <ola1olsson@gmail.com>
Mon, 12 Oct 2015 20:32:10 +0000 (22:32 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 13 Oct 2015 09:02:27 +0000 (11:02 +0200)
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 <ola.olsson@sonymobile.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
vendor.c

index d0b4f9ef4d5cc966b639b0141622fb9c91fa20f2..86c03d1c5f63a09180be405d5e0f2be4eac1556f 100644 (file)
--- 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;