summaryrefslogtreecommitdiff
path: root/term
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-12-01 22:13:37 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-12-01 22:13:37 +0000
commit4e96149e37ad7f3d95b418e4ae58f3312593f80a (patch)
tree6c90456f1cd21384621ed946810c3d89a87b4eb8 /term
parent3b608f919695a02dc34e21089b69d30d3c856982 (diff)
(trivfs_S_io_read): If remote_input_mode, copy characters without
interpretation; treat last character left in queue as junk.
Diffstat (limited to 'term')
-rw-r--r--term/users.c59
1 files changed, 36 insertions, 23 deletions
diff --git a/term/users.c b/term/users.c
index 6fb14206..b17209b9 100644
--- a/term/users.c
+++ b/term/users.c
@@ -432,6 +432,7 @@ trivfs_S_io_read (struct trivfs_protid *cred,
int cancel;
int i, max;
char *cp;
+ int avail;
if (!cred)
return EOPNOTSUPP;
@@ -473,7 +474,11 @@ trivfs_S_io_read (struct trivfs_protid *cred,
}
}
- max = (amount < qsize (inputq)) ? amount : qsize (inputq);
+ avail = qsize (inputq);
+ if (remote_input_mode)
+ avail--;
+
+ max = (amount < avail) ? amount : avail;
if (max > *datalen)
vm_allocate (mach_task_self (), (vm_address_t *)data, max, 1);
@@ -484,32 +489,40 @@ trivfs_S_io_read (struct trivfs_protid *cred,
{
char c = dequeue (inputq);
- /* Unless this is EOF, add it to the response. */
- if (!(termstate.c_lflag & ICANON)
- || !CCEQ (termstate.c_cc[VEOF], c))
- *cp++ = c;
-
- /* If this is a break character, then finish now. */
- if ((termstate.c_lflag & ICANON)
- && (c == '\n'
- || CCEQ (termstate.c_cc[VEOF], c)
- || CCEQ (termstate.c_cc[VEOL], c)
- || CCEQ (termstate.c_cc[VEOL2], c)))
- break;
-
- /* If this is the delayed suspend character, then signal now. */
- if ((termstate.c_lflag & ISIG)
- && CCEQ (termstate.c_cc[VDSUSP], c))
+ if (remote_input_mode)
+ *cp++;
+ else
{
- /* The CANCEL flag is being used here to tell the return
- below to make sure we don't signal EOF on a VDUSP that
- happens at the front of a line. */
- send_signal (SIGTSTP);
- cancel = 1;
- break;
+ /* Unless this is EOF, add it to the response. */
+ if (!(termstate.c_lflag & ICANON)
+ || !CCEQ (termstate.c_cc[VEOF], c))
+ *cp++ = c;
+
+ /* If this is a break character, then finish now. */
+ if ((termstate.c_lflag & ICANON)
+ && (c == '\n'
+ || CCEQ (termstate.c_cc[VEOF], c)
+ || CCEQ (termstate.c_cc[VEOL], c)
+ || CCEQ (termstate.c_cc[VEOL2], c)))
+ break;
+
+ /* If this is the delayed suspend character, then signal now. */
+ if ((termstate.c_lflag & ISIG)
+ && CCEQ (termstate.c_cc[VDSUSP], c))
+ {
+ /* The CANCEL flag is being used here to tell the return
+ below to make sure we don't signal EOF on a VDUSP that
+ happens at the front of a line. */
+ send_signal (SIGTSTP);
+ cancel = 1;
+ break;
+ }
}
}
+ if (remote_input_mode && qsize (inputq) == 1)
+ dequeue (inputq);
+
*datalen = cp - *data;
mutex_unlock (&global_lock);