comparison src/keyboard.c @ 6963:67b16a9f7e5d

(read_avail_input): Write loop as a do-while.
author Karl Heuer <kwzh@gnu.org>
date Tue, 19 Apr 1994 05:52:58 +0000
parents 5538df04e96a
children 5e9dfb3a11df
comparison
equal deleted inserted replaced
6962:8505df26e31d 6963:67b16a9f7e5d
3337 #endif 3337 #endif
3338 #endif /* not MSDOS */ 3338 #endif /* not MSDOS */
3339 3339
3340 /* Now read; for one reason or another, this will not block. 3340 /* Now read; for one reason or another, this will not block.
3341 NREAD is set to the number of chars read. */ 3341 NREAD is set to the number of chars read. */
3342 while (1) 3342 do
3343 { 3343 {
3344 #ifdef MSDOS 3344 #ifdef MSDOS
3345 cbuf[0] = dos_keyread(); 3345 cbuf[0] = dos_keyread();
3346 nread = 1; 3346 nread = 1;
3347 #else 3347 #else
3354 and that causes a value other than 0 when there is no input. */ 3354 and that causes a value other than 0 when there is no input. */
3355 if (nread == 0) 3355 if (nread == 0)
3356 kill (0, SIGHUP); 3356 kill (0, SIGHUP);
3357 #endif 3357 #endif
3358 /* Retry the read if it was interrupted. */ 3358 /* Retry the read if it was interrupted. */
3359 if (nread >= 0 3359 }
3360 || ! (errno == EAGAIN 3360 while (nread < 0 && (errno == EAGAIN
3361 #ifdef EFAULT 3361 #ifdef EFAULT
3362 || errno == EFAULT 3362 || errno == EFAULT
3363 #endif 3363 #endif
3364 #ifdef EBADSLT 3364 #ifdef EBADSLT
3365 || errno == EBADSLT 3365 || errno == EBADSLT
3366 #endif 3366 #endif
3367 )) 3367 ));
3368 break;
3369 }
3370 3368
3371 #ifndef FIONREAD 3369 #ifndef FIONREAD
3372 #if defined (USG) || defined (DGUX) 3370 #if defined (USG) || defined (DGUX)
3373 fcntl (fileno (stdin), F_SETFL, 0); 3371 fcntl (fileno (stdin), F_SETFL, 0);
3374 #endif /* USG or DGUX */ 3372 #endif /* USG or DGUX */