Lines Matching refs:cmd

45 static void print_help(FILE *stream, const char *cmd);
190 static int _wpa_ctrl_command(struct wpa_ctrl *ctrl, const char *cmd, int print)
201 ret = wpa_ctrl_request(ctrl, cmd, strlen(cmd), buf, &len,
204 printf("'%s' command timed out.\n", cmd);
207 printf("'%s' command failed.\n", cmd);
218 static inline int wpa_ctrl_command(struct wpa_ctrl *ctrl, const char *cmd)
220 return _wpa_ctrl_command(ctrl, cmd, 1);
224 static int hostapd_cli_cmd(struct wpa_ctrl *ctrl, const char *cmd,
231 cmd, min_args, min_args > 1 ? "s are" : " is");
234 if (write_cmd(buf, sizeof(buf), cmd, argc, argv) < 0)
445 char cmd[256];
455 res = os_snprintf(cmd, sizeof(cmd), "WPS_CHECK_PIN %s %s",
458 res = os_snprintf(cmd, sizeof(cmd), "WPS_CHECK_PIN %s",
460 if (os_snprintf_error(sizeof(cmd), res)) {
464 return wpa_ctrl_command(ctrl, cmd);
512 char cmd[64];
521 res = os_snprintf(cmd, sizeof(cmd), "WPS_NFC_CONFIG_TOKEN %s",
523 if (os_snprintf_error(sizeof(cmd), res)) {
527 return wpa_ctrl_command(ctrl, cmd);
534 char cmd[64];
543 res = os_snprintf(cmd, sizeof(cmd), "WPS_NFC_TOKEN %s", argv[0]);
544 if (os_snprintf_error(sizeof(cmd), res)) {
548 return wpa_ctrl_command(ctrl, cmd);
555 char cmd[64];
564 res = os_snprintf(cmd, sizeof(cmd), "NFC_GET_HANDOVER_SEL %s %s",
566 if (os_snprintf_error(sizeof(cmd), res)) {
570 return wpa_ctrl_command(ctrl, cmd);
723 static int wpa_ctrl_command_sta(struct wpa_ctrl *ctrl, const char *cmd,
735 ret = wpa_ctrl_request(ctrl, cmd, strlen(cmd), buf, &len,
738 printf("'%s' command timed out.\n", cmd);
741 printf("'%s' command failed.\n", cmd);
763 char addr[32], cmd[64];
768 snprintf(cmd, sizeof(cmd), "STA-NEXT %s", addr);
769 } while (wpa_ctrl_command_sta(ctrl, cmd, addr, sizeof(addr), 1) == 0);
778 char addr[32], cmd[64];
785 os_snprintf(cmd, sizeof(cmd), "STA-NEXT %s", addr);
786 } while (wpa_ctrl_command_sta(ctrl, cmd, addr, sizeof(addr), 0) == 0);
917 char cmd[256];
923 snprintf(cmd, sizeof(cmd), "LEVEL %s", argv[0]);
924 return wpa_ctrl_command(ctrl, cmd);
930 char addr[32], cmd[64];
942 os_snprintf(cmd, sizeof(cmd), "STA-NEXT %s", addr);
943 } while (wpa_ctrl_command_sta(ctrl, cmd, addr, sizeof(addr), 0) == 0);
1027 char cmd[2048];
1036 res = os_snprintf(cmd, sizeof(cmd), "SET %s %s", argv[0], argv[1]);
1037 if (os_snprintf_error(sizeof(cmd), res)) {
1041 return wpa_ctrl_command(ctrl, cmd);
1085 char cmd[256];
1094 res = os_snprintf(cmd, sizeof(cmd), "GET %s", argv[0]);
1095 if (os_snprintf_error(sizeof(cmd), res)) {
1099 return wpa_ctrl_command(ctrl, cmd);
1131 char cmd[256];
1141 total = os_snprintf(cmd, sizeof(cmd), "FST-MANAGER");
1144 res = os_snprintf(cmd + total, sizeof(cmd) - total, " %s",
1146 if (os_snprintf_error(sizeof(cmd) - total, res)) {
1152 return wpa_ctrl_command(ctrl, cmd);
1160 char cmd[256];
1175 res = os_snprintf(cmd, sizeof(cmd), "CHAN_SWITCH %s %s",
1177 if (os_snprintf_error(sizeof(cmd), res)) {
1184 tmp = cmd + total;
1185 res = os_snprintf(tmp, sizeof(cmd) - total, " %s", argv[i]);
1186 if (os_snprintf_error(sizeof(cmd) - total, res)) {
1192 return wpa_ctrl_command(ctrl, cmd);
1226 char cmd[256];
1235 res = os_snprintf(cmd, sizeof(cmd), "VENDOR %s %s %s", argv[0], argv[1],
1237 if (os_snprintf_error(sizeof(cmd), res)) {
1241 return wpa_ctrl_command(ctrl, cmd);
1255 char cmd[256];
1258 res = os_snprintf(cmd, sizeof(cmd), "LOG_LEVEL%s%s%s%s",
1263 if (os_snprintf_error(sizeof(cmd), res)) {
1267 return wpa_ctrl_command(ctrl, cmd);
1295 char cmd[2048];
1303 res = os_snprintf(cmd, sizeof(cmd), "SET_NEIGHBOR %s %s %s %s %s %s",
1306 if (os_snprintf_error(sizeof(cmd), res)) {
1310 return wpa_ctrl_command(ctrl, cmd);
1317 char cmd[400];
1325 res = os_snprintf(cmd, sizeof(cmd), "REMOVE_NEIGHBOR %s %s",
1327 if (os_snprintf_error(sizeof(cmd), res)) {
1331 return wpa_ctrl_command(ctrl, cmd);
1338 char cmd[256];
1346 res = os_snprintf(cmd, sizeof(cmd), "REQ_LCI %s", argv[0]);
1347 if (os_snprintf_error(sizeof(cmd), res)) {
1351 return wpa_ctrl_command(ctrl, cmd);
1512 const char *cmd;
1569 "<cmd> [params..] = enable/disable AP PIN" },
1697 static void print_cmd_help(FILE *stream, const struct hostapd_cli_cmd *cmd,
1703 if (cmd->usage == NULL)
1705 fprintf(stream, "%s%s ", pad, cmd->cmd);
1706 for (n = 0; (c = cmd->usage[n]); n++) {
1715 static void print_help(FILE *stream, const char *cmd)
1720 for (n = 0; hostapd_cli_commands[n].cmd; n++) {
1721 if (cmd == NULL || str_starts(hostapd_cli_commands[n].cmd, cmd))
1729 const struct hostapd_cli_cmd *cmd, *match = NULL;
1733 cmd = hostapd_cli_commands;
1734 while (cmd->cmd) {
1735 if (strncasecmp(cmd->cmd, argv[0], strlen(argv[0])) == 0) {
1736 match = cmd;
1737 if (os_strcasecmp(cmd->cmd, argv[0]) == 0) {
1744 cmd++;
1749 cmd = hostapd_cli_commands;
1750 while (cmd->cmd) {
1751 if (strncasecmp(cmd->cmd, argv[0], strlen(argv[0])) ==
1753 printf(" %s", cmd->cmd);
1755 cmd++;
1848 static void hostapd_cli_edit_cmd_cb(void *ctx, char *cmd)
1852 argc = tokenize_cmd(cmd, argv);
1874 for (i = 0; hostapd_cli_commands[i].cmd; i++) {
1875 res[i] = os_strdup(hostapd_cli_commands[i].cmd);
1884 static char ** hostapd_cli_cmd_completion(const char *cmd, const char *str,
1889 for (i = 0; hostapd_cli_commands[i].cmd; i++) {
1890 if (os_strcasecmp(hostapd_cli_commands[i].cmd, cmd) != 0)
1911 char *cmd;
1917 cmd = os_malloc(pos + 1);
1918 if (cmd == NULL)
1920 os_memcpy(cmd, str, pos);
1921 cmd[end - str] = '\0';
1922 res = hostapd_cli_cmd_completion(cmd, str, pos);
1923 os_free(cmd);