update for HEAD-2003021201
[reactos.git] / lib / msvcrt / 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/msvcrt/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 int _ungetch(int c)
23 {
24   if (char_avail)
25     return(EOF);
26   ungot_char = c;
27   char_avail = 1;
28   return(c);
29 }