* fhandler_termios.cc (fhandler_termios::line_edit): Return line_edit_error and
remove last char from readahead buffer if accept_input() fails. * fhandler_tty.cc (fhandler_pty_master::accept_input): Return 0 and restore readahead buffer when tty slave pipe is full.
This commit is contained in:
parent
1a7ce58505
commit
b2be3149b4
|
@ -1,3 +1,12 @@
|
||||||
|
2002-12-16 Steve Osborn <bub@io.com>
|
||||||
|
Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* fhandler_termios.cc (fhandler_termios::line_edit): Return
|
||||||
|
line_edit_error and remove last char from readahead buffer if
|
||||||
|
accept_input() fails.
|
||||||
|
* fhandler_tty.cc (fhandler_pty_master::accept_input): Return 0 and
|
||||||
|
restore readahead buffer when tty slave pipe is full.
|
||||||
|
|
||||||
2002-12-16 Christopher Faylor <cgf@redhat.com>
|
2002-12-16 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* pinfo.cc (_pinfo::cmdline): Allocate sufficient space for myself
|
* pinfo.cc (_pinfo::cmdline): Allocate sufficient space for myself
|
||||||
|
|
|
@ -326,7 +326,12 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
|
||||||
put_readahead (c);
|
put_readahead (c);
|
||||||
if (!iscanon || always_accept || input_done)
|
if (!iscanon || always_accept || input_done)
|
||||||
{
|
{
|
||||||
(void) accept_input();
|
if (!accept_input ())
|
||||||
|
{
|
||||||
|
ret = line_edit_error;
|
||||||
|
eat_readahead (1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
ret = line_edit_input_done;
|
ret = line_edit_input_done;
|
||||||
input_done = 0;
|
input_done = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,51 +145,48 @@ fhandler_pty_master::doecho (const void *str, DWORD len)
|
||||||
int
|
int
|
||||||
fhandler_pty_master::accept_input ()
|
fhandler_pty_master::accept_input ()
|
||||||
{
|
{
|
||||||
DWORD bytes_left, written;
|
DWORD bytes_left;
|
||||||
DWORD n;
|
int ret = 1;
|
||||||
DWORD rc;
|
|
||||||
char* p;
|
|
||||||
|
|
||||||
rc = WaitForSingleObject (input_mutex, INFINITE);
|
(void) WaitForSingleObject (input_mutex, INFINITE);
|
||||||
|
|
||||||
bytes_left = n = eat_readahead (-1);
|
bytes_left = eat_readahead (-1);
|
||||||
p = rabuf;
|
|
||||||
|
|
||||||
if (n != 0)
|
if (!bytes_left)
|
||||||
{
|
{
|
||||||
while (bytes_left > 0)
|
termios_printf ("sending EOF to slave");
|
||||||
{
|
get_ttyp ()->read_retval = 0;
|
||||||
termios_printf ("about to write %d chars to slave", bytes_left);
|
}
|
||||||
rc = WriteFile (get_output_handle (), p, bytes_left, &written, NULL);
|
else
|
||||||
if (!rc)
|
{
|
||||||
{
|
char *p = rabuf;
|
||||||
debug_printf ("error writing to pipe %E");
|
DWORD rc;
|
||||||
get_ttyp ()->read_retval = -1;
|
DWORD written = 0;
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
get_ttyp ()->read_retval = 1;
|
|
||||||
|
|
||||||
|
termios_printf ("about to write %d chars to slave", bytes_left);
|
||||||
|
rc = WriteFile (get_output_handle (), p, bytes_left, &written, NULL);
|
||||||
|
if (!rc)
|
||||||
|
{
|
||||||
|
debug_printf ("error writing to pipe %E");
|
||||||
|
get_ttyp ()->read_retval = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
get_ttyp ()->read_retval = 1;
|
||||||
p += written;
|
p += written;
|
||||||
bytes_left -= written;
|
bytes_left -= written;
|
||||||
if (bytes_left > 0)
|
if (bytes_left > 0)
|
||||||
{
|
{
|
||||||
debug_printf ("to_slave pipe is full");
|
debug_printf ("to_slave pipe is full");
|
||||||
SetEvent (input_available_event);
|
puts_readahead (p, bytes_left);
|
||||||
ReleaseMutex (input_mutex);
|
ret = 0;
|
||||||
Sleep (10);
|
|
||||||
rc = WaitForSingleObject (input_mutex, INFINITE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
termios_printf ("sending EOF to slave");
|
|
||||||
get_ttyp ()->read_retval = 0;
|
|
||||||
}
|
|
||||||
SetEvent (input_available_event);
|
SetEvent (input_available_event);
|
||||||
ReleaseMutex (input_mutex);
|
ReleaseMutex (input_mutex);
|
||||||
return 1;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD WINAPI
|
static DWORD WINAPI
|
||||||
|
|
Loading…
Reference in New Issue