integrated Art Yerkes' _ftime implementation at lib/msvcrt/time/ftime.c

fixed ungetc warning in lib/msvcrt/stdio/vfscanf.c (also renamed ungetc macro to UNGETC for clarity)

svn path=/trunk/; revision=5139
This commit is contained in:
Royce Mitchell III 2003-07-16 13:29:01 +00:00
parent db21a27a3b
commit 0b1a369faf
5 changed files with 58 additions and 16 deletions

View file

@ -1,3 +1,10 @@
2003-07-16 Royce Mitchell III <royce3@ev1.net>
* integrated Art Yerkes' _ftime implementation at
lib/msvcrt/time/ftime.c
* fixed ungetc warning in lib/msvcrt/stdio/vfscanf.c (also
renamed ungetc macro to UNGETC for clarity)
2003-07-15 Royce Mitchell III <royce3@ev1.net> 2003-07-15 Royce Mitchell III <royce3@ev1.net>
* fixed references to errno in MSVCRT to use __set_errno() and * fixed references to errno in MSVCRT to use __set_errno() and

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.36 2003/06/09 20:23:06 hbirr Exp $ # $Id: Makefile,v 1.37 2003/07/16 13:29:01 royce Exp $
PATH_TO_TOP = ../.. PATH_TO_TOP = ../..
@ -427,6 +427,7 @@ TIME_OBJECTS = \
time/clock.o \ time/clock.o \
time/ctime.o \ time/ctime.o \
time/difftime.o \ time/difftime.o \
time/ftime.o \
time/strdate.o \ time/strdate.o \
time/strftime.o \ time/strftime.o \
time/strtime.o \ time/strtime.o \

View file

@ -1,4 +1,4 @@
; $Id: msvcrt.def,v 1.21 2003/04/30 22:07:29 gvg Exp $ ; $Id: msvcrt.def,v 1.22 2003/07/16 13:29:01 royce Exp $
; ;
; ReactOS MSVCRT Compatibility Library ; ReactOS MSVCRT Compatibility Library
; ;
@ -252,7 +252,7 @@ _fputwchar
_fsopen _fsopen
_fstat _fstat
_fstati64 _fstati64
; _ftime _ftime
_ftol=NTDLL._ftol _ftol=NTDLL._ftol
_fullpath _fullpath
_futime _futime

View file

@ -64,7 +64,7 @@ unsigned long int __strtoul_internal (const char *__nptr, char **__endptr, int
# define TYPEMOD (LONG|LONGDBL|SHORT) # define TYPEMOD (LONG|LONGDBL|SHORT)
# define ungetc(c, s) ((void) (c != EOF && --read_in), ungetc (c, s)) # define UNGETC(c, s) ((void) (((wint_t)c) != ((wint_t)EOF) && --read_in), ungetc (c, s))
# define inchar() ((c = getc (s)), (void) (c != EOF && ++read_in), c) # define inchar() ((c = getc (s)), (void) (c != EOF && ++read_in), c)
# define encode_error() do { \ # define encode_error() do { \
funlockfile (s); \ funlockfile (s); \
@ -198,7 +198,7 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
input_error (); input_error ();
else if (c != *f++) else if (c != *f++)
{ {
ungetc (c, s); UNGETC (c, s);
conv_error (); conv_error ();
} }
} }
@ -236,7 +236,7 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
if (c != fc) if (c != fc)
{ {
ungetc (c, s); UNGETC (c, s);
conv_error (); conv_error ();
} }
@ -356,7 +356,7 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
if (inchar () == EOF && *_errno() == EINTR) if (inchar () == EOF && *_errno() == EINTR)
input_error (); input_error ();
while (isspace (c)); while (isspace (c));
ungetc (c, s); UNGETC (c, s);
skip_space = 0; skip_space = 0;
} }
@ -366,7 +366,7 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
c = inchar (); c = inchar ();
if (c != fc) if (c != fc)
{ {
ungetc (c, s); UNGETC (c, s);
conv_error (); conv_error ();
} }
break; break;
@ -583,7 +583,7 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
{ {
if (isspace (c)) if (isspace (c))
{ {
ungetc (c, s); UNGETC (c, s);
break; break;
} }
#define STRING_ADD_CHAR(Str, c, Type) \ #define STRING_ADD_CHAR(Str, c, Type) \
@ -653,7 +653,7 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
not make a difference for white space characters not make a difference for white space characters
we can simply push back a simple <SP> which is we can simply push back a simple <SP> which is
guaranteed to be in the [:space:] class. */ guaranteed to be in the [:space:] class. */
ungetc (' ', s); UNGETC (' ', s);
break; break;
} }
@ -751,7 +751,7 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
} }
/* The just read character is not part of the number anymore. */ /* The just read character is not part of the number anymore. */
ungetc (c, s); UNGETC (c, s);
if (wpsize == 0 || if (wpsize == 0 ||
(wpsize == 1 && (wp[0] == '+' || wp[0] == '-'))) (wpsize == 1 && (wp[0] == '+' || wp[0] == '-')))
@ -853,7 +853,7 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
{ {
/* The last read character is not part of the number /* The last read character is not part of the number
anymore. */ anymore. */
ungetc (c, s); UNGETC (c, s);
break; break;
} }
if (width > 0) if (width > 0)
@ -951,7 +951,7 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
if (fc == '\0') if (fc == '\0')
{ {
if (!(flags & LONG)) if (!(flags & LONG))
ungetc (c, s); UNGETC (c, s);
conv_error(); conv_error();
} }
@ -973,7 +973,7 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
input we push it back only in case it is input we push it back only in case it is
representable within one byte. */ representable within one byte. */
if (val < 0x80) if (val < 0x80)
ungetc (val, s); UNGETC (val, s);
break; break;
} }
STRING_ADD_CHAR (wstr, val, wchar_t); STRING_ADD_CHAR (wstr, val, wchar_t);
@ -999,7 +999,7 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
{ {
if (wp[c] == not_in) if (wp[c] == not_in)
{ {
ungetc (c, s); UNGETC (c, s);
break; break;
} }
STRING_ADD_CHAR (str, c, char); STRING_ADD_CHAR (str, c, char);
@ -1036,7 +1036,7 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
do do
c = inchar (); c = inchar ();
while (isspace (c)); while (isspace (c));
ungetc (c, s); UNGETC (c, s);
} }

View file

@ -0,0 +1,34 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/msvcrt/time/ftime.c
* PURPOSE: Deprecated BSD library call
* PROGRAMER: Art Yerkes
* UPDATE HISTORY:
* 07/15/03 -- Created
*/
#include <windows.h>
#include <msvcrt/sys/time.h>
#include <msvcrt/sys/timeb.h>
/* ftime (3) -- Obsolete BSD library function included in the SUS for copat.
* Also present in msvcrt.dll as _ftime
* See: http://www.opengroup.org/onlinepubs/007904957/functions/ftime.html */
/*
* @implemented
*/
void _ftime( struct timeb *tm )
{
int ret = 0;
SYSTEMTIME syst;
GetSystemTime( &syst );
if( ret == 0 ) {
time( &tm->time );
tm->millitm = syst.wMilliseconds;
tm->_timezone = 0; /* According to the open group, timezone and dstflag */
tm->dstflag = 0; /* exist for compatibility, but are unspecified. */
}
}