:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / lib / crtdll / conio / getche.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/getche.c
6  * PURPOSE:     Reads a character from stdin
7  * PROGRAMER:   DJ Delorie
8                                 Boudewijn Dekker
9  * UPDATE HISTORY:
10  *              28/12/98: Created
11  */
12
13 #include <crtdll/process.h>
14 #include <crtdll/conio.h>
15
16
17 extern int char_avail;
18 int
19 getche(void)
20 {
21   if (char_avail)
22     /*
23      * We don't know, wether the ungot char was already echoed
24      * we assume yes (for example in cscanf, probably the only
25      * place where ungetch is ever called.
26      * There is no way to check for this really, because
27      * ungetch could have been called with a character that
28      * hasn't been got by a conio function.
29      * We don't echo again.
30      */ 
31     return(getch());
32   return (_putch(getch()));
33 }