void input_init(void) { if (embedded_mode) { return; } read_stream = rstream_new(read_cb, READ_BUFFER_SIZE, NULL, NULL); rstream_set_file(read_stream, read_cmd_fd); }
void input_start_stdin(int fd) { if (read_stream) { return; } read_buffer = rbuffer_new(READ_BUFFER_SIZE); read_stream = rstream_new(read_cb, read_buffer, NULL); rstream_set_file(read_stream, fd); rstream_start(read_stream); }
static void stderr_switch() { int mode = cur_tmode; // We probably set the wrong file descriptor to raw mode. Switch back to // cooked mode settmode(TMODE_COOK); // Stop the idle handle rstream_stop(read_stream); // Use stderr for stdin, also works for shell commands. read_cmd_fd = 2; // Initialize and start the input stream rstream_set_file(read_stream, read_cmd_fd); rstream_start(read_stream); // Set the mode back to what it was settmode(mode); }
void input_init() { read_stream = rstream_new(read_cb, READ_BUFFER_SIZE, NULL, false); rstream_set_file(read_stream, read_cmd_fd); }