summaryrefslogtreecommitdiff
path: root/readline/input.c
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2000-07-09 17:20:00 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2000-07-09 17:20:00 +0000
commit8768631c3f588dcf633777d9ee2a5afa852cd6a6 (patch)
tree2f7c979cc5e579afa2054da011a8a89e3a2a582a /readline/input.c
parentbabf87273e5ffa8a82347d01ab0e6424efa799ad (diff)
downloadgdb-8768631c3f588dcf633777d9ee2a5afa852cd6a6.tar.gz
readline:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com> * Import of readline 4.1. Locally modified files: Makefile.in, configure.in, configure (regenerated), config.h.in (regenerated), readline.h, rltty.c, shell.c signals.c. Locally added files: acconfig.h, config/*, config.h.bot, cross-build/*, doc/inc-hit.texinfo. New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h. examples: 2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com> * Import of readline 4.1. New files: excallback.c, rlfe.c. doc: 2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com> * Import of readline 4.1. Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for inclusion in the gdb manual. New file: rluserman.texinfo
Diffstat (limited to 'readline/input.c')
-rw-r--r--readline/input.c92
1 files changed, 21 insertions, 71 deletions
diff --git a/readline/input.c b/readline/input.c
index a8ba23c3c43..64a55c6f90d 100644
--- a/readline/input.c
+++ b/readline/input.c
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -67,39 +67,15 @@ extern int errno;
/* Some standard library routines. */
#include "readline.h"
+#include "rlprivate.h"
+#include "rlshell.h"
+#include "xmalloc.h"
+
/* What kind of non-blocking I/O do we have? */
#if !defined (O_NDELAY) && defined (O_NONBLOCK)
# define O_NDELAY O_NONBLOCK /* Posix style */
#endif
-/* Functions imported from other files in the library. */
-extern char *xmalloc (), *xrealloc ();
-
-/* Variables and functions from macro.c. */
-extern void _rl_add_macro_char ();
-extern void _rl_with_macro_input ();
-extern int _rl_next_macro_key ();
-extern int _rl_defining_kbd_macro;
-
-#if defined (VI_MODE)
-extern void _rl_vi_set_last ();
-extern int _rl_vi_textmod_command ();
-#endif /* VI_MODE */
-
-extern FILE *rl_instream, *rl_outstream;
-extern Function *rl_last_func;
-extern int rl_key_sequence_length;
-extern int rl_pending_input;
-extern int rl_editing_mode;
-
-extern Keymap _rl_keymap;
-
-extern int _rl_convert_meta_chars_to_ascii;
-
-#if defined (__GO32__) && !defined (HAVE_SELECT)
-# include <pc.h>
-#endif /* __GO32__ */
-
/* Non-null means it is a pointer to a function to run while waiting for
character input. */
Function *rl_event_hook = (Function *)NULL;
@@ -176,17 +152,6 @@ rl_unget_char (key)
static void
rl_gather_tyi ()
{
-#if defined (__GO32__) && !defined (HAVE_SELECT)
- char input;
-
- if (isatty (0) && kbhit () && ibuffer_space ())
- {
- int i;
- i = (*rl_getc_function) (rl_instream);
- rl_stuff_char (i);
- }
-#else /* !__GO32__ */
-
int tty;
register int tem, result;
int chars_avail;
@@ -255,7 +220,6 @@ rl_gather_tyi ()
if (chars_avail)
rl_stuff_char (input);
}
-#endif /* !__GO32__ */
}
/* Is there input available to be read on the readline input file
@@ -394,14 +358,9 @@ int
rl_getc (stream)
FILE *stream;
{
- int result, flags;
+ int result;
unsigned char c;
-#if defined (__GO32__) && !defined (HAVE_TERMIOS_H)
- if (isatty (0))
- return (getkey () & 0x7F);
-#endif /* __GO32__ */
-
while (1)
{
result = read (fileno (stream), &c, sizeof (unsigned char));
@@ -420,40 +379,31 @@ rl_getc (stream)
#endif
#if defined (EWOULDBLOCK)
- if (errno == EWOULDBLOCK)
+# define X_EWOULDBLOCK EWOULDBLOCK
+#else
+# define X_EWOULDBLOCK -99
+#endif
+
+#if defined (EAGAIN)
+# define X_EAGAIN EAGAIN
+#else
+# define X_EAGAIN -99
+#endif
+
+ if (errno == X_EWOULDBLOCK || errno == X_EAGAIN)
{
- if ((flags = fcntl (fileno (stream), F_GETFL, 0)) < 0)
+ if (unset_nodelay_mode (fileno (stream)) < 0)
return (EOF);
- if (flags & O_NDELAY)
- {
- flags &= ~O_NDELAY;
- fcntl (fileno (stream), F_SETFL, flags);
- continue;
- }
continue;
}
-#endif /* EWOULDBLOCK */
-#if defined (_POSIX_VERSION) && defined (EAGAIN) && defined (O_NONBLOCK)
- if (errno == EAGAIN)
- {
- if ((flags = fcntl (fileno (stream), F_GETFL, 0)) < 0)
- return (EOF);
- if (flags & O_NONBLOCK)
- {
- flags &= ~O_NONBLOCK;
- fcntl (fileno (stream), F_SETFL, flags);
- continue;
- }
- }
-#endif /* _POSIX_VERSION && EAGAIN && O_NONBLOCK */
+#undef X_EWOULDBLOCK
+#undef X_EAGAIN
-#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
/* 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__ */
}
}