Update
This commit is contained in:
parent
de6b1bcbf0
commit
9dde5fc33f
15
command.c
15
command.c
|
@ -538,8 +538,6 @@ bool command_network_send(const char *cmd_)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_STDIN_CMD
|
#ifdef HAVE_STDIN_CMD
|
||||||
static bool command_stdin_init(command_t *handle)
|
static bool command_stdin_init(command_t *handle)
|
||||||
{
|
{
|
||||||
|
@ -597,22 +595,20 @@ error:
|
||||||
#ifdef HAVE_STDIN_CMD
|
#ifdef HAVE_STDIN_CMD
|
||||||
static void command_stdin_poll(command_t *handle)
|
static void command_stdin_poll(command_t *handle)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
|
||||||
ptrdiff_t msg_len;
|
ptrdiff_t msg_len;
|
||||||
char *last_newline = NULL;
|
char *last_newline = NULL;
|
||||||
|
ssize_t ret = read_stdin(
|
||||||
if (!handle->stdin_enable)
|
handle->stdin_buf + handle->stdin_buf_ptr,
|
||||||
return;
|
|
||||||
|
|
||||||
ret = read_stdin(handle->stdin_buf + handle->stdin_buf_ptr,
|
|
||||||
STDIN_BUF_SIZE - handle->stdin_buf_ptr - 1);
|
STDIN_BUF_SIZE - handle->stdin_buf_ptr - 1);
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
handle->stdin_buf_ptr += ret;
|
handle->stdin_buf_ptr += ret;
|
||||||
handle->stdin_buf[handle->stdin_buf_ptr] = '\0';
|
handle->stdin_buf[handle->stdin_buf_ptr] = '\0';
|
||||||
|
|
||||||
last_newline = strrchr(handle->stdin_buf, '\n');
|
last_newline =
|
||||||
|
strrchr(handle->stdin_buf, '\n');
|
||||||
|
|
||||||
if (!last_newline)
|
if (!last_newline)
|
||||||
{
|
{
|
||||||
|
@ -645,6 +641,7 @@ bool command_poll(command_t *handle)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_STDIN_CMD
|
#ifdef HAVE_STDIN_CMD
|
||||||
|
if (handle->stdin_enable)
|
||||||
command_stdin_poll(handle);
|
command_stdin_poll(handle);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue