move x_mkraw() to main.c from edit.c in order to be able to skip the latter
This commit is contained in:
parent
64447e738d
commit
29e36ed2a2
33
edit.c
33
edit.c
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#ifndef MKSH_NO_CMDLINE_EDITING
|
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.236 2012/05/04 22:18:23 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.237 2012/05/05 17:32:31 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* in later versions we might use libtermcap for this, but since external
|
* in later versions we might use libtermcap for this, but since external
|
||||||
|
@ -5367,34 +5367,3 @@ vi_macro_reset(void)
|
||||||
}
|
}
|
||||||
#endif /* !MKSH_S_NOVI */
|
#endif /* !MKSH_S_NOVI */
|
||||||
#endif /* !MKSH_NO_CMDLINE_EDITING */
|
#endif /* !MKSH_NO_CMDLINE_EDITING */
|
||||||
|
|
||||||
void
|
|
||||||
x_mkraw(int fd, mksh_ttyst *ocb, bool forread)
|
|
||||||
{
|
|
||||||
mksh_ttyst cb;
|
|
||||||
|
|
||||||
if (ocb)
|
|
||||||
mksh_tcget(fd, ocb);
|
|
||||||
else
|
|
||||||
ocb = &tty_state;
|
|
||||||
|
|
||||||
cb = *ocb;
|
|
||||||
if (forread) {
|
|
||||||
cb.c_lflag &= ~(ICANON) | ECHO;
|
|
||||||
} else {
|
|
||||||
cb.c_iflag &= ~(INLCR | ICRNL);
|
|
||||||
cb.c_lflag &= ~(ISIG | ICANON | ECHO);
|
|
||||||
}
|
|
||||||
#if defined(VLNEXT) && defined(_POSIX_VDISABLE)
|
|
||||||
/* OSF/1 processes lnext when ~icanon */
|
|
||||||
cb.c_cc[VLNEXT] = _POSIX_VDISABLE;
|
|
||||||
#endif
|
|
||||||
/* SunOS 4.1.x & OSF/1 processes discard(flush) when ~icanon */
|
|
||||||
#if defined(VDISCARD) && defined(_POSIX_VDISABLE)
|
|
||||||
cb.c_cc[VDISCARD] = _POSIX_VDISABLE;
|
|
||||||
#endif
|
|
||||||
cb.c_cc[VTIME] = 0;
|
|
||||||
cb.c_cc[VMIN] = 1;
|
|
||||||
|
|
||||||
mksh_tcset(fd, &cb);
|
|
||||||
}
|
|
||||||
|
|
33
main.c
33
main.c
|
@ -34,7 +34,7 @@
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.221 2012/05/04 22:34:51 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.222 2012/05/05 17:32:33 tg Exp $");
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
|
@ -1782,3 +1782,34 @@ DF(const char *fmt, ...)
|
||||||
mksh_unlkfd(shl_dbg_fd);
|
mksh_unlkfd(shl_dbg_fd);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void
|
||||||
|
x_mkraw(int fd, mksh_ttyst *ocb, bool forread)
|
||||||
|
{
|
||||||
|
mksh_ttyst cb;
|
||||||
|
|
||||||
|
if (ocb)
|
||||||
|
mksh_tcget(fd, ocb);
|
||||||
|
else
|
||||||
|
ocb = &tty_state;
|
||||||
|
|
||||||
|
cb = *ocb;
|
||||||
|
if (forread) {
|
||||||
|
cb.c_lflag &= ~(ICANON) | ECHO;
|
||||||
|
} else {
|
||||||
|
cb.c_iflag &= ~(INLCR | ICRNL);
|
||||||
|
cb.c_lflag &= ~(ISIG | ICANON | ECHO);
|
||||||
|
}
|
||||||
|
#if defined(VLNEXT) && defined(_POSIX_VDISABLE)
|
||||||
|
/* OSF/1 processes lnext when ~icanon */
|
||||||
|
cb.c_cc[VLNEXT] = _POSIX_VDISABLE;
|
||||||
|
#endif
|
||||||
|
/* SunOS 4.1.x & OSF/1 processes discard(flush) when ~icanon */
|
||||||
|
#if defined(VDISCARD) && defined(_POSIX_VDISABLE)
|
||||||
|
cb.c_cc[VDISCARD] = _POSIX_VDISABLE;
|
||||||
|
#endif
|
||||||
|
cb.c_cc[VTIME] = 0;
|
||||||
|
cb.c_cc[VMIN] = 1;
|
||||||
|
|
||||||
|
mksh_tcset(fd, &cb);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue