/* Length is the number of bytes following (the ftp data).  */
MODEM_CMD_DEFINE(on_cmd_ftpget)
/* Length is the number of bytes following (the ftp data).  */
MODEM_CMD_DEFINE(on_cmd_ftpget)
{
	int nbytes = atoi(argv[0]);
	int bytes_to_skip;
	size_t out_len;
	if (nbytes == 0) {
		mdata.ftp.nread = 0;
		return 0;
	}
	bytes_to_skip = strlen(argv[0]) + 2;
	if (net_buf_frags_len(data->rx_buf) <= nbytes + bytes_to_skip) {
		return -EAGAIN;
	}
	out_len = net_buf_linearize(mdata.ftp.read_buffer, mdata.ftp.nread, data->rx_buf,
				    bytes_to_skip, nbytes);
	if (out_len != nbytes) {
		LOG_WRN("FTP read size differs!");
	}
	data->rx_buf = net_buf_skip(data->rx_buf, nbytes + bytes_to_skip);
	mdata.ftp.nread = nbytes;
	return 0;
}