xref: /reactos/sdk/lib/crt/conio/ungetch.c (revision 5100859e)
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/sdk/crt/conio/ungetch.c
6  * PURPOSE:     Ungets a character from stdin
7  * PROGRAMER:   DJ Delorie
8 		Ariadne [ Adapted from djgpp libc ]
9  * UPDATE HISTORY:
10  *              28/12/98: Created
11  */
12 
13 #include <precomp.h>
14 
15 int char_avail = 0;
16 int ungot_char = 0;
17 
18 
19 /*
20  * @implemented
21  */
22 int _ungetch(int c)
23 {
24   if (char_avail)
25     return(EOF);
26   ungot_char = c;
27   char_avail = 1;
28   return(c);
29 }
30