From 5a6242dddde4292bf2cd376372bc0f7a0f9b9cc5 Mon Sep 17 00:00:00 2001 From: Stu Grossman Date: Mon, 19 Oct 1992 23:40:36 +0000 Subject: [PATCH] * remote-hms.c, ser-go32.c, serial.h: Change from serial_timedreadchar() to new serial_readchar(). --- gdb/ChangeLog | 3 +++ gdb/remote-hms.c | 14 ++++++-------- gdb/ser-go32.c | 12 +++--------- gdb/serial.h | 4 ++-- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 21ccf6d..6c160e6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,8 @@ Mon Oct 19 15:09:57 1992 Stu Grossman (grossman at cygnus.com) + * remote-hms.c, ser-go32.c, serial.h: Change from + serial_timedreadchar() to new serial_readchar(). + * Makefile.in (HFILES): Fixup list of nm-*.h files. Add missing ones. Mon Oct 19 12:45:23 1992 Per Bothner (bothner@cygnus.com) diff --git a/gdb/remote-hms.c b/gdb/remote-hms.c index e5f1f02..cbe4748 100644 --- a/gdb/remote-hms.c +++ b/gdb/remote-hms.c @@ -251,11 +251,10 @@ int check_open() static int readchar () { - int ok; int buf; - buf = serial_timedreadchar(timeout, &ok); + buf = serial_readchar(timeout); - if (!ok) + if (buf < 0) error ("Timeout reading from remote system."); if (!quiet) @@ -267,10 +266,9 @@ readchar () static int readchar_nofail () { - int ok; int buf; - buf = serial_timedreadchar(timeout, &ok); - if (!ok) buf = 0; + buf = serial_readchar(timeout); + if (buf < 0) buf = 0; if (!quiet) printf("%c",buf); @@ -544,8 +542,8 @@ is_baudrate_right() while (1) { - serial_timedreadchar(timeout, &ok); - if (!ok) break; + ok = serial_readchar(timeout); + if (ok < 0) break; } hms_write("r",1); diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c index 3e446aa..f729d72 100644 --- a/gdb/ser-go32.c +++ b/gdb/ser-go32.c @@ -294,20 +294,14 @@ serial_open (name) } int -serial_timedreadchar (to, ok) +serial_readchar (to) int to; - int *ok; { char buf; if (dosasync_read(fd, &buf, 1, to)) - { - *ok = 1; - } + return buf; else - { - *ok = 0; - } - return buf; + return -2; /* Timeout, I guess */ } int diff --git a/gdb/serial.h b/gdb/serial.h index 796f2d2..5363929 100644 --- a/gdb/serial.h +++ b/gdb/serial.h @@ -56,9 +56,9 @@ void serial_raw PARAMS ((int fd, struct ttystate *oldstate)); void serial_normal PARAMS ((void)); /* Read one char from the serial device with -second timeout. - Return char, and set ok if ok. */ + Returns char if ok, else EOF, -2 for timeout, -3 for anything else */ -int serial_timedreadchar PARAMS ((int to, int *ok)); +int serial_readchar PARAMS ((int to)); /* Set the baudrate to the decimal value supplied, and return 1, or fail and return 0. */ -- 2.7.4