diff options
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 30 |
1 files changed, 0 insertions, 30 deletions
@@ -110,36 +110,6 @@ int send_string(int fd, const char* string) return ret; } -int nonblock_recvline(read_buffer_t* buffer, int fd, cmd_t** cmd_q, client_t* client_lst, options_t* opt) -{ - int ret = 0; - for(;;) { - ret = recv(fd, &buffer->buf[buffer->offset], 1, 0); - if(!ret) - return 2; - if(ret == -1 && errno == EAGAIN) - return 0; - else if(ret < 0) - break; - - if(buffer->buf[buffer->offset] == '\n') { - buffer->buf[buffer->offset] = 0; - ret = process_cmd(buffer->buf, fd, cmd_q, client_lst, opt); - buffer->offset = 0; - break; - } - - buffer->offset++; - if(buffer->offset >= sizeof(buffer->buf)) { - log_printf(DEBUG, "string too long (fd=%d)", fd); - buffer->offset = 0; - return 0; - } - } - - return ret; -} - int setup_tty(int fd, speed_t speed) { struct termios tmio; |