Create a branch for network fixes.

svn path=/branches/aicom-network-fixes/; revision=34994
This commit is contained in:
Art Yerkes 2008-08-01 11:32:26 +00:00
parent 0e213bbc00
commit c501d8112c
18148 changed files with 0 additions and 860488 deletions

73
lib/sdk/crt/conio/cgets.c Normal file
View file

@ -0,0 +1,73 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: msvcrt/conio/cgets.c
* PURPOSE: C Runtime
* PROGRAMMER: Eric Kohl (Imported from DJGPP)
*/
#include <precomp.h>
/*
* @implemented
*/
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();
/*
* shold 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++;
}
}
sp[maxlen_wanted-1] = '\0';
string[1] = (char)((unsigned char)len);
return(sp);
}

View file

@ -0,0 +1,36 @@
/*
* COPYRIGHT: Winehq
* PROJECT: wine
* FILE: msvcrt/conio/cprintf.c
* PURPOSE: C Runtime
* PROGRAMMER: Magnus Olsen (Imported from wine cvs 2006-05-23)
*/
#include <precomp.h>
/*
* @implemented
*/
int
_cprintf(const char *fmt, ...)
{
char buf[2048], *mem = buf;
int written, resize = sizeof(buf), retval;
va_list valist;
while ((written = _vsnprintf( mem, resize, fmt, valist )) == -1 ||
written > resize)
{
resize = (written == -1 ? resize * 2 : written + 1);
if (mem != buf)
free (mem);
if (!(mem = (char *)malloc(resize)))
return EOF;
va_start( valist, fmt );
}
va_end(valist);
retval = _cputs( mem );
if (mem != buf)
free (mem);
return retval;
}

35
lib/sdk/crt/conio/cputs.c Normal file
View file

@ -0,0 +1,35 @@
/*
* COPYRIGHT: LGPL - See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/msvcrt/conio/cputs.c
* PURPOSE: Writes a character to stdout
* PROGRAMER: Aleksey Bragin
*/
#include <precomp.h>
extern FDINFO *fdesc;
/*
* @implemented
*/
int _cputs(const char *_str)
{
#if 0
DWORD count;
int retval = EOF;
LOCK_CONSOLE;
if (WriteConsoleA(console_out, str, strlen(str), &count, NULL)
&& count == 1)
retval = 0;
UNLOCK_CONSOLE;
return retval;
#else
int len = strlen(_str);
DWORD written = 0;
if (!WriteFile( fdesc[stdout->_file].hFile ,_str,len,&written,NULL))
return -1;
return 0;
#endif
}

55
lib/sdk/crt/conio/getch.c Normal file
View file

@ -0,0 +1,55 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/msvcrt/conio/getch.c
* PURPOSE: Writes a character to stdout
* PROGRAMER: Ariadne
* UPDATE HISTORY:
* 28/12/98: Created
*/
#include <precomp.h>
/*
* @implemented
*/
int _getch(void)
{
DWORD NumberOfCharsRead = 0;
char c;
HANDLE ConsoleHandle;
BOOL RestoreMode;
DWORD ConsoleMode;
if (char_avail) {
c = ungot_char;
char_avail = 0;
} else {
/*
* _getch() is documented to NOT echo characters. Testing shows it
* doesn't wait for a CR either. So we need to switch off
* ENABLE_ECHO_INPUT and ENABLE_LINE_INPUT if they're currently
* switched on.
*/
ConsoleHandle = (HANDLE) _get_osfhandle(stdin->_file);
RestoreMode = GetConsoleMode(ConsoleHandle, &ConsoleMode) &&
(0 != (ConsoleMode &
(ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT)));
if (RestoreMode) {
SetConsoleMode(ConsoleHandle,
ConsoleMode & (~ (ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT)));
}
ReadConsoleA((HANDLE)_get_osfhandle(stdin->_file),
&c,
1,
&NumberOfCharsRead,
NULL);
if (RestoreMode) {
SetConsoleMode(ConsoleHandle, ConsoleMode);
}
}
if (c == 10)
c = 13;
return c;
}

View file

@ -0,0 +1,29 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* 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
* UPDATE HISTORY:
* 28/12/98: Created
*/
#include <precomp.h>
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());
return (_putch(_getch()));
}

30
lib/sdk/crt/conio/kbhit.c Normal file
View file

@ -0,0 +1,30 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/msvcrt/conio/kbhit.c
* PURPOSE: Checks for keyboard hits
* PROGRAMER: Ariadne
* UPDATE HISTORY:
* 28/12/98: Created
*/
#include <precomp.h>
/*
* FIXME PeekConsoleInput returns more than keyboard hits
*
* @unimplemented
*/
int _kbhit(void)
{
//INPUT_RECORD InputRecord;
DWORD NumberRead=0;
if (char_avail)
return(1);
else {
//FIXME PeekConsoleInput might do DeviceIo
//PeekConsoleInput((HANDLE)stdin->_file,&InputRecord,1,&NumberRead);
return NumberRead;
}
return 0;
}

24
lib/sdk/crt/conio/putch.c Normal file
View file

@ -0,0 +1,24 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/msvcrt/conio/putch.c
* PURPOSE: Writes a character to stdout
* PROGRAMER: Ariadne
* UPDATE HISTORY:
* 28/12/98: Created
*/
#include <precomp.h>
/*
* @implemented
*/
int _putch(int c)
{
DWORD NumberOfCharsWritten;
if (WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),&c,1,&NumberOfCharsWritten,NULL)) {
return -1;
}
return NumberOfCharsWritten;
}

View file

@ -0,0 +1,29 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* 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 ]
* UPDATE HISTORY:
* 28/12/98: Created
*/
#include <precomp.h>
int char_avail = 0;
int ungot_char = 0;
/*
* @implemented
*/
int _ungetch(int c)
{
if (char_avail)
return(EOF);
ungot_char = c;
char_avail = 1;
return(c);
}