:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[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 <crtdll/process.h>
14 #define EOF -1
15
16 int char_avail = 0;
17 char ungot_char = 0;
18
19
20 int
21 _ungetch(int c)
22 {
23   if (char_avail)
24     return(EOF);
25   ungot_char = c;
26   char_avail = 1;
27   return(c);
28 }