@@ -3651,19 +3651,19 @@ static int cmd_wifi_p2p_find(const struct shell *sh, size_t argc, char *argv[])
36513651 if (argc > 1 ) {
36523652 int opt ;
36533653 int opt_index = 0 ;
3654- struct sys_getopt_state * state ;
3655- static const struct sys_getopt_option long_options [] = {
3656- {"timeout" , sys_getopt_required_argument , 0 , 't' },
3657- {"type" , sys_getopt_required_argument , 0 , 'T' },
3658- {"iface" , sys_getopt_required_argument , 0 , 'i' },
3659- {"help" , sys_getopt_no_argument , 0 , 'h' },
3654+ struct getopt_state * state ;
3655+ static const struct option long_options [] = {
3656+ {"timeout" , required_argument , 0 , 't' },
3657+ {"type" , required_argument , 0 , 'T' },
3658+ {"iface" , required_argument , 0 , 'i' },
3659+ {"help" , no_argument , 0 , 'h' },
36603660 {0 , 0 , 0 , 0 }
36613661 };
36623662 long val ;
36633663
3664- while ((opt = sys_getopt_long (argc , argv , "t:T:i:h" ,
3664+ while ((opt = getopt_long (argc , argv , "t:T:i:h" ,
36653665 long_options , & opt_index )) != -1 ) {
3666- state = sys_getopt_state_get ();
3666+ state = getopt_state_get ();
36673667 switch (opt ) {
36683668 case 't' :
36693669 if (!parse_number (sh , & val , state -> optarg , "timeout" , 0 , 65535 )) {
@@ -3735,12 +3735,12 @@ static int cmd_wifi_p2p_connect(const struct shell *sh, size_t argc, char *argv[
37353735 const char * method_arg = NULL ;
37363736 int opt ;
37373737 int opt_index = 0 ;
3738- struct sys_getopt_state * state ;
3739- static const struct sys_getopt_option long_options [] = {
3740- {"go-intent" , sys_getopt_required_argument , 0 , 'g' },
3741- {"freq" , sys_getopt_required_argument , 0 , 'f' },
3742- {"iface" , sys_getopt_required_argument , 0 , 'i' },
3743- {"help" , sys_getopt_no_argument , 0 , 'h' },
3738+ struct getopt_state * state ;
3739+ static const struct option long_options [] = {
3740+ {"go-intent" , required_argument , 0 , 'g' },
3741+ {"freq" , required_argument , 0 , 'f' },
3742+ {"iface" , required_argument , 0 , 'i' },
3743+ {"help" , no_argument , 0 , 'h' },
37443744 {0 , 0 , 0 , 0 }
37453745 };
37463746 long val ;
@@ -3784,8 +3784,8 @@ static int cmd_wifi_p2p_connect(const struct shell *sh, size_t argc, char *argv[
37843784 /* Set default frequency to 2462 MHz (channel 11, 2.4 GHz) */
37853785 params .connect .freq = 2462 ;
37863786
3787- while ((opt = sys_getopt_long (argc , argv , "g:f:i:h" , long_options , & opt_index )) != -1 ) {
3788- state = sys_getopt_state_get ();
3787+ while ((opt = getopt_long (argc , argv , "g:f:i:h" , long_options , & opt_index )) != -1 ) {
3788+ state = getopt_state_get ();
37893789 switch (opt ) {
37903790 case 'g' :
37913791 if (!parse_number (sh , & val , state -> optarg , "go-intent" , 0 , 15 )) {
@@ -3833,17 +3833,17 @@ static int cmd_wifi_p2p_group_add(const struct shell *sh, size_t argc, char *arg
38333833 struct wifi_p2p_params params = {0 };
38343834 int opt ;
38353835 int opt_index = 0 ;
3836- struct sys_getopt_state * state ;
3837- static const struct sys_getopt_option long_options [] = {
3838- {"freq" , sys_getopt_required_argument , 0 , 'f' },
3839- {"persistent" , sys_getopt_required_argument , 0 , 'p' },
3840- {"ht40" , sys_getopt_no_argument , 0 , 'h' },
3841- {"vht" , sys_getopt_no_argument , 0 , 'v' },
3842- {"he" , sys_getopt_no_argument , 0 , 'H' },
3843- {"edmg" , sys_getopt_no_argument , 0 , 'e' },
3844- {"go-bssid" , sys_getopt_required_argument , 0 , 'b' },
3845- {"iface" , sys_getopt_required_argument , 0 , 'i' },
3846- {"help" , sys_getopt_no_argument , 0 , '?' },
3836+ struct getopt_state * state ;
3837+ static const struct option long_options [] = {
3838+ {"freq" , required_argument , 0 , 'f' },
3839+ {"persistent" , required_argument , 0 , 'p' },
3840+ {"ht40" , no_argument , 0 , 'h' },
3841+ {"vht" , no_argument , 0 , 'v' },
3842+ {"he" , no_argument , 0 , 'H' },
3843+ {"edmg" , no_argument , 0 , 'e' },
3844+ {"go-bssid" , required_argument , 0 , 'b' },
3845+ {"iface" , required_argument , 0 , 'i' },
3846+ {"help" , no_argument , 0 , '?' },
38473847 {0 , 0 , 0 , 0 }
38483848 };
38493849 long val ;
@@ -3860,9 +3860,9 @@ static int cmd_wifi_p2p_group_add(const struct shell *sh, size_t argc, char *arg
38603860 params .group_add .edmg = false;
38613861 params .group_add .go_bssid_length = 0 ;
38623862
3863- while ((opt = sys_getopt_long (argc , argv , "f:p:hvHeb:i:?" , long_options ,
3863+ while ((opt = getopt_long (argc , argv , "f:p:hvHeb:i:?" , long_options ,
38643864 & opt_index )) != -1 ) {
3865- state = sys_getopt_state_get ();
3865+ state = getopt_state_get ();
38663866 switch (opt ) {
38673867 case 'f' :
38683868 if (!parse_number (sh , & val , state -> optarg , "freq" , 0 , 6000 )) {
@@ -3951,15 +3951,15 @@ static int cmd_wifi_p2p_invite(const struct shell *sh, size_t argc, char *argv[]
39513951 uint8_t mac_addr [WIFI_MAC_ADDR_LEN ];
39523952 int opt ;
39533953 int opt_index = 0 ;
3954- struct sys_getopt_state * state ;
3955- static const struct sys_getopt_option long_options [] = {
3956- {"persistent" , sys_getopt_required_argument , 0 , 'p' },
3957- {"group" , sys_getopt_required_argument , 0 , 'g' },
3958- {"peer" , sys_getopt_required_argument , 0 , 'P' },
3959- {"freq" , sys_getopt_required_argument , 0 , 'f' },
3960- {"go-dev-addr" , sys_getopt_required_argument , 0 , 'd' },
3961- {"iface" , sys_getopt_required_argument , 0 , 'i' },
3962- {"help" , sys_getopt_no_argument , 0 , 'h' },
3954+ struct getopt_state * state ;
3955+ static const struct option long_options [] = {
3956+ {"persistent" , required_argument , 0 , 'p' },
3957+ {"group" , required_argument , 0 , 'g' },
3958+ {"peer" , required_argument , 0 , 'P' },
3959+ {"freq" , required_argument , 0 , 'f' },
3960+ {"go-dev-addr" , required_argument , 0 , 'd' },
3961+ {"iface" , required_argument , 0 , 'i' },
3962+ {"help" , no_argument , 0 , 'h' },
39633963 {0 , 0 , 0 , 0 }
39643964 };
39653965 long val ;
@@ -3980,9 +3980,9 @@ static int cmd_wifi_p2p_invite(const struct shell *sh, size_t argc, char *argv[]
39803980 return - EINVAL ;
39813981 }
39823982
3983- while ((opt = sys_getopt_long (argc , argv , "p:g:P:f:d:i:h" , long_options ,
3983+ while ((opt = getopt_long (argc , argv , "p:g:P:f:d:i:h" , long_options ,
39843984 & opt_index )) != -1 ) {
3985- state = sys_getopt_state_get ();
3985+ state = getopt_state_get ();
39863986 switch (opt ) {
39873987 case 'p' :
39883988 if (!parse_number (sh , & val , state -> optarg , "persistent" , 0 , 255 )) {
@@ -4034,7 +4034,7 @@ static int cmd_wifi_p2p_invite(const struct shell *sh, size_t argc, char *argv[]
40344034 }
40354035 }
40364036
4037- state = sys_getopt_state_get ();
4037+ state = getopt_state_get ();
40384038
40394039 if (params .invite .type == WIFI_P2P_INVITE_PERSISTENT &&
40404040 params .invite .persistent_id >= 0 &&
0 commit comments