mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-12 03:59:09 +08:00
* include/sys/termios.h: Define _POSIX_VDISABLE. Define CCEQ macro.
* fhandler_termios.cc: Include <sys/termios.h>. (line_edit): Recognize disabled c_cc[] chars. Ignore VDISCARD when not in ICANON mode.
This commit is contained in:
parent
8cd4824313
commit
ad2864f4c8
@ -1,3 +1,10 @@
|
|||||||
|
2002-03-04 Christian Lestrade <christian.lestrade@free.fr>
|
||||||
|
|
||||||
|
* include/sys/termios.h: Define _POSIX_VDISABLE. Define CCEQ macro.
|
||||||
|
* fhandler_termios.cc: Include <sys/termios.h>.
|
||||||
|
(line_edit): Recognize disabled c_cc[] chars. Ignore VDISCARD when
|
||||||
|
not in ICANON mode.
|
||||||
|
|
||||||
2002-03-04 Dmitry Timoshkov <dmitry@baikal.ru>
|
2002-03-04 Dmitry Timoshkov <dmitry@baikal.ru>
|
||||||
|
|
||||||
* syscalls.cc (truncate64): Use ftruncate64 directly to not lose
|
* syscalls.cc (truncate64): Use ftruncate64 directly to not lose
|
||||||
|
@ -9,6 +9,7 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|||||||
details. */
|
details. */
|
||||||
|
|
||||||
#include "winsup.h"
|
#include "winsup.h"
|
||||||
|
#include <sys/termios.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -226,11 +227,11 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
|
|||||||
if (tc->ti.c_lflag & ISIG)
|
if (tc->ti.c_lflag & ISIG)
|
||||||
{
|
{
|
||||||
int sig;
|
int sig;
|
||||||
if (c == tc->ti.c_cc[VINTR])
|
if (CCEQ(tc->ti.c_cc[VINTR], c))
|
||||||
sig = SIGINT;
|
sig = SIGINT;
|
||||||
else if (c == tc->ti.c_cc[VQUIT])
|
else if (CCEQ(tc->ti.c_cc[VQUIT], c))
|
||||||
sig = SIGQUIT;
|
sig = SIGQUIT;
|
||||||
else if (c == tc->ti.c_cc[VSUSP])
|
else if (CCEQ(tc->ti.c_cc[VSUSP], c))
|
||||||
sig = SIGTSTP;
|
sig = SIGTSTP;
|
||||||
else
|
else
|
||||||
goto not_a_sig;
|
goto not_a_sig;
|
||||||
@ -245,7 +246,7 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
|
|||||||
not_a_sig:
|
not_a_sig:
|
||||||
if (tc->ti.c_iflag & IXON)
|
if (tc->ti.c_iflag & IXON)
|
||||||
{
|
{
|
||||||
if (c == tc->ti.c_cc[VSTOP])
|
if (CCEQ(tc->ti.c_cc[VSTOP], c))
|
||||||
{
|
{
|
||||||
if (!tc->output_stopped)
|
if (!tc->output_stopped)
|
||||||
{
|
{
|
||||||
@ -254,7 +255,7 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (c == tc->ti.c_cc[VSTART])
|
else if (CCEQ(tc->ti.c_cc[VSTART], c))
|
||||||
{
|
{
|
||||||
restart_output:
|
restart_output:
|
||||||
tc->output_stopped = 0;
|
tc->output_stopped = 0;
|
||||||
@ -264,20 +265,20 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
|
|||||||
else if ((tc->ti.c_iflag & IXANY) && tc->output_stopped)
|
else if ((tc->ti.c_iflag & IXANY) && tc->output_stopped)
|
||||||
goto restart_output;
|
goto restart_output;
|
||||||
}
|
}
|
||||||
if (tc->ti.c_lflag & IEXTEN && c == tc->ti.c_cc[VDISCARD])
|
if (iscanon && tc->ti.c_lflag & IEXTEN && CCEQ(tc->ti.c_cc[VDISCARD], c))
|
||||||
{
|
{
|
||||||
tc->ti.c_lflag ^= FLUSHO;
|
tc->ti.c_lflag ^= FLUSHO;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!iscanon)
|
if (!iscanon)
|
||||||
/* nothing */;
|
/* nothing */;
|
||||||
else if (c == tc->ti.c_cc[VERASE])
|
else if (CCEQ(tc->ti.c_cc[VERASE], c))
|
||||||
{
|
{
|
||||||
if (eat_readahead (1))
|
if (eat_readahead (1))
|
||||||
echo_erase ();
|
echo_erase ();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (c == tc->ti.c_cc[VWERASE])
|
else if (CCEQ(tc->ti.c_cc[VWERASE], c))
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
do
|
do
|
||||||
@ -288,7 +289,7 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
|
|||||||
while ((ch = peek_readahead (1)) >= 0 && !isspace (ch));
|
while ((ch = peek_readahead (1)) >= 0 && !isspace (ch));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (c == tc->ti.c_cc[VKILL])
|
else if (CCEQ(tc->ti.c_cc[VKILL], c))
|
||||||
{
|
{
|
||||||
int nchars = eat_readahead (-1);
|
int nchars = eat_readahead (-1);
|
||||||
if (tc->ti.c_lflag & ECHO)
|
if (tc->ti.c_lflag & ECHO)
|
||||||
@ -296,7 +297,7 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
|
|||||||
echo_erase (1);
|
echo_erase (1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (c == tc->ti.c_cc[VREPRINT])
|
else if (CCEQ(tc->ti.c_cc[VREPRINT], c))
|
||||||
{
|
{
|
||||||
if (tc->ti.c_lflag & ECHO)
|
if (tc->ti.c_lflag & ECHO)
|
||||||
{
|
{
|
||||||
@ -305,14 +306,14 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (c == tc->ti.c_cc[VEOF])
|
else if (CCEQ(tc->ti.c_cc[VEOF], c))
|
||||||
{
|
{
|
||||||
termios_printf ("EOF");
|
termios_printf ("EOF");
|
||||||
input_done = 1;
|
input_done = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (c == tc->ti.c_cc[VEOL] ||
|
else if (CCEQ(tc->ti.c_cc[VEOL], c) ||
|
||||||
c == tc->ti.c_cc[VEOL2] ||
|
CCEQ(tc->ti.c_cc[VEOL2], c) ||
|
||||||
c == '\n')
|
c == '\n')
|
||||||
{
|
{
|
||||||
set_input_done (1);
|
set_input_done (1);
|
||||||
|
@ -195,6 +195,14 @@ details. */
|
|||||||
|
|
||||||
#define NCCS 18
|
#define NCCS 18
|
||||||
|
|
||||||
|
/* `c_cc' member of 'struct termios' structure can be disabled by
|
||||||
|
using the value _POSIX_VDISABLE. */
|
||||||
|
#define _POSIX_VDISABLE '\0'
|
||||||
|
|
||||||
|
/* Compare a character C to a value VAL from the `c_cc' array in a
|
||||||
|
`struct termios'. If VAL is _POSIX_VDISABLE, no character can match it. */
|
||||||
|
#define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE)
|
||||||
|
|
||||||
typedef unsigned char cc_t;
|
typedef unsigned char cc_t;
|
||||||
typedef unsigned int tcflag_t;
|
typedef unsigned int tcflag_t;
|
||||||
typedef unsigned int speed_t;
|
typedef unsigned int speed_t;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user