Index: lib/sdk/crt/conio/cgets.c =================================================================== --- lib/sdk/crt/conio/cgets.c (revision 64237) +++ lib/sdk/crt/conio/cgets.c (working copy) @@ -13,61 +13,61 @@ */ char *_cgets(char *string) { - unsigned len = 0; - unsigned int maxlen_wanted; - char *sp; - int c; - /* - * Be smart and check for NULL pointer. - * Don't know wether TURBOC does this. - */ - if (!string) - return(NULL); - maxlen_wanted = (unsigned int)((unsigned char)string[0]); - sp = &(string[2]); - /* - * Should the string be shorter maxlen_wanted including or excluding - * the trailing '\0' ? We don't take any risk. - */ - while(len < maxlen_wanted-1) - { - c=_getch(); + unsigned len = 0; + unsigned int maxlen_wanted; + char *sp; + int c; /* - * shold we check for backspace here? - * TURBOC does (just checked) but doesn't in cscanf (thats harder - * or even impossible). We do the same. + * Be smart and check for NULL pointer. + * Don't know whether TURBOC does this. */ - if (c == '\b') + if (!string) + return(NULL); + maxlen_wanted = (unsigned int)((unsigned char)string[0]); + sp = &(string[2]); + /* + * Should the string be shorter maxlen_wanted including or excluding + * the trailing '\0' ? We don't take any risk. + */ + while(len < maxlen_wanted-1) { - if (len > 0) - { - _cputs("\b \b"); /* go back, clear char on screen with space - and go back again */ - len--; - sp[len] = '\0'; /* clear the character in the string */ - } + c=_getch(); + /* + * Should we check for backspace here? + * TURBOC does (just checked) but doesn't in cscanf (thats harder + * or even impossible). We do the same. + */ + if (c == '\b') + { + if (len > 0) + { + _cputs("\b \b"); /* go back, clear char on screen with space + and go back again */ + len--; + sp[len] = '\0'; /* clear the character in the string */ + } + } + else if (c == '\r') + { + sp[len] = '\0'; + break; + } + else if (c == 0) + { + /* special character ends input */ + sp[len] = '\0'; + _ungetch(c); /* keep the char for later processing */ + break; + } + else + { + sp[len] = _putch(c); + len++; + } } - else if (c == '\r') - { - sp[len] = '\0'; - break; - } - else if (c == 0) - { - /* special character ends input */ - sp[len] = '\0'; - _ungetch(c); /* keep the char for later processing */ - break; - } - else - { - sp[len] = _putch(c); - len++; - } - } - sp[maxlen_wanted-1] = '\0'; - string[1] = (char)((unsigned char)len); - return(sp); + sp[maxlen_wanted-1] = '\0'; + string[1] = (char)((unsigned char)len); + return(sp); } Index: lib/sdk/crt/conio/cputs.c =================================================================== --- lib/sdk/crt/conio/cputs.c (revision 64237) +++ lib/sdk/crt/conio/cputs.c (working copy) @@ -13,14 +13,14 @@ */ int _cputs(const char *_str) { - DWORD count; - int retval = EOF; - HANDLE console_out = GetStdHandle(STD_OUTPUT_HANDLE); + DWORD count; + int retval = EOF; + HANDLE console_out = GetStdHandle(STD_OUTPUT_HANDLE); - //LOCK_CONSOLE; - if (WriteConsoleA(console_out, _str, strlen(_str), &count, NULL) - && count == 1) - retval = 0; - //UNLOCK_CONSOLE; - return retval; + //LOCK_CONSOLE; + if (WriteConsoleA(console_out, _str, strlen(_str), &count, NULL) + && count == 1) + retval = 0; + //UNLOCK_CONSOLE; + return retval; } Index: lib/sdk/crt/conio/getch.c =================================================================== --- lib/sdk/crt/conio/getch.c (revision 64237) +++ lib/sdk/crt/conio/getch.c (working copy) @@ -40,10 +40,10 @@ ConsoleMode & (~ (ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT))); } ReadConsoleA((HANDLE)_get_osfhandle(stdin->_file), - &c, - 1, - &NumberOfCharsRead, - NULL); + &c, + 1, + &NumberOfCharsRead, + NULL); if (RestoreMode) { SetConsoleMode(ConsoleHandle, ConsoleMode); } Index: lib/sdk/crt/conio/getche.c =================================================================== --- lib/sdk/crt/conio/getche.c (revision 64237) +++ lib/sdk/crt/conio/getche.c (working copy) @@ -1,11 +1,11 @@ /* * COPYRIGHT: See COPYING in the top level directory - * Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details + * Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details * PROJECT: ReactOS system libraries * FILE: lib/msvcrt/conio/getche.c * PURPOSE: Reads a character from stdin * PROGRAMER: DJ Delorie - Ariadne + Ariadne * UPDATE HISTORY: * 28/12/98: Created */ @@ -14,16 +14,16 @@ int _getche(void) { - if (char_avail) - /* - * We don't know, wether the ungot char was already echoed - * we assume yes (for example in cscanf, probably the only - * place where ungetch is ever called. - * There is no way to check for this really, because - * ungetch could have been called with a character that - * hasn't been got by a conio function. - * We don't echo again. - */ - return(_getch()); + if (char_avail) + /* + * We don't know, wether the ungot char was already echoed + * we assume yes (for example in cscanf, probably the only + * place where ungetch is ever called. + * There is no way to check for this really, because + * ungetch could have been called with a character that + * hasn't been got by a conio function. + * We don't echo again. + */ + return(_getch()); return (_putch(_getch())); } Index: lib/sdk/crt/conio/kbhit.c =================================================================== --- lib/sdk/crt/conio/kbhit.c (revision 64237) +++ lib/sdk/crt/conio/kbhit.c (working copy) @@ -12,7 +12,7 @@ #include static CRITICAL_SECTION CriticalSection; -volatile BOOL CriticalSectionInitialized=FALSE; +volatile BOOL CriticalSectionInitialized = FALSE; /* * @implemented Index: lib/sdk/crt/conio/putch.c =================================================================== --- lib/sdk/crt/conio/putch.c (revision 64237) +++ lib/sdk/crt/conio/putch.c (working copy) @@ -15,10 +15,10 @@ */ int _putch(int c) { - DWORD NumberOfCharsWritten; + DWORD NumberOfCharsWritten; - if (WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),&c,1,&NumberOfCharsWritten,NULL)) { - return -1; - } - return NumberOfCharsWritten; + if (WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), &c, 1, &NumberOfCharsWritten, NULL)) { + return -1; + } + return NumberOfCharsWritten; } Index: lib/sdk/crt/conio/ungetch.c =================================================================== --- lib/sdk/crt/conio/ungetch.c (revision 64237) +++ lib/sdk/crt/conio/ungetch.c (working copy) @@ -1,11 +1,11 @@ /* * COPYRIGHT: See COPYING in the top level directory - * Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details + * Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details * PROJECT: ReactOS system libraries * FILE: lib/msvcrt/conio/ungetch.c * PURPOSE: Ungets a character from stdin * PROGRAMER: DJ Delorie - Ariadne [ Adapted from djgpp libc ] + Ariadne [ Adapted from djgpp libc ] * UPDATE HISTORY: * 28/12/98: Created */ @@ -21,9 +21,9 @@ */ int _ungetch(int c) { - if (char_avail) - return(EOF); - ungot_char = c; - char_avail = 1; - return(c); + if (char_avail) + return(EOF); + ungot_char = c; + char_avail = 1; + return(c); }