From 51899dfaded2e424c2bb92390c48131c30202494 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Thu, 11 Oct 2007 18:40:29 +0000 Subject: 2007-10-11 Jesper Nilsson * callback.c (cb_is_stdin): Add. * syscall.c (cb_syscall): Test for stdin, not just fd 0. 2007-10-11 Jesper Nilsson * callback.h (cb_is_stdin): Add prototype. --- sim/common/ChangeLog | 5 +++++ sim/common/callback.c | 7 +++++++ sim/common/syscall.c | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'sim') diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index b31a19e9f0f..bd09a5c5366 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,8 @@ +2007-10-11 Jesper Nilsson + + * callback.c (cb_is_stdin): Add. + * syscall.c (cb_syscall): Test for stdin, not just fd 0. + 2007-08-10 Nick Clifton * sim-memopt.c (memory_options): Mention that the diff --git a/sim/common/callback.c b/sim/common/callback.c index fec1d148874..f83dd547c22 100644 --- a/sim/common/callback.c +++ b/sim/common/callback.c @@ -1136,3 +1136,10 @@ sim_cb_eprintf (host_callback *p, const char *fmt, ...) p->evprintf_filtered (p, fmt, ap); va_end (ap); } + +int +cb_is_stdin (host_callback *cb, int fd) +{ + return fdbad (cb, fd) ? 0 : fdmap (cb, fd) == 0; +} + diff --git a/sim/common/syscall.c b/sim/common/syscall.c index 379f7e16df1..a3e7560bf48 100644 --- a/sim/common/syscall.c +++ b/sim/common/syscall.c @@ -291,7 +291,7 @@ cb_syscall (cb, sc) while (count > 0) { - if (fd == 0) + if (cb_is_stdin (cb, fd)) result = (int) (*cb->read_stdin) (cb, buf, (count < FILE_XFR_SIZE ? count : FILE_XFR_SIZE)); -- cgit v1.2.1