From c2464bf24a66b275b249a52bc495963fceb6e7b9 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Thu, 24 Oct 2019 21:31:51 +0200 Subject: [PATCH] core: current_input_port: Prepare for M2-Planet. * src/posix.c (current_input_port): Prepare for M2-Planet. --- src/posix.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/posix.c b/src/posix.c index e41e257b..92891745 100644 --- a/src/posix.c +++ b/src/posix.c @@ -197,8 +197,12 @@ current_input_port () if (__stdin >= 0) return make_number (__stdin); SCM x = g_ports; - while (x && PORT (CAR (x)) != __stdin) - x = CDR (x); + while (x) + { + if (PORT (CAR (x)) == __stdin) + return CAR (x); + x = CDR (x); + } return CAR (x); }