From 1475df2aa4836d09159e8e98d0ba525870b26832 Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 11 Feb 2017 18:05:28 +0100 Subject: [PATCH] input.c, try to work around microsofts broken _read() concerning the visual sudio variant of the "console" build. Their _read() returns 0 when a linfeed is read. Ironically the linefeed seems to be stored into the buffer nontheless. Because the filehandle is in linebuffered mode anyway, (the read won't return up until the terminating newline is entered) we can just as well use getc(), which doesn't seem to suffer from the same problem in their implementation. --- src/frontend/parser/input.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/frontend/parser/input.c b/src/frontend/parser/input.c index 1af5553bf..3f6175f63 100644 --- a/src/frontend/parser/input.c +++ b/src/frontend/parser/input.c @@ -14,13 +14,6 @@ Author: 1988 Jeffrey M. Hsu #include "input.h" #include "ngspice/cpextern.h" #include "../display.h" -#ifdef _MSC_VER -#include "BaseTsd.h" /* for SSIZE_T */ -#define ssize_t SSIZE_T -#ifndef HAS_WINGUI -#define read _read /* only for console */ -#endif -#endif /* A special 'getc' so that we can deal with ^D properly. There is no way for @@ -32,7 +25,7 @@ int inchar(FILE *fp) { -#ifndef HAS_WINGUI +#if !(defined(HAS_WINGUI) || defined(_MSC_VER) && defined(CONSOLE)) if (cp_interactive && !cp_nocc) { char c; ssize_t i;