#define HAVE_BSD_SIGNALS
/* #define USE_XON_XOFF */
+#ifdef __MSDOS__
+#undef NEW_TTY_DRIVER
+#undef HAVE_BSD_SIGNALS
+#endif
+
/* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
#if defined (USG) && !defined (hpux)
#undef HAVE_BSD_SIGNALS
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
#endif
+#ifndef __MSDOS__
/* These next are for filename completion. Perhaps this belongs
in a different place. */
#include <pwd.h>
+#endif /* __MSDOS__ */
+
#if defined (USG) && !defined (isc386) && !defined (sgi)
struct passwd *getpwuid (), *getpwent ();
#endif
/* If on, then readline handles signals in a way that doesn't screw. */
#define HANDLE_SIGNALS
+#ifdef __GO32__
+#include <pc.h>
+#undef HANDLE_SIGNALS
+#endif
+
\f
/* **************************************************************** */
/* */
and stuff it into IBUFFER. Otherwise, just return. */
rl_gather_tyi ()
{
+#ifdef __GO32__
+ char input;
+ if (isatty(0))
+ {
+ int i = rl_getc();
+ if (i != EOF)
+ rl_stuff_char(i);
+ }
+ else
+ if (kbhit() && ibuffer_space())
+ rl_stuff_char(getkey());
+#else
int tty = fileno (in_stream);
register int tem, result = -1;
long chars_avail;
if (chars_avail)
rl_stuff_char (input);
}
+#endif /* def __GO32__/else */
}
static int next_macro_key ();
equivalents, iff the characters are not bound to keymaps. */
readline_default_bindings ()
{
+#ifndef __GO32__
#if defined (NEW_TTY_DRIVER)
struct sgttyb ttybuff;
#endif /* VWERASE */
}
#endif /* !NEW_TTY_DRIVER */
+#endif /* def __GO32__ */
}
\f
of moving backwards. */
if (new + 1 < last_c_pos - new)
{
+#ifdef __MSDOS__
+ putc('\r', out_stream);
+#else
tputs (term_cr, 1, output_character_function);
+#endif
last_c_pos = 0;
}
if (to > screenheight)
return;
+#ifdef __GO32__
+ {
+ int cur_r, cur_c;
+ ScreenGetCursor(&cur_r, &cur_c);
+ ScreenSetCursor(cur_r+to-last_v_pos, cur_c);
+ }
+#else /* __GO32__ */
if ((delta = to - last_v_pos) > 0)
{
for (i = 0; i < delta; i++)
for (i = 0; i < -delta; i++)
tputs (term_up, 1, output_character_function);
}
+#endif /* __GO32__ */
last_v_pos = to; /* now to is here */
}
init_terminal_io (terminal_name)
char *terminal_name;
{
+#ifdef __GO32__
+ screenwidth = ScreenCols();
+ screenheight = ScreenRows();
+ term_cr = "\r";
+ term_im = term_ei = term_ic = term_IC = (char *)NULL;
+ term_up = term_dc = term_DC = visible_bell = (char *)NULL;
+#if defined (HACK_TERMCAP_MOTION)
+ term_forward_char = (char *)NULL;
+#endif
+ terminal_can_insert = 0;
+ return;
+#else
extern char *tgetstr ();
char *term, *buffer;
#if defined (TIOCGWINSZ)
term_DC = tgetstr ("DC", &buffer);
visible_bell = tgetstr ("vb", &buffer);
+#endif /* !__GO32__ */
}
/* A function for the use of tputs () */
delete_chars (count)
int count;
{
+#ifdef __GO32__
+ int r, c, w;
+ ScreenGetCursor(&r, &c);
+ w = ScreenCols();
+ memcpy(ScreenPrimary+r*w+c, ScreenPrimary+r*w+c+count, w-c-count);
+ memset(ScreenPrimary+r*w+w-count, 0, count*2);
+#else /* __GO32__ */
if (count > screenwidth)
return;
while (count--)
tputs (term_dc, 1, output_character_function);
}
+#endif /* __GO32__ */
}
/* Insert COUNT characters from STRING to the output stream. */
char *string;
int count;
{
+#ifdef __GO32__
+ int r, c, w;
+ ScreenGetCursor(&r, &c);
+ w = ScreenCols();
+ memcpy(ScreenPrimary+r*w+c+count, ScreenPrimary+r*w+c, w-c-count);
+ /* Print the text. */
+ output_some_chars (string, count);
+#else /* __GO32__ */
/* If IC is defined, then we do not have to "enter" insert mode. */
if (term_IC)
{
if (term_ei && *term_ei)
tputs (term_ei, 1, output_character_function);
}
+#endif /* __GO32__ */
}
/* Move the cursor back. */
{
register int i;
+#ifndef __GO32__
if (term_backspace)
for (i = 0; i < count; i++)
tputs (term_backspace, 1, output_character_function);
else
+#endif /* !__GO32__ */
for (i = 0; i < count; i++)
putc ('\b', out_stream);
}
clear_to_eol (count)
int count;
{
+#ifndef __GO32__
if (term_clreol)
{
tputs (term_clreol, 1, output_character_function);
}
else
+#endif /* !__GO32__ */
{
register int i;
static void
rl_prep_terminal ()
{
+#ifndef __GO32__
int tty = fileno (rl_instream);
#if defined (HAVE_BSD_SIGNALS)
int oldmask;
#if defined (HAVE_BSD_SIGNALS)
sigsetmask (oldmask);
#endif
+#endif /* !__GO32__ */
}
/* Restore the terminal to its original state. */
static void
rl_deprep_terminal ()
{
+#ifndef __GO32__
int tty = fileno (rl_instream);
#if defined (HAVE_BSD_SIGNALS)
int oldmask;
#if defined (HAVE_BSD_SIGNALS)
sigsetmask (oldmask);
#endif
+#endif /* !__GO32 */
}
#else /* !defined (NEW_TTY_DRIVER) */
#define VTIME VEOL
#endif
+#ifndef __GO32__
#if defined (TERMIOS_TTY_DRIVER)
static struct termios otio;
#else
static struct termio otio;
#endif /* !TERMIOS_TTY_DRIVER */
+#endif /* __GO32__ */
static void
rl_prep_terminal ()
{
+#ifndef __GO32__
int tty = fileno (rl_instream);
#if defined (TERMIOS_TTY_DRIVER)
struct termios tio;
sigsetmask (oldmask);
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
+#endif /* !__GO32__ */
}
static void
rl_deprep_terminal ()
{
+#ifndef __GO32__
int tty = fileno (rl_instream);
/* Try to keep this function from being INTerrupted. We can do it
sigsetmask (oldmask);
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
+#endif /* !__GO32__ */
}
#endif /* NEW_TTY_DRIVER */
{
if (readline_echoing_p)
{
+#ifndef __GO32__
if (prefer_visible_bell && visible_bell)
tputs (visible_bell, 1, output_character_function);
else
+#endif /* !__GO32__ */
{
fprintf (stderr, "\007");
fflush (stderr);
move_vert(curr_line);
move_cursor_relative (0, the_line); /* XXX is this right */
+#ifdef __GO32__
+ {
+ int r, c, w;
+ ScreenGetCursor(&r, &c);
+ w = ScreenCols();
+ memset(ScreenPrimary+r*w+c, 0, (w-c)*2);
+ }
+#else /* __GO32__ */
if (term_clreol)
tputs (term_clreol, 1, output_character_function);
+#endif /* __GO32__/else */
rl_forced_update_display ();
rl_display_fixed = 1;
return;
}
+#ifndef __GO32__
if (term_clrpag)
tputs (term_clrpag, 1, output_character_function);
else
+#endif /* !__GO32__ */
crlf ();
rl_forced_update_display ();
int state;
char *text;
{
+#ifdef __GO32__
+ return (char *)NULL;
+#else /* !__GO32__ */
static char *username = (char *)NULL;
static struct passwd *entry;
static int namelen, first_char, first_char_loc;
return (value);
}
+#endif /* !__GO32__ */
}
\f
/* **************************************************************** */
}
/* The last key bindings file read. */
-static char *last_readline_init_file = "~/.inputrc";
+#ifdef __MSDOS__
+static char *last_readline_init_file = "~/inputrc";
+#else
+#endif
/* Re-read the current keybindings file. */
rl_re_read_init_file (count, ignore)
int result;
unsigned char c;
+#ifdef __GO32__
+ if (isatty(0))
+ return getkey();
+#endif /* __GO32__ */
+
while (1)
{
result = read (fileno (stream), &c, sizeof (char));
if (result == 0)
return (EOF);
+#ifndef __GO32__
/* If the error that we received was SIGINT, then try again,
this is simply an interrupted system call to read ().
Otherwise, some error ocurred, also signifying EOF. */
if (errno != EINTR)
return (EOF);
+#endif /* !__GO32__ */
}
}