DTRT if OF_read() returns 0 when no data is available.
This commit is contained in:
parent
d8615e4fb9
commit
37cb09ba66
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: Locore.c,v 1.1 1997/04/16 20:29:11 thorpej Exp $ */
|
||||
/* $NetBSD: Locore.c,v 1.2 1997/04/28 18:36:31 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
@ -465,11 +465,11 @@ putchar(c)
|
||||
int
|
||||
getchar()
|
||||
{
|
||||
unsigned char ch;
|
||||
unsigned char ch = '\0';
|
||||
int l;
|
||||
|
||||
while ((l = OF_read(stdin, &ch, 1)) != 1)
|
||||
if (l != -2)
|
||||
if (l != -2 && l != 0)
|
||||
return -1;
|
||||
return ch;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: netif_of.c,v 1.1 1997/04/16 20:29:19 thorpej Exp $ */
|
||||
/* $NetBSD: netif_of.c,v 1.2 1997/04/28 18:36:35 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995 Wolfgang Solfrank.
|
||||
@ -212,7 +212,8 @@ netif_get(desc, pkt, maxlen, timo)
|
||||
|
||||
do {
|
||||
len = OF_read(op->handle, pkt, maxlen);
|
||||
} while ((len == -2) && ((OF_milliseconds() - tick0) < tmo_ms));
|
||||
} while ((len == -2 || len == 0) &&
|
||||
(OF_milliseconds() - tick0 < tmo_ms));
|
||||
|
||||
#ifdef NETIF_DEBUG
|
||||
printf("netif_get: received len=%d\n", len);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: Locore.c,v 1.1 1997/04/16 20:29:11 thorpej Exp $ */
|
||||
/* $NetBSD: Locore.c,v 1.2 1997/04/28 18:36:31 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
@ -465,11 +465,11 @@ putchar(c)
|
||||
int
|
||||
getchar()
|
||||
{
|
||||
unsigned char ch;
|
||||
unsigned char ch = '\0';
|
||||
int l;
|
||||
|
||||
while ((l = OF_read(stdin, &ch, 1)) != 1)
|
||||
if (l != -2)
|
||||
if (l != -2 && l != 0)
|
||||
return -1;
|
||||
return ch;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: netif_of.c,v 1.1 1997/04/16 20:29:19 thorpej Exp $ */
|
||||
/* $NetBSD: netif_of.c,v 1.2 1997/04/28 18:36:35 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995 Wolfgang Solfrank.
|
||||
@ -212,7 +212,8 @@ netif_get(desc, pkt, maxlen, timo)
|
||||
|
||||
do {
|
||||
len = OF_read(op->handle, pkt, maxlen);
|
||||
} while ((len == -2) && ((OF_milliseconds() - tick0) < tmo_ms));
|
||||
} while ((len == -2 || len == 0) &&
|
||||
(OF_milliseconds() - tick0 < tmo_ms));
|
||||
|
||||
#ifdef NETIF_DEBUG
|
||||
printf("netif_get: received len=%d\n", len);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ofcons.c,v 1.4 1997/04/16 23:32:56 thorpej Exp $ */
|
||||
/* $NetBSD: ofcons.c,v 1.5 1997/04/28 18:33:57 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
@ -311,11 +311,11 @@ int
|
||||
ofccngetc(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
unsigned char ch;
|
||||
unsigned char ch = '\0';
|
||||
int l;
|
||||
|
||||
while ((l = OF_read(stdin, &ch, 1)) != 1)
|
||||
if (l != -2)
|
||||
if (l != -2 && l != 0)
|
||||
return -1;
|
||||
return ch;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user