mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 09:03:25 +00:00
Added conio functions
svn path=/trunk/; revision=2034
This commit is contained in:
parent
d46de4a28a
commit
eed177f191
21 changed files with 1989 additions and 54 deletions
67
reactos/include/msvcrt/conio.h
Normal file
67
reactos/include/msvcrt/conio.h
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
/*
|
||||||
|
* conio.h
|
||||||
|
*
|
||||||
|
* Low level console I/O functions. Pretty please try to use the ANSI
|
||||||
|
* standard ones if you are writing new code.
|
||||||
|
*
|
||||||
|
* This file is part of the Mingw32 package.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||||
|
*
|
||||||
|
* This source code is offered for use in the public domain. You may
|
||||||
|
* use, modify or distribute it freely.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful but
|
||||||
|
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||||
|
* DISCLAMED. This includes but is not limited to warranties of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* $Revision: 1.1 $
|
||||||
|
* $Author: ekohl $
|
||||||
|
* $Date: 2001/07/04 16:31:14 $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __STRICT_ANSI__
|
||||||
|
|
||||||
|
#ifndef _CONIO_H_
|
||||||
|
#define _CONIO_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
char* _cgets (char* szBuffer);
|
||||||
|
int _cprintf (const char* szFormat, ...);
|
||||||
|
int _cputs (const char* szString);
|
||||||
|
int _cscanf (char* szFormat, ...);
|
||||||
|
|
||||||
|
int _getch (void);
|
||||||
|
int _getche (void);
|
||||||
|
int _kbhit (void);
|
||||||
|
int _putch (int cPut);
|
||||||
|
int _ungetch (int cUnget);
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _NO_OLDNAMES
|
||||||
|
|
||||||
|
#define getch _getch
|
||||||
|
#define getche _getche
|
||||||
|
#define kbhit _kbhit
|
||||||
|
#define putch(cPut) _putch(cPut)
|
||||||
|
#define ungetch(cUnget) _ungetch(cUnget)
|
||||||
|
|
||||||
|
#endif /* Not _NO_OLDNAMES */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* Not _CONIO_H_ */
|
||||||
|
|
||||||
|
#endif /* Not __STRICT_ANSI__ */
|
11
reactos/include/msvcrt/internal/console.h
Normal file
11
reactos/include/msvcrt/internal/console.h
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/* console.h */
|
||||||
|
|
||||||
|
#ifndef __MSVCRT_INTERNAL_CONSOLE_H
|
||||||
|
#define __MSVCRT_INTERNAL_CONSOLE_H
|
||||||
|
|
||||||
|
extern int char_avail;
|
||||||
|
extern int ungot_char;
|
||||||
|
|
||||||
|
#endif /* __MSVCRT_INTERNAL_CONSOLE_H */
|
||||||
|
|
||||||
|
/* EOF */
|
12
reactos/include/msvcrt/internal/stdio.h
Normal file
12
reactos/include/msvcrt/internal/stdio.h
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/* stdio.h */
|
||||||
|
|
||||||
|
#ifndef __MSVCRT_INTERNAL_STDIO_H
|
||||||
|
#define __MSVCRT_INTERNAL_STDIO_H
|
||||||
|
|
||||||
|
int __vfscanf (FILE *s, const char *format, va_list argptr);
|
||||||
|
int __vscanf (const char *format, va_list arg);
|
||||||
|
int __vsscanf (const char *s,const char *format,va_list arg);
|
||||||
|
|
||||||
|
#endif /* __MSVCRT_INTERNAL_STDIO_H */
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: Makefile,v 1.12 2001/07/02 21:51:18 ekohl Exp $
|
# $Id: Makefile,v 1.13 2001/07/04 16:39:36 ekohl Exp $
|
||||||
#
|
#
|
||||||
# ReactOS Operating System
|
# ReactOS Operating System
|
||||||
#
|
#
|
||||||
|
@ -12,6 +12,17 @@ CFLAGS = -I../../include -D__MSVCRT__
|
||||||
all: $(TARGET_DLL)
|
all: $(TARGET_DLL)
|
||||||
|
|
||||||
|
|
||||||
|
OBJECTS_CONIO = \
|
||||||
|
conio/cgets.o \
|
||||||
|
conio/cprintf.o \
|
||||||
|
conio/cputs.o \
|
||||||
|
conio/cscanf.o \
|
||||||
|
conio/getch.o \
|
||||||
|
conio/getche.o \
|
||||||
|
conio/kbhit.o \
|
||||||
|
conio/putch.o \
|
||||||
|
conio/ungetch.o
|
||||||
|
|
||||||
OBJECTS_CTYPE = \
|
OBJECTS_CTYPE = \
|
||||||
ctype/isalnum.o \
|
ctype/isalnum.o \
|
||||||
ctype/isalpha.o \
|
ctype/isalpha.o \
|
||||||
|
@ -65,16 +76,30 @@ OBJECTS_FLOAT = \
|
||||||
|
|
||||||
OBJECTS_IO = \
|
OBJECTS_IO = \
|
||||||
io/access.o \
|
io/access.o \
|
||||||
|
io/chmod.o \
|
||||||
|
io/chsize.o \
|
||||||
io/close.o \
|
io/close.o \
|
||||||
io/commit.o \
|
io/commit.o \
|
||||||
|
io/create.o \
|
||||||
|
io/dup.o \
|
||||||
|
io/dup2.o \
|
||||||
|
io/eof.o \
|
||||||
|
io/filelen.o \
|
||||||
|
io/find.o \
|
||||||
io/fmode.o \
|
io/fmode.o \
|
||||||
io/isatty.o \
|
io/isatty.o \
|
||||||
|
io/locking.o \
|
||||||
io/lseek.o \
|
io/lseek.o \
|
||||||
io/mktemp.o \
|
io/mktemp.o \
|
||||||
io/open.o \
|
io/open.o \
|
||||||
|
io/pipe.o \
|
||||||
io/read.o \
|
io/read.o \
|
||||||
io/setmode.o \
|
io/setmode.o \
|
||||||
|
io/sopen.o \
|
||||||
|
io/tell.o \
|
||||||
|
io/umask.o \
|
||||||
io/unlink.o \
|
io/unlink.o \
|
||||||
|
io/utime.o \
|
||||||
io/write.o
|
io/write.o
|
||||||
|
|
||||||
OBJECTS_MATH = \
|
OBJECTS_MATH = \
|
||||||
|
@ -115,6 +140,7 @@ OBJECTS_STDIO = \
|
||||||
stdio/fputc.o \
|
stdio/fputc.o \
|
||||||
stdio/fputs.o \
|
stdio/fputs.o \
|
||||||
stdio/fread.o \
|
stdio/fread.o \
|
||||||
|
stdio/fscanf.o \
|
||||||
stdio/fwalk.o \
|
stdio/fwalk.o \
|
||||||
stdio/fwrite.o \
|
stdio/fwrite.o \
|
||||||
stdio/getc.o \
|
stdio/getc.o \
|
||||||
|
@ -123,14 +149,20 @@ OBJECTS_STDIO = \
|
||||||
stdio/putchar.o \
|
stdio/putchar.o \
|
||||||
stdio/puts.o \
|
stdio/puts.o \
|
||||||
stdio/remove.o \
|
stdio/remove.o \
|
||||||
|
stdio/scanf.o \
|
||||||
stdio/setvbuf.o \
|
stdio/setvbuf.o \
|
||||||
stdio/sprintf.o \
|
stdio/sprintf.o \
|
||||||
|
stdio/sscanf.o \
|
||||||
stdio/stdhnd.o \
|
stdio/stdhnd.o \
|
||||||
stdio/tempnam.o \
|
stdio/tempnam.o \
|
||||||
|
stdio/ungetc.o \
|
||||||
stdio/vfprintf.o \
|
stdio/vfprintf.o \
|
||||||
|
stdio/vfscanf.o \
|
||||||
stdio/vfwprint.o \
|
stdio/vfwprint.o \
|
||||||
stdio/vprintf.o \
|
stdio/vprintf.o \
|
||||||
|
stdio/vscanf.o \
|
||||||
stdio/vsprintf.o \
|
stdio/vsprintf.o \
|
||||||
|
stdio/vsscanf.o
|
||||||
|
|
||||||
#incomplete
|
#incomplete
|
||||||
OBJECTS_STDLIB = \
|
OBJECTS_STDLIB = \
|
||||||
|
@ -206,6 +238,7 @@ OBJECTS_STRING = \
|
||||||
|
|
||||||
OBJECTS_SYS_STAT = \
|
OBJECTS_SYS_STAT = \
|
||||||
sys_stat/fstat.o \
|
sys_stat/fstat.o \
|
||||||
|
sys_stat/futime.o \
|
||||||
sys_stat/stat.o
|
sys_stat/stat.o
|
||||||
|
|
||||||
OBJECTS_TIME = \
|
OBJECTS_TIME = \
|
||||||
|
@ -239,6 +272,7 @@ OBJECTS_WSTRING = \
|
||||||
wstring/wcsxfrm.o
|
wstring/wcsxfrm.o
|
||||||
|
|
||||||
OBJECTS = \
|
OBJECTS = \
|
||||||
|
$(OBJECTS_CONIO) \
|
||||||
$(OBJECTS_CTYPE) \
|
$(OBJECTS_CTYPE) \
|
||||||
$(OBJECTS_DIRECT) \
|
$(OBJECTS_DIRECT) \
|
||||||
$(OBJECTS_EXCEPT) \
|
$(OBJECTS_EXCEPT) \
|
||||||
|
@ -258,6 +292,7 @@ OBJECTS = \
|
||||||
|
|
||||||
ifeq ($(DOSCLI), yes)
|
ifeq ($(DOSCLI), yes)
|
||||||
CLEAN_FILES = \
|
CLEAN_FILES = \
|
||||||
|
conio\*.o \
|
||||||
ctype\*.o \
|
ctype\*.o \
|
||||||
direct\*.o \
|
direct\*.o \
|
||||||
float\*.o \
|
float\*.o \
|
||||||
|
@ -280,6 +315,7 @@ CLEAN_FILES = \
|
||||||
base.tmp
|
base.tmp
|
||||||
else
|
else
|
||||||
CLEAN_FILES = \
|
CLEAN_FILES = \
|
||||||
|
conio/*.o \
|
||||||
ctype/*.o \
|
ctype/*.o \
|
||||||
direct/*.o \
|
direct/*.o \
|
||||||
float/*.o \
|
float/*.o \
|
||||||
|
|
64
reactos/lib/msvcrt/conio/cgets.c
Normal file
64
reactos/lib/msvcrt/conio/cgets.c
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
#include <msvcrt/conio.h>
|
||||||
|
#include <msvcrt/stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
17
reactos/lib/msvcrt/conio/cprintf.c
Normal file
17
reactos/lib/msvcrt/conio/cprintf.c
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#include <msvcrt/stdio.h>
|
||||||
|
#include <msvcrt/conio.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
_cprintf(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
int cnt;
|
||||||
|
char buf[ 2048 ]; /* this is buggy, because buffer might be too small. */
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
cnt = vsprintf(buf, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
_cputs(buf);
|
||||||
|
return cnt;
|
||||||
|
}
|
23
reactos/lib/msvcrt/conio/cputs.c
Normal file
23
reactos/lib/msvcrt/conio/cputs.c
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS system libraries
|
||||||
|
* FILE: lib/crtdll/conio/cputs.c
|
||||||
|
* PURPOSE: Writes a character to stdout
|
||||||
|
* PROGRAMER: Boudewijn Dekker
|
||||||
|
* UPDATE HISTORY:
|
||||||
|
* 28/12/98: Created
|
||||||
|
*/
|
||||||
|
#include <windows.h>
|
||||||
|
#include <msvcrt/conio.h>
|
||||||
|
#include <msvcrt/string.h>
|
||||||
|
#include <msvcrt/stdio.h>
|
||||||
|
#include <msvcrt/internal/file.h>
|
||||||
|
|
||||||
|
int _cputs(const char *_str)
|
||||||
|
{
|
||||||
|
int len = strlen(_str);
|
||||||
|
DWORD written = 0;
|
||||||
|
if (!WriteFile(filehnd(stdout->_file),_str,len,&written,NULL))
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
18
reactos/lib/msvcrt/conio/cscanf.c
Normal file
18
reactos/lib/msvcrt/conio/cscanf.c
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#include <msvcrt/conio.h>
|
||||||
|
#include <msvcrt/stdarg.h>
|
||||||
|
#include <msvcrt/stdio.h>
|
||||||
|
|
||||||
|
int _cscanf(char *fmt, ...)
|
||||||
|
{
|
||||||
|
int cnt;
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
//fixme cscanf should scan the console's keyboard
|
||||||
|
va_start(ap, fmt);
|
||||||
|
cnt = __vscanf(fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
40
reactos/lib/msvcrt/conio/getch.c
Normal file
40
reactos/lib/msvcrt/conio/getch.c
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS system libraries
|
||||||
|
* FILE: lib/crtdll/conio/getch.c
|
||||||
|
* PURPOSE: Writes a character to stdout
|
||||||
|
* PROGRAMER: Boudewijn Dekker
|
||||||
|
* UPDATE HISTORY:
|
||||||
|
* 28/12/98: Created
|
||||||
|
*/
|
||||||
|
#include <windows.h>
|
||||||
|
#include <msvcrt/conio.h>
|
||||||
|
#include <msvcrt/stdio.h>
|
||||||
|
#include <msvcrt/io.h>
|
||||||
|
#include <msvcrt/internal/console.h>
|
||||||
|
|
||||||
|
|
||||||
|
int _getch(void)
|
||||||
|
{
|
||||||
|
DWORD NumberOfCharsRead = 0;
|
||||||
|
char c;
|
||||||
|
|
||||||
|
if (char_avail)
|
||||||
|
{
|
||||||
|
c = ungot_char;
|
||||||
|
char_avail = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ReadConsoleA(_get_osfhandle(stdin->_file),
|
||||||
|
&c,
|
||||||
|
1,
|
||||||
|
&NumberOfCharsRead,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
if (c == 10)
|
||||||
|
c = 13;
|
||||||
|
putchar(c);
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
31
reactos/lib/msvcrt/conio/getche.c
Normal file
31
reactos/lib/msvcrt/conio/getche.c
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details
|
||||||
|
* PROJECT: ReactOS system libraries
|
||||||
|
* FILE: lib/crtdll/conio/getche.c
|
||||||
|
* PURPOSE: Reads a character from stdin
|
||||||
|
* PROGRAMER: DJ Delorie
|
||||||
|
Boudewijn Dekker
|
||||||
|
* UPDATE HISTORY:
|
||||||
|
* 28/12/98: Created
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <msvcrt/conio.h>
|
||||||
|
#include <msvcrt/internal/console.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()));
|
||||||
|
}
|
31
reactos/lib/msvcrt/conio/kbhit.c
Normal file
31
reactos/lib/msvcrt/conio/kbhit.c
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS system libraries
|
||||||
|
* FILE: lib/crtdll/conio/kbhit.c
|
||||||
|
* PURPOSE: Checks for keyboard hits
|
||||||
|
* PROGRAMER: Boudewijn Dekker
|
||||||
|
* UPDATE HISTORY:
|
||||||
|
* 28/12/98: Created
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <msvcrt/conio.h>
|
||||||
|
#include <msvcrt/internal/console.h>
|
||||||
|
|
||||||
|
|
||||||
|
// FIXME PeekCosoleInput returns more than keyboard hits
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
21
reactos/lib/msvcrt/conio/putch.c
Normal file
21
reactos/lib/msvcrt/conio/putch.c
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS system libraries
|
||||||
|
* FILE: lib/crtdll/conio/putch.c
|
||||||
|
* PURPOSE: Writes a character to stdout
|
||||||
|
* PROGRAMER: Boudewijn Dekker
|
||||||
|
* UPDATE HISTORY:
|
||||||
|
* 28/12/98: Created
|
||||||
|
*/
|
||||||
|
#include <windows.h>
|
||||||
|
#include <msvcrt/conio.h>
|
||||||
|
|
||||||
|
int _putch(int c)
|
||||||
|
{
|
||||||
|
DWORD NumberOfCharsWritten;
|
||||||
|
|
||||||
|
if (WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),&c,1,&NumberOfCharsWritten,NULL))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return NumberOfCharsWritten;
|
||||||
|
}
|
29
reactos/lib/msvcrt/conio/ungetch.c
Normal file
29
reactos/lib/msvcrt/conio/ungetch.c
Normal 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/crtdll/conio/ungetch.c
|
||||||
|
* PURPOSE: Ungets a character from stdin
|
||||||
|
* PROGRAMER: DJ Delorie
|
||||||
|
Boudewijn Dekker [ Adapted from djgpp libc ]
|
||||||
|
* UPDATE HISTORY:
|
||||||
|
* 28/12/98: Created
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <msvcrt/conio.h>
|
||||||
|
#include <msvcrt/internal/console.h>
|
||||||
|
|
||||||
|
#define EOF -1
|
||||||
|
|
||||||
|
int char_avail = 0;
|
||||||
|
int ungot_char = 0;
|
||||||
|
|
||||||
|
|
||||||
|
int _ungetch(int c)
|
||||||
|
{
|
||||||
|
if (char_avail)
|
||||||
|
return(EOF);
|
||||||
|
ungot_char = c;
|
||||||
|
char_avail = 1;
|
||||||
|
return(c);
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
; $Id: msvcrt.def,v 1.8 2001/07/03 13:21:22 ekohl Exp $
|
; $Id: msvcrt.def,v 1.9 2001/07/04 16:39:37 ekohl Exp $
|
||||||
;
|
;
|
||||||
; ReactOS MSVCRT Compatibility Library
|
; ReactOS MSVCRT Compatibility Library
|
||||||
;
|
;
|
||||||
|
@ -181,13 +181,13 @@ _c_exit
|
||||||
; _cabs
|
; _cabs
|
||||||
; _callnewh
|
; _callnewh
|
||||||
_cexit
|
_cexit
|
||||||
; _cgets
|
_cgets
|
||||||
_chdir
|
_chdir
|
||||||
_chdrive
|
_chdrive
|
||||||
_chgsign
|
_chgsign
|
||||||
; _chkesp
|
; _chkesp
|
||||||
; _chmod
|
_chmod
|
||||||
; _chsize
|
_chsize
|
||||||
_clearfp
|
_clearfp
|
||||||
_close
|
_close
|
||||||
_commit
|
_commit
|
||||||
|
@ -195,21 +195,21 @@ _commode DATA
|
||||||
_control87
|
_control87
|
||||||
_controlfp
|
_controlfp
|
||||||
_copysign
|
_copysign
|
||||||
; _cprintf
|
_cprintf
|
||||||
; _cputs
|
_cputs
|
||||||
; _creat
|
_creat
|
||||||
; _cscanf
|
_cscanf
|
||||||
_ctype DATA
|
_ctype DATA
|
||||||
; _cwait
|
; _cwait
|
||||||
; _daylight
|
; _daylight
|
||||||
; _dstbias
|
; _dstbias
|
||||||
; _dup
|
_dup
|
||||||
; _dup2
|
_dup2
|
||||||
; _ecvt
|
; _ecvt
|
||||||
_endthread
|
_endthread
|
||||||
_endthreadex
|
_endthreadex
|
||||||
_environ_dll DATA
|
_environ_dll DATA
|
||||||
; _eof
|
_eof
|
||||||
_errno
|
_errno
|
||||||
_except_handler2
|
_except_handler2
|
||||||
_except_handler3
|
_except_handler3
|
||||||
|
@ -230,14 +230,14 @@ _fcloseall
|
||||||
; _fgetwchar
|
; _fgetwchar
|
||||||
_filbuf
|
_filbuf
|
||||||
; _fileinfo
|
; _fileinfo
|
||||||
; _filelength
|
_filelength
|
||||||
; _filelengthi64
|
_filelengthi64
|
||||||
_fileno
|
_fileno
|
||||||
; _findclose
|
_findclose
|
||||||
; _findfirst
|
_findfirst
|
||||||
; _findfirsti64
|
_findfirsti64
|
||||||
; _findnext
|
_findnext
|
||||||
; _findnexti64
|
_findnexti64
|
||||||
_finite
|
_finite
|
||||||
_flsbuf
|
_flsbuf
|
||||||
_flushall
|
_flushall
|
||||||
|
@ -249,16 +249,16 @@ _fpreset
|
||||||
; _fputwchar
|
; _fputwchar
|
||||||
; _fsopen
|
; _fsopen
|
||||||
_fstat
|
_fstat
|
||||||
; _fstati64
|
_fstati64
|
||||||
; _ftime
|
; _ftime
|
||||||
; _ftol
|
; _ftol
|
||||||
_fullpath
|
_fullpath
|
||||||
; _futime
|
_futime
|
||||||
; _gcvt
|
; _gcvt
|
||||||
_get_osfhandle
|
_get_osfhandle
|
||||||
; _get_sbh_threshold
|
; _get_sbh_threshold
|
||||||
; _getch
|
_getch
|
||||||
; _getche
|
_getche
|
||||||
_getcwd
|
_getcwd
|
||||||
_getdcwd
|
_getdcwd
|
||||||
_getdiskfree
|
_getdiskfree
|
||||||
|
@ -323,19 +323,19 @@ _itow
|
||||||
; _j0
|
; _j0
|
||||||
; _j1
|
; _j1
|
||||||
; _jn
|
; _jn
|
||||||
; _kbhit
|
_kbhit
|
||||||
; _lfind
|
; _lfind
|
||||||
_loaddll
|
_loaddll
|
||||||
_local_unwind2
|
_local_unwind2
|
||||||
; _lock
|
; _lock
|
||||||
; _locking
|
_locking
|
||||||
_logb
|
_logb
|
||||||
; _longjmpex
|
; _longjmpex
|
||||||
_lrotl
|
_lrotl
|
||||||
_lrotr
|
_lrotr
|
||||||
; _lsearch
|
; _lsearch
|
||||||
_lseek
|
_lseek
|
||||||
; _lseeki64
|
_lseeki64
|
||||||
_ltoa
|
_ltoa
|
||||||
_ltow
|
_ltow
|
||||||
_makepath
|
_makepath
|
||||||
|
@ -410,10 +410,10 @@ _osver DATA
|
||||||
; _pclose
|
; _pclose
|
||||||
_pctype DATA
|
_pctype DATA
|
||||||
_pgmptr DATA
|
_pgmptr DATA
|
||||||
; _pipe
|
_pipe
|
||||||
; _popen
|
; _popen
|
||||||
_purecall
|
_purecall
|
||||||
; _putch
|
_putch
|
||||||
_putenv
|
_putenv
|
||||||
; _putw
|
; _putw
|
||||||
_putws
|
_putws
|
||||||
|
@ -442,7 +442,7 @@ _setmode
|
||||||
_sleep
|
_sleep
|
||||||
_snprintf
|
_snprintf
|
||||||
_snwprintf
|
_snwprintf
|
||||||
; _sopen
|
_sopen
|
||||||
; _spawnl
|
; _spawnl
|
||||||
; _spawnle
|
; _spawnle
|
||||||
; _spawnlp
|
; _spawnlp
|
||||||
|
@ -453,7 +453,7 @@ _snwprintf
|
||||||
; _spawnvpe
|
; _spawnvpe
|
||||||
_splitpath
|
_splitpath
|
||||||
_stat
|
_stat
|
||||||
; _stati64
|
_stati64
|
||||||
_statusfp
|
_statusfp
|
||||||
_strcmpi
|
_strcmpi
|
||||||
; _strdate
|
; _strdate
|
||||||
|
@ -473,8 +473,8 @@ _strupr
|
||||||
_swab
|
_swab
|
||||||
_sys_errlist DATA
|
_sys_errlist DATA
|
||||||
_sys_nerr DATA
|
_sys_nerr DATA
|
||||||
; _tell
|
_tell
|
||||||
; _telli64
|
_telli64
|
||||||
_tempnam
|
_tempnam
|
||||||
; _timezone
|
; _timezone
|
||||||
_tolower
|
_tolower
|
||||||
|
@ -485,20 +485,20 @@ _ui64toa
|
||||||
_ui64tow
|
_ui64tow
|
||||||
_ultoa
|
_ultoa
|
||||||
_ultow
|
_ultow
|
||||||
; _umask
|
_umask
|
||||||
; _ungetch
|
_ungetch
|
||||||
_unlink
|
_unlink
|
||||||
_unloaddll
|
_unloaddll
|
||||||
; _unlock
|
; _unlock
|
||||||
; _utime
|
_utime
|
||||||
_vsnprintf
|
_vsnprintf
|
||||||
_vsnwprintf
|
_vsnwprintf
|
||||||
_waccess
|
_waccess
|
||||||
; _wasctime
|
; _wasctime
|
||||||
_wchdir
|
_wchdir
|
||||||
; _wchmod
|
_wchmod
|
||||||
; _wcmdln
|
; _wcmdln
|
||||||
; _wcreat
|
_wcreat
|
||||||
_wcsdup
|
_wcsdup
|
||||||
_wcsicmp
|
_wcsicmp
|
||||||
_wcsicoll
|
_wcsicoll
|
||||||
|
@ -521,10 +521,10 @@ _wcsupr
|
||||||
; _wexecvp
|
; _wexecvp
|
||||||
; _wexecvpe
|
; _wexecvpe
|
||||||
; _wfdopen
|
; _wfdopen
|
||||||
; _wfindfirst
|
_wfindfirst
|
||||||
; _wfindfirsti64
|
_wfindfirsti64
|
||||||
; _wfindnext
|
_wfindnext
|
||||||
; _wfindnexti64
|
_wfindnexti64
|
||||||
; _wfopen
|
; _wfopen
|
||||||
; _wfreopen
|
; _wfreopen
|
||||||
; _wfsopen
|
; _wfsopen
|
||||||
|
@ -549,7 +549,7 @@ _write
|
||||||
_wrmdir
|
_wrmdir
|
||||||
_wsearchenv
|
_wsearchenv
|
||||||
; _wsetlocale
|
; _wsetlocale
|
||||||
; _wsopen
|
_wsopen
|
||||||
; _wspawnl
|
; _wspawnl
|
||||||
; _wspawnle
|
; _wspawnle
|
||||||
; _wspawnlp
|
; _wspawnlp
|
||||||
|
@ -559,8 +559,8 @@ _wsearchenv
|
||||||
; _wspawnvp
|
; _wspawnvp
|
||||||
; _wspawnvpe
|
; _wspawnvpe
|
||||||
_wsplitpath
|
_wsplitpath
|
||||||
; _wstat
|
_wstat
|
||||||
; _wstati64
|
_wstati64
|
||||||
; _wstrdate
|
; _wstrdate
|
||||||
; _wstrtime
|
; _wstrtime
|
||||||
; _wsystem
|
; _wsystem
|
||||||
|
@ -569,8 +569,8 @@ _wsplitpath
|
||||||
_wtoi
|
_wtoi
|
||||||
_wtoi64
|
_wtoi64
|
||||||
_wtol
|
_wtol
|
||||||
; _wunlink
|
_wunlink
|
||||||
; _wutime
|
_wutime
|
||||||
; _y0
|
; _y0
|
||||||
; _y1
|
; _y1
|
||||||
; _yn
|
; _yn
|
||||||
|
@ -619,13 +619,13 @@ fread
|
||||||
free
|
free
|
||||||
; freopen
|
; freopen
|
||||||
; frexp
|
; frexp
|
||||||
; fscanf
|
fscanf
|
||||||
; fseek
|
; fseek
|
||||||
; fsetpos
|
; fsetpos
|
||||||
; ftell
|
; ftell
|
||||||
fwprintf
|
fwprintf
|
||||||
fwrite
|
fwrite
|
||||||
; fwscanf
|
fwscanf
|
||||||
getc
|
getc
|
||||||
; getchar
|
; getchar
|
||||||
getenv
|
getenv
|
||||||
|
@ -693,7 +693,7 @@ realloc
|
||||||
remove
|
remove
|
||||||
; rename
|
; rename
|
||||||
; rewind
|
; rewind
|
||||||
; scanf
|
scanf
|
||||||
; setbuf
|
; setbuf
|
||||||
; setlocale
|
; setlocale
|
||||||
setvbuf
|
setvbuf
|
||||||
|
@ -703,7 +703,7 @@ signal
|
||||||
sprintf
|
sprintf
|
||||||
; sqrt
|
; sqrt
|
||||||
; srand
|
; srand
|
||||||
; sscanf
|
sscanf
|
||||||
strcat
|
strcat
|
||||||
strchr
|
strchr
|
||||||
strcmp
|
strcmp
|
||||||
|
@ -726,7 +726,7 @@ strtol
|
||||||
strtoul
|
strtoul
|
||||||
strxfrm
|
strxfrm
|
||||||
swprintf
|
swprintf
|
||||||
; swscanf
|
swscanf
|
||||||
; system
|
; system
|
||||||
; tan
|
; tan
|
||||||
; tanh
|
; tanh
|
||||||
|
@ -737,8 +737,8 @@ tolower
|
||||||
toupper
|
toupper
|
||||||
towlower
|
towlower
|
||||||
towupper
|
towupper
|
||||||
; ungetc
|
ungetc
|
||||||
; ungetwc
|
ungetwc
|
||||||
vfprintf
|
vfprintf
|
||||||
vfwprintf
|
vfwprintf
|
||||||
vprintf
|
vprintf
|
||||||
|
@ -768,6 +768,6 @@ wcstoul
|
||||||
wcsxfrm
|
wcsxfrm
|
||||||
; wctomb
|
; wctomb
|
||||||
wprintf
|
wprintf
|
||||||
; wscanf
|
wscanf
|
||||||
|
|
||||||
; EOF
|
; EOF
|
||||||
|
|
59
reactos/lib/msvcrt/stdio/fscanf.c
Normal file
59
reactos/lib/msvcrt/stdio/fscanf.c
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/* Copyright (C) 1991 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||||
|
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||||
|
Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
|
|
||||||
|
#include <msvcrt/stdarg.h>
|
||||||
|
#include <msvcrt/stdio.h>
|
||||||
|
#include <msvcrt/wchar.h>
|
||||||
|
#include <msvcrt/alloc.h>
|
||||||
|
#include <msvcrt/internal/stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* Read formatted input from STREAM according to the format string FORMAT. */
|
||||||
|
/* VARARGS2 */
|
||||||
|
int fscanf(FILE *stream,const char *format, ...)
|
||||||
|
{
|
||||||
|
va_list arg;
|
||||||
|
int done;
|
||||||
|
|
||||||
|
va_start(arg, format);
|
||||||
|
done = __vfscanf(stream, format, arg);
|
||||||
|
va_end(arg);
|
||||||
|
|
||||||
|
return done;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
fwscanf(FILE *stream, const wchar_t *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list arg;
|
||||||
|
int done;
|
||||||
|
char *cf;
|
||||||
|
int i,len = wcslen(fmt);
|
||||||
|
|
||||||
|
cf = malloc(len+1);
|
||||||
|
for(i=0;i<len;i++)
|
||||||
|
cf[i] = fmt[i];
|
||||||
|
cf[i] = 0;
|
||||||
|
|
||||||
|
va_start(arg, fmt);
|
||||||
|
done = __vfscanf(stream, cf, arg);
|
||||||
|
va_end(arg);
|
||||||
|
free(cf);
|
||||||
|
return done;
|
||||||
|
}
|
58
reactos/lib/msvcrt/stdio/scanf.c
Normal file
58
reactos/lib/msvcrt/stdio/scanf.c
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||||
|
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||||
|
Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
|
#include <msvcrt/stdarg.h>
|
||||||
|
#include <msvcrt/stdio.h>
|
||||||
|
#include <msvcrt/wchar.h>
|
||||||
|
#include <msvcrt/alloc.h>
|
||||||
|
#include <msvcrt/internal/stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* Read formatted input from stdin according to the format string FORMAT. */
|
||||||
|
/* VARARGS1 */
|
||||||
|
int scanf(const char *format, ...)
|
||||||
|
{
|
||||||
|
va_list arg;
|
||||||
|
int done;
|
||||||
|
|
||||||
|
va_start(arg, format);
|
||||||
|
done = __vscanf(format, arg);
|
||||||
|
va_end(arg);
|
||||||
|
|
||||||
|
return done;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
wscanf(const wchar_t *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list arg;
|
||||||
|
int done;
|
||||||
|
char *f;
|
||||||
|
int i, len = wcslen(fmt);
|
||||||
|
|
||||||
|
f = malloc(len+1);
|
||||||
|
for(i=0;i<len;i++)
|
||||||
|
f[i] = fmt[i];
|
||||||
|
f[i] = 0;
|
||||||
|
va_start(arg, fmt);
|
||||||
|
done = __vscanf(f, arg);
|
||||||
|
va_end(arg);
|
||||||
|
free(f);
|
||||||
|
|
||||||
|
return done;
|
||||||
|
}
|
65
reactos/lib/msvcrt/stdio/sscanf.c
Normal file
65
reactos/lib/msvcrt/stdio/sscanf.c
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <msvcrt/stdarg.h>
|
||||||
|
#include <msvcrt/stdio.h>
|
||||||
|
#include <msvcrt/wchar.h>
|
||||||
|
#include <msvcrt/alloc.h>
|
||||||
|
#include <msvcrt/internal/stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* Read formatted input from S, according to the format string FORMAT. */
|
||||||
|
/* VARARGS2 */
|
||||||
|
int sscanf (const char *s,const char *format, ...)
|
||||||
|
{
|
||||||
|
va_list arg;
|
||||||
|
int done;
|
||||||
|
|
||||||
|
va_start (arg, format);
|
||||||
|
done = __vsscanf (s, format, arg);
|
||||||
|
va_end (arg);
|
||||||
|
|
||||||
|
return done;
|
||||||
|
}
|
||||||
|
|
||||||
|
int swscanf(const wchar_t *str, const wchar_t *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list arg;
|
||||||
|
int done;
|
||||||
|
char *f , *s;
|
||||||
|
int i,len = wcslen(fmt);
|
||||||
|
|
||||||
|
f = malloc(len+1);
|
||||||
|
for(i=0;i<len;i++)
|
||||||
|
f[i] = fmt[i];
|
||||||
|
f[i] = 0;
|
||||||
|
|
||||||
|
len = wcslen(str);
|
||||||
|
s = alloca(len+1);
|
||||||
|
for(i=0;i<len;i++)
|
||||||
|
s[i] = str[i];
|
||||||
|
s[i] = 0;
|
||||||
|
|
||||||
|
va_start (arg, fmt);
|
||||||
|
done = __vsscanf (s, f, arg);
|
||||||
|
va_end (arg);
|
||||||
|
|
||||||
|
free(f);
|
||||||
|
|
||||||
|
return done;
|
||||||
|
}
|
71
reactos/lib/msvcrt/stdio/ungetc.c
Normal file
71
reactos/lib/msvcrt/stdio/ungetc.c
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
|
||||||
|
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||||
|
#include <msvcrt/stdio.h>
|
||||||
|
#include <msvcrt/wchar.h>
|
||||||
|
#include <msvcrt/errno.h>
|
||||||
|
#include <msvcrt/internal/file.h>
|
||||||
|
|
||||||
|
int ungetc(int c, FILE *f)
|
||||||
|
{
|
||||||
|
if (!__validfp (f) || !OPEN4READING(f))
|
||||||
|
{
|
||||||
|
__set_errno (EINVAL);
|
||||||
|
return EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c == EOF)
|
||||||
|
return EOF;
|
||||||
|
|
||||||
|
if (f->_ptr == NULL || f->_base == NULL)
|
||||||
|
return EOF;
|
||||||
|
|
||||||
|
if (f->_ptr == f->_base)
|
||||||
|
{
|
||||||
|
if (f->_cnt == 0)
|
||||||
|
f->_ptr++;
|
||||||
|
else
|
||||||
|
return EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
f->_cnt++;
|
||||||
|
f->_ptr--;
|
||||||
|
if (*f->_ptr != c)
|
||||||
|
{
|
||||||
|
f->_flag |= _IOUNGETC;
|
||||||
|
*f->_ptr = c;
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wint_t
|
||||||
|
ungetwc(wchar_t c, FILE *f)
|
||||||
|
{
|
||||||
|
if (!__validfp (f) || !OPEN4READING(f))
|
||||||
|
{
|
||||||
|
__set_errno(EINVAL);
|
||||||
|
return EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c == (wchar_t)EOF)
|
||||||
|
return EOF;
|
||||||
|
|
||||||
|
if (f->_ptr == NULL || f->_base == NULL)
|
||||||
|
return EOF;
|
||||||
|
|
||||||
|
if (f->_ptr == f->_base)
|
||||||
|
{
|
||||||
|
if (f->_cnt == 0)
|
||||||
|
f->_ptr+=sizeof(wchar_t);
|
||||||
|
else
|
||||||
|
return EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
f->_cnt+=sizeof(wchar_t);
|
||||||
|
f->_ptr-=sizeof(wchar_t);
|
||||||
|
|
||||||
|
f->_flag |= _IOUNGETC;
|
||||||
|
*((wchar_t *)(f->_ptr)) = c;
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
1200
reactos/lib/msvcrt/stdio/vfscanf.c
Normal file
1200
reactos/lib/msvcrt/stdio/vfscanf.c
Normal file
File diff suppressed because it is too large
Load diff
33
reactos/lib/msvcrt/stdio/vscanf.c
Normal file
33
reactos/lib/msvcrt/stdio/vscanf.c
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||||
|
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||||
|
Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
|
#include <msvcrt/stdarg.h>
|
||||||
|
#include <msvcrt/stdio.h>
|
||||||
|
#include <msvcrt/internal/file.h>
|
||||||
|
#include <msvcrt/internal/stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef vscanf
|
||||||
|
|
||||||
|
|
||||||
|
/* Read formatted input from stdin according to the format
|
||||||
|
string in FORMAT, using the argument list in ARG. */
|
||||||
|
int __vscanf (const char *format, va_list arg)
|
||||||
|
{
|
||||||
|
return __vfscanf(stdin, format, arg);
|
||||||
|
}
|
49
reactos/lib/msvcrt/stdio/vsscanf.c
Normal file
49
reactos/lib/msvcrt/stdio/vsscanf.c
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||||
|
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||||
|
Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
|
#include <msvcrt/errno.h>
|
||||||
|
#include <msvcrt/stdarg.h>
|
||||||
|
#include <msvcrt/stdio.h>
|
||||||
|
#include <msvcrt/string.h>
|
||||||
|
#include <msvcrt/internal/file.h>
|
||||||
|
#include <msvcrt/internal/stdio.h>
|
||||||
|
|
||||||
|
#undef vsscanf
|
||||||
|
|
||||||
|
/* Read formatted input from S according to the format
|
||||||
|
string FORMAT, using the argument list in ARG. */
|
||||||
|
int __vsscanf(const char *s,const char *format,va_list arg)
|
||||||
|
{
|
||||||
|
FILE f;
|
||||||
|
|
||||||
|
if (s == NULL)
|
||||||
|
{
|
||||||
|
__set_errno(EINVAL);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset((void *) &f, 0, sizeof (f));
|
||||||
|
|
||||||
|
f._flag = _IOREAD;
|
||||||
|
f._ptr = (char *)s;
|
||||||
|
f._base = (char *)s;
|
||||||
|
f._bufsiz = strlen(s);
|
||||||
|
f._cnt = f._bufsiz;
|
||||||
|
|
||||||
|
return __vfscanf(&f, format, arg);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue