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.
This commit is contained in:
parent
2bafe98f17
commit
1475df2aa4
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue