update for HEAD-2003091401
[reactos.git] / lib / crtdll / conio / ungetch.c
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  *              Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details 
4  * PROJECT:     ReactOS system libraries
5  * FILE:        lib/crtdll/conio/ungetch.c
6  * PURPOSE:     Ungets a character from stdin
7  * PROGRAMER:   DJ Delorie
8                 Boudewijn Dekker [ Adapted from djgpp libc ]
9  * UPDATE HISTORY:
10  *              28/12/98: Created
11  */
12
13 #include <msvcrt/conio.h>
14 #include <msvcrt/internal/console.h>
15
16 #define EOF -1
17
18 int char_avail = 0;
19 int ungot_char = 0;
20
21
22 /*
23  * @implemented
24  */
25 int _ungetch(int c)
26 {
27   if (char_avail)
28     return(EOF);
29   ungot_char = c;
30   char_avail = 1;
31   return(c);
32 }