diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c index 376a02572..56f5fe251 100644 --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c @@ -74,24 +74,6 @@ static void usage(void) } -static int get_cmd_arg_num(const char *str, int pos) -{ - int arg = 0, i; - - for (i = 0; i <= pos; i++) { - if (str[i] != ' ') { - arg++; - while (i <= pos && str[i] != ' ') - i++; - } - } - - if (arg > 0) - arg--; - return arg; -} - - static void register_event_handler(struct wpa_ctrl *ctrl) { if (!ctrl_conn) diff --git a/src/common/cli.c b/src/common/cli.c index 24f465ca5..6e0018875 100644 --- a/src/common/cli.c +++ b/src/common/cli.c @@ -188,3 +188,21 @@ char ** cli_txt_list_array(struct dl_list *txt_list) return res; } + + +int get_cmd_arg_num(const char *str, int pos) +{ + int arg = 0, i; + + for (i = 0; i <= pos; i++) { + if (str[i] != ' ') { + arg++; + while (i <= pos && str[i] != ' ') + i++; + } + } + + if (arg > 0) + arg--; + return arg; +} diff --git a/src/common/cli.h b/src/common/cli.h index 4b44ce27d..4caf321c4 100644 --- a/src/common/cli.h +++ b/src/common/cli.h @@ -37,4 +37,6 @@ int cli_txt_list_add_word(struct dl_list *txt_list, const char *txt, char ** cli_txt_list_array(struct dl_list *txt_list); +int get_cmd_arg_num(const char *str, int pos); + #endif /* CLI_H */ diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c index 761421812..42be5b6f6 100644 --- a/wpa_supplicant/wpa_cli.c +++ b/wpa_supplicant/wpa_cli.c @@ -90,24 +90,6 @@ static void usage(void) } -static int get_cmd_arg_num(const char *str, int pos) -{ - int arg = 0, i; - - for (i = 0; i <= pos; i++) { - if (str[i] != ' ') { - arg++; - while (i <= pos && str[i] != ' ') - i++; - } - } - - if (arg > 0) - arg--; - return arg; -} - - static int wpa_cli_show_event(const char *event) { const char *start;