summaryrefslogtreecommitdiff
path: root/readline/input.c
diff options
context:
space:
mode:
authorJason Molenda <jsm@bugshack.cygnus.com>1999-08-02 23:48:37 +0000
committerJason Molenda <jsm@bugshack.cygnus.com>1999-08-02 23:48:37 +0000
commit6da787a878c938e680f13808dee254beacefbd43 (patch)
tree7c7b4d4f6655b210e33ca51f656f4552c9326ed3 /readline/input.c
parent1392c9fbbf6fe8811e5374356b7fdf3b389068ab (diff)
downloadgdb-6da787a878c938e680f13808dee254beacefbd43.tar.gz
import gdb-1999-08-02 snapshot
Diffstat (limited to 'readline/input.c')
-rw-r--r--readline/input.c66
1 files changed, 38 insertions, 28 deletions
diff --git a/readline/input.c b/readline/input.c
index 7e3c0feb5ce..3b48483d262 100644
--- a/readline/input.c
+++ b/readline/input.c
@@ -124,38 +124,13 @@ _rl_any_typein ()
return any_typein;
}
-/* Add KEY to the buffer of characters to be read. */
-int
-rl_stuff_char (key)
- int key;
-{
- if (key == EOF)
- {
- key = NEWLINE;
- rl_pending_input = EOF;
- }
- ibuffer[push_index++] = key;
- if (push_index >= ibuffer_len)
- push_index = 0;
- return push_index;
-}
-
-/* Make C be the next command to be executed. */
-int
-rl_execute_next (c)
- int c;
-{
- rl_pending_input = c;
- return 0;
-}
-
-/* Return the amount of space available in the
- buffer for stuffing characters. */
+/* Return the amount of space available in the buffer for stuffing
+ characters. */
static int
ibuffer_space ()
{
if (pop_index > push_index)
- return (pop_index - push_index);
+ return (pop_index - push_index - 1);
else
return (ibuffer_len - (push_index - pop_index));
}
@@ -341,6 +316,36 @@ _rl_insert_typein (c)
free (string);
}
+/* Add KEY to the buffer of characters to be read. Returns 1 if the
+ character was stuffed correctly; 0 otherwise. */
+int
+rl_stuff_char (key)
+ int key;
+{
+ if (ibuffer_space () == 0)
+ return 0;
+
+ if (key == EOF)
+ {
+ key = NEWLINE;
+ rl_pending_input = EOF;
+ }
+ ibuffer[push_index++] = key;
+ if (push_index >= ibuffer_len)
+ push_index = 0;
+
+ return 1;
+}
+
+/* Make C be the next command to be executed. */
+int
+rl_execute_next (c)
+ int c;
+{
+ rl_pending_input = c;
+ return 0;
+}
+
/* **************************************************************** */
/* */
/* Character Input */
@@ -409,6 +414,11 @@ rl_getc (stream)
if (result == 0)
return (EOF);
+#if defined (__BEOS__)
+ if (errno == EINTR)
+ continue;
+#endif
+
#if defined (EWOULDBLOCK)
if (errno == EWOULDBLOCK)
{