/* check 3 arrays of commands for a match in match_buf: */
static const struct modem_cmd* find_cmd_match(struct modem_cmd_handler_data *data)
/* check 3 arrays of commands for a match in match_buf: */
static const struct modem_cmd* find_cmd_match(struct modem_cmd_handler_data *data)
{
	int j;
	size_t i;
	for (j = 0; j < ARRAY_SIZE(data->cmds); j++) {
		if (!data->cmds[j] || data->cmds_len[j] == 0U) {
			continue;
		}
		for (i = 0; i < data->cmds_len[j]; i++) {
			if (strlen(data->cmds[j][i].cmd) == 0 ||
			    strncmp(data->match_buf, data->cmds[j][i].cmd,
				    data->cmds[j][i].cmd_len) == 0) {
				return &data->cmds[j][i];
			}
		}
	}
	return NULL;
}