Use raw mode if _POSIX_VDISABLE isn't available, to allow support under cygwin

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@210 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2000-09-06 15:19:18 +00:00
parent 43932bd17b
commit 9239d742d6
3 changed files with 31 additions and 6 deletions

View File

@ -6,6 +6,10 @@ CVS code -
do_cut_text() do_cut_text()
- Don't immediately abort if we're on filebot and the marker is - Don't immediately abort if we're on filebot and the marker is
set (fixes bug #42). set (fixes bug #42).
- nano.c:
- main()
- Added check for _POSIX_VDISABLE and use raw mode if not
available, allows nano to work with cygwin.
nano-0.9.17 - 09/04/2000 nano-0.9.17 - 09/04/2000
- General - General

21
nano.c
View File

@ -1825,11 +1825,13 @@ int main(int argc, char *argv[])
/* First back up the old settings so they can be restored, duh */ /* First back up the old settings so they can be restored, duh */
tcgetattr(0, &oldterm); tcgetattr(0, &oldterm);
#ifdef _POSIX_VDISABLE
term = oldterm; term = oldterm;
term.c_cc[VINTR] = _POSIX_VDISABLE; term.c_cc[VINTR] = _POSIX_VDISABLE;
term.c_cc[VQUIT] = _POSIX_VDISABLE; term.c_cc[VQUIT] = _POSIX_VDISABLE;
term.c_lflag &= ~IEXTEN; term.c_lflag &= ~IEXTEN;
tcsetattr(0, TCSANOW, &term); tcsetattr(0, TCSANOW, &term);
#endif
/* now ncurses init stuff... */ /* now ncurses init stuff... */
initscr(); initscr();
@ -1886,6 +1888,12 @@ int main(int argc, char *argv[])
reset_cursor(); reset_cursor();
while (1) { while (1) {
#ifndef _POSIX_VDISABLE
/* We're going to have to do it the old way, i.e. on cygwin */
raw();
#endif
kbinput = wgetch(edit); kbinput = wgetch(edit);
if (kbinput == 27) { /* Grab Alt-key stuff first */ if (kbinput == 27) { /* Grab Alt-key stuff first */
switch (kbinput = wgetch(edit)) { switch (kbinput = wgetch(edit)) {
@ -1981,6 +1989,19 @@ int main(int argc, char *argv[])
keyhandled = 1; keyhandled = 1;
} }
} }
#ifndef _POSIX_VDISABLE
/* Since we're in raw mode, we have to catch ^Q and ^S */
if (kbinput == 17 || kbinput == 19)
keyhandled = 1;
/* And catch ^Z by hand when triggered */
if (kbinput == 26) {
if (ISSET(SUSPEND))
do_suspend(0);
keyhandled = 1;
}
#endif
/* Last gasp, stuff that's not in the main lists */ /* Last gasp, stuff that's not in the main lists */
if (!keyhandled) if (!keyhandled)
switch (kbinput) { switch (kbinput) {

View File

@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2000-09-06 10:16-0400\n" "POT-Creation-Date: 2000-09-06 11:26-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -675,24 +675,24 @@ msgstr ""
msgid "Cannot move bottom win" msgid "Cannot move bottom win"
msgstr "" msgstr ""
#: nano.c:1850 #: nano.c:1852
msgid "Main: set up windows\n" msgid "Main: set up windows\n"
msgstr "" msgstr ""
#: nano.c:1865 #: nano.c:1867
msgid "Main: bottom win\n" msgid "Main: bottom win\n"
msgstr "" msgstr ""
#: nano.c:1871 #: nano.c:1873
msgid "Main: open file\n" msgid "Main: open file\n"
msgstr "" msgstr ""
#: nano.c:1939 #: nano.c:1947
#, c-format #, c-format
msgid "I got Alt-[-%c! (%d)\n" msgid "I got Alt-[-%c! (%d)\n"
msgstr "" msgstr ""
#: nano.c:1965 #: nano.c:1973
#, c-format #, c-format
msgid "I got Alt-%c! (%d)\n" msgid "I got Alt-%c! (%d)\n"
msgstr "" msgstr ""