Skip to content

Commit c3cd5d1

Browse files
aescolarfabiobaltieri
authored andcommitted
subsys/net wifi/wifi_shell: Fix use of sys_getopt global status
sys_getopt has now its global status variables prefixed with sys_getopt_ Let's fix the use here. Note this worked as Zephyr's POSIX_C_LIB_EXT keeps a replica of these variables without the prefix. Signed-off-by: Alberto Escolar Piedras <[email protected]>
1 parent 24277bc commit c3cd5d1

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

subsys/net/l2/wifi/wifi_shell.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,24 +2300,25 @@ static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc,
23002300
}
23012301
}
23022302

2303-
if (optind == argc) {
2303+
if (sys_getopt_optind == argc) {
23042304
regd.chan_info = &chan_info[0];
23052305
regd.oper = WIFI_MGMT_GET;
2306-
} else if (optind == argc - 1) {
2307-
if (strlen(argv[optind]) != 2) {
2306+
} else if (sys_getopt_optind == argc - 1) {
2307+
if (strlen(argv[sys_getopt_optind]) != 2) {
23082308
PR_WARNING("Invalid reg domain: Length should be two letters/digits\n");
23092309
return -ENOEXEC;
23102310
}
23112311

23122312
/* Two letter country code with special case of 00 for WORLD */
2313-
if (((argv[optind][0] < 'A' || argv[optind][0] > 'Z') ||
2314-
(argv[optind][1] < 'A' || argv[optind][1] > 'Z')) &&
2315-
(argv[optind][0] != '0' || argv[optind][1] != '0')) {
2316-
PR_WARNING("Invalid reg domain %c%c\n", argv[optind][0], argv[optind][1]);
2313+
if (((argv[sys_getopt_optind][0] < 'A' || argv[sys_getopt_optind][0] > 'Z') ||
2314+
(argv[sys_getopt_optind][1] < 'A' || argv[sys_getopt_optind][1] > 'Z')) &&
2315+
(argv[sys_getopt_optind][0] != '0' || argv[sys_getopt_optind][1] != '0')) {
2316+
PR_WARNING("Invalid reg domain %c%c\n", argv[sys_getopt_optind][0],
2317+
argv[sys_getopt_optind][1]);
23172318
return -ENOEXEC;
23182319
}
2319-
regd.country_code[0] = argv[optind][0];
2320-
regd.country_code[1] = argv[optind][1];
2320+
regd.country_code[0] = argv[sys_getopt_optind][0];
2321+
regd.country_code[1] = argv[sys_getopt_optind][1];
23212322
regd.force = force;
23222323
regd.oper = WIFI_MGMT_SET;
23232324
} else {

0 commit comments

Comments
 (0)