mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Changes and improved mingw32 compile
svn path=/trunk/; revision=330
This commit is contained in:
parent
8bf8d53376
commit
b3c424cd40
45 changed files with 227 additions and 244 deletions
|
@ -10,14 +10,11 @@
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <io.h>
|
||||||
|
|
||||||
extern int char_avail;
|
extern int char_avail;
|
||||||
extern int ungot_char;
|
extern int ungot_char;
|
||||||
|
|
||||||
int getch( void )
|
|
||||||
{
|
|
||||||
return _getch();
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
_getch(void)
|
_getch(void)
|
||||||
|
@ -32,7 +29,7 @@ _getch(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ReadConsoleA(filehnd(stdin->_file), &c,1,&NumberOfCharsRead ,NULL);
|
ReadConsoleA(_get_osfhandle(stdin->_file), &c,1,&NumberOfCharsRead ,NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
if ( c == 10 )
|
if ( c == 10 )
|
||||||
|
|
|
@ -1,3 +1,18 @@
|
||||||
|
/*
|
||||||
|
* 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 <conio.h>
|
||||||
|
|
||||||
|
|
||||||
|
// FIXME PeekCosoleInput returns more than keyboard hits
|
||||||
int
|
int
|
||||||
_kbhit(void)
|
_kbhit(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
#undef toupper
|
#undef toupper
|
||||||
int toupper(int c)
|
int toupper(int c)
|
||||||
|
@ -7,7 +8,7 @@ int toupper(int c)
|
||||||
return (c >= 'a' && c <= 'z') ? c + 'A' - 'a' : c;
|
return (c >= 'a' && c <= 'z') ? c + 'A' - 'a' : c;
|
||||||
}
|
}
|
||||||
#undef towupper
|
#undef towupper
|
||||||
int towupper(int c)
|
wchar_t towupper(wchar_t c)
|
||||||
{
|
{
|
||||||
return (c >= 'a' && c <= 'z') ? c + 'A' - 'a' : c;
|
return (c >= 'a' && c <= 'z') ? c + 'A' - 'a' : c;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +18,7 @@ int _toupper(int c)
|
||||||
return (c >= 'a' && c <= 'z') ? c + 'A' - 'a' : c;
|
return (c >= 'a' && c <= 'z') ? c + 'A' - 'a' : c;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _towupper(int c)
|
wchar_t _towupper(wchar_t c)
|
||||||
{
|
{
|
||||||
return (c >= 'a' && c <= 'z') ? c + 'A' - 'a' : c;
|
return (c >= 'a' && c <= 'z') ? c + 'A' - 'a' : c;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,8 @@ unsigned int _getdiskfree(unsigned int _drive, struct _diskfree_t *_diskspace)
|
||||||
if ( _diskspace == NULL )
|
if ( _diskspace == NULL )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( !GetDiskFreeSpaceA(RootPathName,&_diskspace->sectors_per_cluster,&_diskspace->bytes_per_sector,&_diskspace->avail_clusters,&_diskspace->total_clusters ) )
|
if ( !GetDiskFreeSpaceA(RootPathName,(LPDWORD)&_diskspace->sectors_per_cluster,(LPDWORD)&_diskspace->bytes_per_sector,
|
||||||
|
(LPDWORD )&_diskspace->avail_clusters,(LPDWORD )&_diskspace->total_clusters ) )
|
||||||
return 0;
|
return 0;
|
||||||
return _diskspace->avail_clusters;
|
return _diskspace->avail_clusters;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,21 @@
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#define F_OK 0x01
|
#ifndef F_OK
|
||||||
#define R_OK 0x02
|
#define F_OK 0x01
|
||||||
#define W_OK 0x04
|
#endif
|
||||||
#define X_OK 0x08
|
#ifndef R_OK
|
||||||
#define D_OK 0x10
|
#define R_OK 0x02
|
||||||
|
#endif
|
||||||
|
#ifndef W_OK
|
||||||
|
#define W_OK 0x04
|
||||||
|
#endif
|
||||||
|
#ifndef X_OK
|
||||||
|
#define X_OK 0x08
|
||||||
|
#endif
|
||||||
|
#ifndef D_OK
|
||||||
|
#define D_OK 0x10
|
||||||
|
#endif
|
||||||
|
|
||||||
int _access( const char *_path, int _amode )
|
int _access( const char *_path, int _amode )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
//#include <libc/file.h>
|
#include <libc/file.h>
|
||||||
|
|
||||||
|
|
||||||
int close(int _fd)
|
|
||||||
{
|
|
||||||
return _close(_fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _close(int _fd)
|
int _close(int _fd)
|
||||||
{
|
{
|
||||||
CloseHandle(filehnd(_fd));
|
CloseHandle(_get_osfhandle(_fd));
|
||||||
return __fileno_close(_fd);
|
return __fileno_close(_fd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
14
reactos/lib/crtdll/io/commit.c
Normal file
14
reactos/lib/crtdll/io/commit.c
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#include <windows.h>
|
||||||
|
#include <io.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <libc/file.h>
|
||||||
|
|
||||||
|
int _commit(int _fd)
|
||||||
|
{
|
||||||
|
if (! FlushFileBuffers(_get_osfhandle(_fd)) ) {
|
||||||
|
__set_errno(EBADF);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -1,13 +1,8 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
|
||||||
#undef dup
|
|
||||||
int dup( int handle )
|
|
||||||
{
|
|
||||||
return _dup(handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _dup( int handle )
|
int _dup( int handle )
|
||||||
{
|
{
|
||||||
return _open_osfhandle(filehnd(handle), 0666);
|
return _open_osfhandle(_get_osfhandle(handle), 0666);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,15 +10,10 @@
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
size_t read(int _fd, void *_buf, size_t _nbyte)
|
|
||||||
{
|
|
||||||
return _read(_fd,_buf,_nbyte);
|
|
||||||
}
|
|
||||||
size_t _read(int _fd, void *_buf, size_t _nbyte)
|
size_t _read(int _fd, void *_buf, size_t _nbyte)
|
||||||
{
|
{
|
||||||
size_t _rbyte;
|
size_t _rbyte;
|
||||||
if ( !ReadFile(filehnd(_fd),_buf,_nbyte,&_rbyte,NULL) ) {
|
if ( !ReadFile(_get_osfhandle(_fd),_buf,_nbyte,&_rbyte,NULL) ) {
|
||||||
printf("%d\n",GetLastError());
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,11 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
|
||||||
int unlink( const char *filename )
|
|
||||||
{
|
|
||||||
return _unlink(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _unlink( const char *filename )
|
int _unlink( const char *filename )
|
||||||
{
|
{
|
||||||
if ( !DeleteFile(filename) )
|
if ( !DeleteFileA(filename) )
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,16 +10,12 @@
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
int write(int _fd, const void *_buf,int _nbyte)
|
|
||||||
{
|
|
||||||
return _write(_fd,_buf,_nbyte);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t _write(int _fd, const void *_buf, size_t _nbyte)
|
size_t _write(int _fd, const void *_buf, size_t _nbyte)
|
||||||
{
|
{
|
||||||
size_t _wbyte;
|
size_t _wbyte;
|
||||||
if ( !WriteFile(filehnd(_fd),_buf,_nbyte,&_wbyte,NULL) ) {
|
if ( !WriteFile(_get_osfhandle(_fd),_buf,_nbyte,&_wbyte,NULL) ) {
|
||||||
printf("%d\n",GetLastError());
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return _wbyte;
|
return _wbyte;
|
||||||
|
|
|
@ -16,7 +16,7 @@ DIRECT_OBJECTS = direct/chdir.o direct/chdrive.o direct/getcwd.o direct/getdrive
|
||||||
direct/rmdir.o direct/mkdir.o direct/getdfree.o
|
direct/rmdir.o direct/mkdir.o direct/getdfree.o
|
||||||
|
|
||||||
|
|
||||||
MISC_OBJECTS = misc/sleep.o misc/getargs.o misc/crtfmode.o misc/crtglob.o
|
MISC_OBJECTS = misc/sleep.o misc/GetArgs.o misc/CRTfmode.o misc/CRTglob.o
|
||||||
|
|
||||||
STRING_OBJECTS = string/memchr.o string/memcmp.o string/strcat.o \
|
STRING_OBJECTS = string/memchr.o string/memcmp.o string/strcat.o \
|
||||||
string/strchr.o string/strcmp.o string/strcoll.o \
|
string/strchr.o string/strcmp.o string/strcoll.o \
|
||||||
|
@ -54,12 +54,12 @@ IO_OBJECTS = io/access.o io/close.o io/create.o io/dup.o io/dup2.o io/find.o io/
|
||||||
io/chmod.o io/chsize.o io/commit.o io/locking.o io/pipe.o io/sopen.o io/filelen.o\
|
io/chmod.o io/chsize.o io/commit.o io/locking.o io/pipe.o io/sopen.o io/filelen.o\
|
||||||
io/umask.o io/tell.o io/eof.o
|
io/umask.o io/tell.o io/eof.o
|
||||||
|
|
||||||
STDLIB_OBJECTS = stdlib/abort.o stdlib/abs.o stdlib/atexit.o stdlib/atof.o stdlib/atoi.o stdlib/atold.o \
|
STDLIB_OBJECTS = stdlib/abort.o stdlib/abs.o stdlib/atexit.o stdlib/atof.o stdlib/atoi.o \
|
||||||
stdlib/bsearch.o stdlib/div.o stdlib/errno.o stdlib/exit.o \
|
stdlib/bsearch.o stdlib/div.o stdlib/errno.o stdlib/Exit.o \
|
||||||
stdlib/fullpath.o stdlib/labs.o stdlib/ldiv.o stdlib/llabs.o stdlib/lldiv.o \
|
stdlib/fullpath.o stdlib/labs.o stdlib/ldiv.o stdlib/llabs.o stdlib/lldiv.o \
|
||||||
stdlib/makepath.o stdlib/malloc.o stdlib/putenv.o stdlib/qsort.o \
|
stdlib/makepath.o stdlib/malloc.o stdlib/putenv.o stdlib/qsort.o \
|
||||||
stdlib/rand.o stdlib/senv.o stdlib/splitp.o stdlib/strtod.o stdlib/strtol.o \
|
stdlib/rand.o stdlib/senv.o stdlib/splitp.o stdlib/strtod.o stdlib/strtol.o \
|
||||||
stdlib/strtoul.o stdlib/strtold.o
|
stdlib/strtoul.o
|
||||||
|
|
||||||
SIGNAL_OBJECTS = signal/signal.o
|
SIGNAL_OBJECTS = signal/signal.o
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ PROCESS_OBJECTS = process/cwait.o process/dll.o process/spawnl.o process/spawnlp
|
||||||
process/spawnv.o process/spawnve.o process/spawnle.o process/execl.o process/execlp.o process/execlpe.o \
|
process/spawnv.o process/spawnve.o process/spawnle.o process/execl.o process/execlp.o process/execlpe.o \
|
||||||
process/execvpe.o process/execvp.o process/execv.o process/execle.o
|
process/execvpe.o process/execvp.o process/execv.o process/execle.o
|
||||||
|
|
||||||
TIME_OBJECTS = time/ctime.o time/difftime.o time/strftime.o
|
TIME_OBJECTS = time/ctime.o time/difftime.o time/strftime.o time/time.o time/clock.o
|
||||||
|
|
||||||
FLOAT_OBJECTS = float/fpreset.o float/clearfp.o float/cntrlfp.o float/statfp.o float/logb.o
|
FLOAT_OBJECTS = float/fpreset.o float/clearfp.o float/cntrlfp.o float/statfp.o float/logb.o
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,19 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#undef _acmdln_dll
|
||||||
|
char *_acmdln_dll;
|
||||||
|
#undef _commode_dll
|
||||||
|
unsigned int _commode_dll;
|
||||||
|
|
||||||
char *acmdln_dll;
|
#undef _winmajor_dll
|
||||||
unsigned int commode_dll;
|
unsigned int _winmajor_dll;
|
||||||
|
#undef _winminor_dll
|
||||||
unsigned int fmode_dll;
|
unsigned int _winminor_dll;
|
||||||
unsigned int winmajor_dll;
|
#undef _winver_dll
|
||||||
unsigned int winminor_dll;
|
unsigned int _winver_dll;
|
||||||
unsigned int winver_dll;
|
#undef _osver_dll
|
||||||
unsigned int osver_dll;
|
unsigned int _osver_dll;
|
||||||
|
|
||||||
#undef __argv
|
#undef __argv
|
||||||
#undef __argc
|
#undef __argc
|
||||||
|
@ -19,51 +23,46 @@ char *xargv[1024];
|
||||||
|
|
||||||
char **__argv = xargv;
|
char **__argv = xargv;
|
||||||
int __argc = 0;
|
int __argc = 0;
|
||||||
unsigned int *__argc_dll = &__argc;
|
int *__argc_dll = &__argc;
|
||||||
char ***__argv_dll = &__argv;
|
char ***__argv_dll = &__argv;
|
||||||
|
|
||||||
char *xenv;
|
|
||||||
|
#undef _environ
|
||||||
char **_environ;
|
char **_environ;
|
||||||
|
#undef _environ_dll
|
||||||
char *** _environ_dll = &_environ;
|
char *** _environ_dll = &_environ;
|
||||||
#undef environ
|
|
||||||
char **environ;
|
|
||||||
|
|
||||||
|
|
||||||
int __GetMainArgs(int *argc,char ***argv,char **env,int flag)
|
int __GetMainArgs(int *argc,char ***argv,char **env,int flag)
|
||||||
{
|
{
|
||||||
char *cmdline;
|
|
||||||
int i,afterlastspace;
|
int i,afterlastspace;
|
||||||
DWORD version;
|
DWORD version;
|
||||||
|
|
||||||
// acmdln_dll = cmdline = strdup( GetCommandLineA() );
|
_acmdln_dll = GetCommandLineA();
|
||||||
|
|
||||||
version = GetVersion();
|
version = GetVersion();
|
||||||
osver_dll = version >> 16;
|
_osver_dll = version >> 16;
|
||||||
winminor_dll = version & 0xFF;
|
_winminor_dll = version & 0xFF;
|
||||||
winmajor_dll = (version>>8) & 0xFF;
|
_winmajor_dll = (version>>8) & 0xFF;
|
||||||
winver_dll = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8);
|
_winver_dll = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8);
|
||||||
|
|
||||||
|
|
||||||
/* missing threading init */
|
/* missing threading init */
|
||||||
|
|
||||||
i=0;
|
i=0;
|
||||||
cmdline = GetCommandLineA();
|
|
||||||
afterlastspace=0;
|
afterlastspace=0;
|
||||||
|
|
||||||
dprintf("cmdline '%s'\n",cmdline);
|
|
||||||
|
|
||||||
while (cmdline[i])
|
while (_acmdln_dll[i]) {
|
||||||
{
|
if (_acmdln_dll[i]==' ') {
|
||||||
if (cmdline[i]==' ')
|
|
||||||
{
|
|
||||||
dprintf("cmdline '%s'\n",cmdline);
|
|
||||||
__argc++;
|
__argc++;
|
||||||
cmdline[i]='\0';
|
_acmdln_dll[i]='\0';
|
||||||
__argv[__argc-1] = strdup( cmdline+afterlastspace);
|
__argv[__argc-1] = strdup(_acmdln_dll+afterlastspace);
|
||||||
i++;
|
i++;
|
||||||
while (cmdline[i]==' ')
|
while (_acmdln_dll[i]==' ')
|
||||||
i++;
|
i++;
|
||||||
if (cmdline[i])
|
if (_acmdln_dll[i])
|
||||||
afterlastspace=i;
|
afterlastspace=i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -74,23 +73,21 @@ int __GetMainArgs(int *argc,char ***argv,char **env,int flag)
|
||||||
|
|
||||||
|
|
||||||
__argc++;
|
__argc++;
|
||||||
cmdline[i]='\0';
|
_acmdln_dll[i]='\0';
|
||||||
__argv[__argc-1] = strdup( cmdline+afterlastspace);
|
__argv[__argc-1] = strdup(_acmdln_dll+afterlastspace);
|
||||||
HeapValidate(GetProcessHeap(),0,NULL);
|
HeapValidate(GetProcessHeap(),0,NULL);
|
||||||
|
|
||||||
*argc = __argc;
|
_environ = (char **)GetEnvironmentStringsA();;
|
||||||
*argv = __argv;
|
|
||||||
|
|
||||||
|
|
||||||
// xenv = GetEnvironmentStringsA();
|
|
||||||
_environ = &xenv;
|
|
||||||
_environ_dll = &_environ;
|
_environ_dll = &_environ;
|
||||||
environ = &xenv;
|
|
||||||
env = &xenv;
|
argc = __argc_dll;
|
||||||
|
argv = __argv_dll;
|
||||||
|
env = _environ_dll;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _chkstk()
|
int _chkstk(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||||
|
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
extern char *const *_environ;
|
int _execl(const char *path, const char *argv0, ...)
|
||||||
|
|
||||||
int execl(const char *path, const char *argv0, ...)
|
|
||||||
{
|
{
|
||||||
return spawnve(P_OVERLAY, path, (char *const*)&argv0, _environ);
|
return _spawnve(P_OVERLAY, path, (char *const*)&argv0, _environ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
u.ccp = *++ptr; \
|
u.ccp = *++ptr; \
|
||||||
ptr = u.ccpp;
|
ptr = u.ccpp;
|
||||||
|
|
||||||
int execle(const char *path, const char *argv0, ... /*, const char **envp */)
|
int _execle(const char *path, const char *argv0, ... /*, const char **envp */)
|
||||||
{
|
{
|
||||||
scan_ptr();
|
scan_ptr();
|
||||||
return spawnve(P_OVERLAY, path, (char *const *)&argv0, (char *const *)ptr);
|
return _spawnve(P_OVERLAY, path, (char *const *)&argv0, (char *const *)ptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||||
|
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int _execlp(const char *path, const char *argv0, ...)
|
||||||
extern char * const *_environ;
|
|
||||||
|
|
||||||
int execlp(const char *path, const char *argv0, ...)
|
|
||||||
{
|
{
|
||||||
return spawnvpe(P_OVERLAY, path, (char * const *)&argv0, _environ);
|
return _spawnvpe(P_OVERLAY, path, (char * const *)&argv0, _environ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||||
//#include <libc/stubs.h>
|
|
||||||
//#include <unistd.h>
|
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
extern char * const *_environ;
|
int _execv(const char *path, const char * const *argv)
|
||||||
|
|
||||||
int execv(const char *path, const char * const *argv)
|
|
||||||
{
|
{
|
||||||
return spawnve(P_OVERLAY, path, argv, _environ);
|
return _spawnve(P_OVERLAY, path, argv, _environ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details *///#include <libc/stubs.h>
|
||||||
//#include <libc/stubs.h>
|
|
||||||
//#include <unistd.h>
|
//#include <unistd.h>
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
extern char *const *_environ;
|
int _execvp(const char *path,const char * const argv[])
|
||||||
|
|
||||||
int execvp(const char *path,const char * const argv[])
|
|
||||||
{
|
{
|
||||||
return spawnvpe(P_OVERLAY, path, argv, _environ);
|
return _spawnvpe(P_OVERLAY, path, argv, _environ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,9 @@
|
||||||
|
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
|
||||||
int execvpe(const char *path,const char * const argv[],const char * const envp[])
|
|
||||||
{
|
|
||||||
return spawnvpe(P_OVERLAY, path, argv, envp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int _execvpe(const char *path,const char * const argv[],const char * const envp[])
|
int _execvpe(const char *path,const char * const argv[],const char * const envp[])
|
||||||
{
|
{
|
||||||
return spawnvpe(P_OVERLAY, path, argv, envp);
|
return _spawnvpe(P_OVERLAY, path, argv, envp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
extern char **_environ;
|
extern char **_environ;
|
||||||
|
|
||||||
int spawnl(int mode, const char *path, const char *argv0, ...)
|
int _spawnl(int mode, const char *path, const char *argv0, ...)
|
||||||
{
|
{
|
||||||
return spawnve(mode, path, (char * const *)&argv0, _environ);
|
return spawnve(mode, path, (char * const *)&argv0, _environ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
u.ccp = *++ptr; \
|
u.ccp = *++ptr; \
|
||||||
ptr = u.ccpp;
|
ptr = u.ccpp;
|
||||||
|
|
||||||
int spawnle(int mode, const char *path, const char *argv0, ... /*, const char **envp */)
|
int _spawnle(int mode, const char *path, const char *argv0, ... /*, const char **envp */)
|
||||||
{
|
{
|
||||||
scan_ptr();
|
scan_ptr();
|
||||||
return spawnve(mode, path, (char * const *)&argv0, (char * const *)ptr);
|
return _spawnve(mode, path, (char * const *)&argv0, (char * const *)ptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||||
|
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
extern char **_environ;
|
int _spawnlp(int mode, const char *path, const char *argv0, ...)
|
||||||
|
|
||||||
int spawnlp(int mode, const char *path, const char *argv0, ...)
|
|
||||||
{
|
{
|
||||||
return spawnvpe(mode, path, (char * const *)&argv0, (char * const *)_environ);
|
return _spawnvpe(mode, path, (char * const *)&argv0, (char * const *)_environ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
u.ccp = *++ptr; \
|
u.ccp = *++ptr; \
|
||||||
ptr = u.ccpp;
|
ptr = u.ccpp;
|
||||||
|
|
||||||
int spawnlpe(int mode, const char *path, const char *argv0, ... /*, const char **envp */)
|
int _spawnlpe(int mode, const char *path, const char *argv0, ... /*, const char **envp */)
|
||||||
{
|
{
|
||||||
scan_ptr();
|
scan_ptr();
|
||||||
return spawnvpe(mode, path, (char * const *)&argv0, (char * const *)ptr);
|
return _spawnvpe(mode, path, (char * const *)&argv0, (char * const *)ptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||||
|
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
extern char **_environ;
|
|
||||||
|
|
||||||
int spawnv(int mode, const char *path,const char *const argv[])
|
int _spawnv(int mode, const char *path,const char *const argv[])
|
||||||
{
|
{
|
||||||
return spawnve(mode, path, (char * const *)argv, _environ);
|
return _spawnve(mode, path, (char * const *)argv, _environ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,10 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
int _p_overlay = 2;
|
int _p_overlay = 2;
|
||||||
|
|
||||||
int spawnve(int mode, const char *path,const char *const argv[],const char *const envp[])
|
int _spawnve(int mode, const char *path,const char *const argv[],const char *const envp[])
|
||||||
{
|
{
|
||||||
|
|
||||||
char ApplicationName[MAX_PATH];
|
char ApplicationName[MAX_PATH];
|
||||||
|
@ -35,7 +36,7 @@ int spawnve(int mode, const char *path,const char *const argv[],const char *cons
|
||||||
|
|
||||||
|
|
||||||
if (mode == P_OVERLAY)
|
if (mode == P_OVERLAY)
|
||||||
exit(i);
|
_exit(i);
|
||||||
|
|
||||||
// _P_NOWAIT or _P_NOWAITO
|
// _P_NOWAIT or _P_NOWAITO
|
||||||
return ProcessInformation.hProcess;
|
return ProcessInformation.hProcess;
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||||
|
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
#include <stdlib.h>
|
||||||
extern char **_environ;
|
|
||||||
|
|
||||||
int spawnvp(int mode, const char *path,const char *const argv[])
|
int spawnvp(int mode, const char *path,const char *const argv[])
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,20 +4,10 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
int spawnvpe(int mode, const char *path,const char *const argv[],const char *const envp[])
|
int _spawnvpe(int mode, const char *path,const char *const argv[],const char *const envp[])
|
||||||
{
|
{
|
||||||
|
|
||||||
char rpath[300];
|
char rpath[300];
|
||||||
union {const char * const *cpcp; char **cpp; } u;
|
|
||||||
u.cpcp = envp;
|
|
||||||
/*
|
|
||||||
if (!__dosexec_find_on_path(path, u.cpp, rpath))
|
|
||||||
{
|
|
||||||
errno = ENOENT;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*/
|
|
||||||
return spawnve(mode, rpath, argv, envp);
|
return spawnve(mode, rpath, argv, envp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||||
//#include <libc/stubs.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
//#include <unistd.h>
|
|
||||||
#include <libc/file.h>
|
#include <libc/file.h>
|
||||||
//#include <libc/local.h>
|
|
||||||
//#include <libc/dosio.h>
|
|
||||||
|
|
||||||
FILE * __alloc_file(void);
|
FILE * __alloc_file(void);
|
||||||
|
|
||||||
extern int _fmode;
|
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
fopen(const char *file, const char *mode)
|
fopen(const char *file, const char *mode)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <wchar.h>
|
||||||
#include <libc/file.h>
|
#include <libc/file.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -9,7 +10,7 @@ fputc(int c, FILE *fp)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fputwc(int c, FILE *fp)
|
fputwc(wchar_t c, FILE *fp)
|
||||||
{
|
{
|
||||||
return putc(c, fp);
|
return putc(c, fp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <libc/file.h>
|
#include <libc/file.h>
|
||||||
|
#include <string.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -35,7 +36,7 @@ fputs(const char *s, FILE *f)
|
||||||
return(r);
|
return(r);
|
||||||
*/
|
*/
|
||||||
int r = 0;
|
int r = 0;
|
||||||
if ( !WriteFile(filehnd(f->_file),s,strlen(s),&r,NULL) )
|
if ( !WriteFile(_get_osfhandle(f->_file),s,strlen(s),&r,NULL) )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||||
//#include <libc/stubs.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
//#include <unistd.h>
|
|
||||||
#include <libc/file.h>
|
#include <libc/file.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
|
||||||
extern int _fmode;
|
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
freopen(const char *file, const char *mode, FILE *f)
|
freopen(const char *file, const char *mode, FILE *f)
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <libc/file.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
fsetpos(FILE *stream, const fpos_t *pos)
|
fsetpos(FILE *stream, fpos_t *pos)
|
||||||
{
|
{
|
||||||
if (stream && pos)
|
if (stream && pos)
|
||||||
{
|
{
|
||||||
fseek(stream, (long)(*pos), SEEK_SET);
|
fseek(stream, (long)(*pos), SEEK_SET);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//errno = EFAULT;
|
__set_errno(EFAULT);
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,11 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <libc/file.h>
|
#include <libc/file.h>
|
||||||
|
|
||||||
#undef getc
|
|
||||||
int getc(FILE *f)
|
int getc(FILE *f)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
DWORD NumberOfBytesRead;
|
DWORD NumberOfBytesRead;
|
||||||
if ( !ReadFile(filehnd(f->_file),&c, 1, &NumberOfBytesRead, NULL) )
|
if ( !ReadFile(_get_osfhandle(f->_file),&c, 1, &NumberOfBytesRead, NULL) )
|
||||||
return -1;
|
return -1;
|
||||||
if ( NumberOfBytesRead == 0 )
|
if ( NumberOfBytesRead == 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <libc/file.h>
|
#include <libc/file.h>
|
||||||
|
|
||||||
#undef putc
|
|
||||||
int putc(int c, FILE *fp)
|
int putc(int c, FILE *fp)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ int putc(int c, FILE *fp)
|
||||||
}
|
}
|
||||||
return(_flsbuf(c,fp));
|
return(_flsbuf(c,fp));
|
||||||
}
|
}
|
||||||
if ( !WriteFile(filehnd(fp->_file),&c,1,&r,NULL) )
|
if ( !WriteFile(_get_osfhandle(fp->_file),&c,1,&r,NULL) )
|
||||||
return -1;
|
return -1;
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <io.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#undef putchar
|
#undef putchar
|
||||||
int
|
int
|
||||||
|
@ -14,8 +16,8 @@ puts(const char *s)
|
||||||
return putchar('\n');
|
return putchar('\n');
|
||||||
*/
|
*/
|
||||||
int r = 0;
|
int r = 0;
|
||||||
if ( !WriteFile(filehnd(stdout->_file),s,strlen(s),&r,NULL) )
|
if ( !WriteFile(_get_osfhandle(stdout->_file),s,strlen(s),&r,NULL) )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return putchar('\n');;
|
return putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
// #include <libc/unconst.h>
|
|
||||||
|
|
||||||
void *
|
void *
|
||||||
bsearch(const void *key, const void *base, size_t nelem,
|
bsearch(const void *key, const void *base0, size_t nelem,
|
||||||
size_t size, int (*cmp)(const void *ck, const void *ce))
|
size_t size, int (*cmp)(const void *ck, const void *ce))
|
||||||
{
|
{
|
||||||
|
char *base = (char *)base0;
|
||||||
int lim, cmpval;
|
int lim, cmpval;
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include <windows.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#undef errno
|
#undef errno
|
||||||
|
@ -6,6 +7,9 @@ int errno;
|
||||||
#undef _doserrno
|
#undef _doserrno
|
||||||
int _doserrno;
|
int _doserrno;
|
||||||
|
|
||||||
|
#undef _fpecode
|
||||||
|
int fpecode;
|
||||||
|
|
||||||
int *_errno(void)
|
int *_errno(void)
|
||||||
{
|
{
|
||||||
return &errno;
|
return &errno;
|
||||||
|
@ -22,7 +26,7 @@ int __set_errno (int error)
|
||||||
|
|
||||||
int * __fpecode ( void )
|
int * __fpecode ( void )
|
||||||
{
|
{
|
||||||
return NULL;
|
return &fpecode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int* __doserrno(void)
|
int* __doserrno(void)
|
||||||
|
|
|
@ -171,9 +171,8 @@ qst(char *base, char *max)
|
||||||
* with qst(), and then a cleanup insertion sort ourselves. Sound simple?
|
* with qst(), and then a cleanup insertion sort ourselves. Sound simple?
|
||||||
* It's not...
|
* It's not...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
qsort(void *base0, size_t n, size_t size, int (*compar)(const void *, const void *))
|
qsort(const void *base0, size_t n, size_t size, _pfunccmp_t compar)
|
||||||
{
|
{
|
||||||
char *base = (char *)base0;
|
char *base = (char *)base0;
|
||||||
char c, *i, *j, *lo, *hi;
|
char c, *i, *j, *lo, *hi;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <libc/file.h>
|
||||||
|
|
||||||
long
|
long
|
||||||
strtol(const char *nptr, char **endptr, int base)
|
strtol(const char *nptr, char **endptr, int base)
|
||||||
|
@ -81,7 +81,7 @@ strtol(const char *nptr, char **endptr, int base)
|
||||||
if (any < 0)
|
if (any < 0)
|
||||||
{
|
{
|
||||||
acc = neg ? LONG_MIN : LONG_MAX;
|
acc = neg ? LONG_MIN : LONG_MAX;
|
||||||
errno = ERANGE;
|
__set_errno(ERANGE);
|
||||||
}
|
}
|
||||||
else if (neg)
|
else if (neg)
|
||||||
acc = -acc;
|
acc = -acc;
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <libc/unconst.h>
|
#include <libc/file.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert a string to an unsigned long integer.
|
* Convert a string to an unsigned long integer.
|
||||||
|
@ -65,11 +66,11 @@ strtoul(const char *nptr, char **endptr, int base)
|
||||||
if (any < 0)
|
if (any < 0)
|
||||||
{
|
{
|
||||||
acc = ULONG_MAX;
|
acc = ULONG_MAX;
|
||||||
errno = ERANGE;
|
__set_errno(ERANGE);
|
||||||
}
|
}
|
||||||
else if (neg)
|
else if (neg)
|
||||||
acc = -acc;
|
acc = -acc;
|
||||||
if (endptr != 0)
|
if (endptr != 0)
|
||||||
*endptr = any ? unconst(s, char *) - 1 : unconst(nptr, char *);
|
*endptr = any ? (char *)s - 1 : (char *)nptr;
|
||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ fstat(int handle, struct stat *statbuf)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !GetFileInformationByHandle(filehnd(handle),&FileInformation) )
|
if ( !GetFileInformationByHandle(_get_osfhandle(handle),&FileInformation) )
|
||||||
return -1;
|
return -1;
|
||||||
statbuf->st_ctime = FileTimeToUnixTime( &FileInformation.ftCreationTime,NULL);
|
statbuf->st_ctime = FileTimeToUnixTime( &FileInformation.ftCreationTime,NULL);
|
||||||
statbuf->st_atime = FileTimeToUnixTime( &FileInformation.ftLastAccessTime,NULL);
|
statbuf->st_atime = FileTimeToUnixTime( &FileInformation.ftLastAccessTime,NULL);
|
||||||
|
|
34
reactos/lib/crtdll/time/clock.c
Normal file
34
reactos/lib/crtdll/time/clock.c
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS system libraries
|
||||||
|
* FILE: lib/crtdll/time/clock.c
|
||||||
|
* PURPOSE: Get elapsed time
|
||||||
|
* PROGRAMER: Boudewijn Dekker
|
||||||
|
* UPDATE HISTORY:
|
||||||
|
* 28/12/98: Created
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
// should be replace by a call to RtltimeToSecondsSince70
|
||||||
|
time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder );
|
||||||
|
|
||||||
|
clock_t clock ( void )
|
||||||
|
{
|
||||||
|
FILETIME CreationTime;
|
||||||
|
FILETIME ExitTime;
|
||||||
|
FILETIME KernelTime;
|
||||||
|
FILETIME UserTime;
|
||||||
|
|
||||||
|
FILETIME SystemTime;
|
||||||
|
DWORD Remainder;
|
||||||
|
|
||||||
|
if ( !GetProcessTimes(-1,&CreationTime,&ExitTime,&KernelTime,&UserTime ) )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if ( !GetSystemTimeAsFileTime(&SystemTime) )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return FileTimeToUnixTime( &SystemTime,&Remainder ) - FileTimeToUnixTime( &CreationTime,&Remainder );
|
||||||
|
}
|
|
@ -37,24 +37,8 @@ static char sccsid[] = "@(#)ctime.c 5.23 (Berkeley) 6/22/90";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _TM_DEFINED
|
|
||||||
struct tm {
|
|
||||||
int tm_sec;
|
|
||||||
int tm_min;
|
|
||||||
int tm_hour;
|
|
||||||
int tm_mday;
|
|
||||||
int tm_mon;
|
|
||||||
int tm_year;
|
|
||||||
int tm_wday;
|
|
||||||
int tm_yday;
|
|
||||||
int tm_isdst;
|
|
||||||
char *tm_zone;
|
|
||||||
int tm_gmtoff;
|
|
||||||
};
|
|
||||||
#define _TM_DEFINED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//#include <libc/stubs.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -63,11 +47,8 @@ struct tm {
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
//#include <unistd.h>
|
|
||||||
#include "tzfile.h"
|
#include "tzfile.h"
|
||||||
|
|
||||||
//#include <libc/unconst.h>
|
|
||||||
|
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
|
||||||
#include "posixrul.h"
|
#include "posixrul.h"
|
||||||
|
@ -1422,12 +1403,5 @@ mktime(struct tm * tmp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
time_t
|
|
||||||
time(time_t *t)
|
|
||||||
{
|
|
||||||
SYSTEMTIME SystemTime;
|
|
||||||
GetLocalTime(&SystemTime);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,6 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifndef _TM_DEFINED
|
|
||||||
struct tm {
|
|
||||||
int tm_sec;
|
|
||||||
int tm_min;
|
|
||||||
int tm_hour;
|
|
||||||
int tm_mday;
|
|
||||||
int tm_mon;
|
|
||||||
int tm_year;
|
|
||||||
int tm_wday;
|
|
||||||
int tm_yday;
|
|
||||||
int tm_isdst;
|
|
||||||
char *tm_zone;
|
|
||||||
int tm_gmtoff;
|
|
||||||
};
|
|
||||||
#define _TM_DEFINED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,27 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
/*
|
||||||
#ifndef _TM_DEFINED
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
struct tm {
|
* PROJECT: ReactOS system libraries
|
||||||
int tm_sec;
|
* FILE: lib/crtdll/conio/time.c
|
||||||
int tm_min;
|
* PURPOSE: Get system time
|
||||||
int tm_hour;
|
* PROGRAMER: Boudewijn Dekker
|
||||||
int tm_mday;
|
* UPDATE HISTORY:
|
||||||
int tm_mon;
|
* 28/12/98: Created
|
||||||
int tm_year;
|
*/
|
||||||
int tm_wday;
|
|
||||||
int tm_yday;
|
|
||||||
int tm_isdst;
|
|
||||||
char *tm_zone;
|
|
||||||
int tm_gmtoff;
|
|
||||||
};
|
|
||||||
#define _TM_DEFINED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
// should be replace by a call to RtltimeToSecondsSince70
|
||||||
|
// and moved to a header
|
||||||
|
|
||||||
|
time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder );
|
||||||
|
|
||||||
time_t
|
time_t
|
||||||
time(time_t *t)
|
time(time_t *t)
|
||||||
{
|
{
|
||||||
SYSTEMTIME SystemTime;
|
FILETIME SystemTime;
|
||||||
GetLocalTime(&SystemTime);
|
DWORD Remainder;
|
||||||
|
GetSystemTimeAsFileTime(&SystemTime);
|
||||||
|
return FileTimeToUnixTime( &SystemTime,&Remainder );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue