mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 02:25:17 +00:00
strip whitespace from end of lines
svn path=/trunk/; revision=15166
This commit is contained in:
parent
eace72f07c
commit
ae4b8f6e93
122 changed files with 366 additions and 366 deletions
|
@ -26,7 +26,7 @@ char *_cgets(char *string)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
maxlen_wanted = (unsigned int)((unsigned char)string[0]);
|
maxlen_wanted = (unsigned int)((unsigned char)string[0]);
|
||||||
sp = &(string[2]);
|
sp = &(string[2]);
|
||||||
/*
|
/*
|
||||||
* Should the string be shorter maxlen_wanted including or excluding
|
* Should the string be shorter maxlen_wanted including or excluding
|
||||||
* the trailing '\0' ? We don't take any risk.
|
* the trailing '\0' ? We don't take any risk.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,11 +19,11 @@ _cprintf(const char *fmt, ...)
|
||||||
int cnt;
|
int cnt;
|
||||||
char buf[ 2048 ]; /* this is buggy, because buffer might be too small. */
|
char buf[ 2048 ]; /* this is buggy, because buffer might be too small. */
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
cnt = vsprintf(buf, fmt, ap);
|
cnt = vsprintf(buf, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
_cputs(buf);
|
_cputs(buf);
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* 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
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/conio/getche.c
|
* FILE: lib/msvcrt/conio/getche.c
|
||||||
* PURPOSE: Reads a character from stdin
|
* PURPOSE: Reads a character from stdin
|
||||||
|
@ -25,7 +25,7 @@ int _getche(void)
|
||||||
* ungetch could have been called with a character that
|
* ungetch could have been called with a character that
|
||||||
* hasn't been got by a conio function.
|
* hasn't been got by a conio function.
|
||||||
* We don't echo again.
|
* We don't echo again.
|
||||||
*/
|
*/
|
||||||
return(_getch());
|
return(_getch());
|
||||||
return (_putch(_getch()));
|
return (_putch(_getch()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* 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
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/conio/ungetch.c
|
* FILE: lib/msvcrt/conio/ungetch.c
|
||||||
* PURPOSE: Ungets a character from stdin
|
* PURPOSE: Ungets a character from stdin
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* PURPOSE: C Runtime
|
* PURPOSE: C Runtime
|
||||||
* PROGRAMMER: Copyright (C) 1995 DJ Delorie
|
* PROGRAMMER: Copyright (C) 1995 DJ Delorie
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*
|
*
|
||||||
* _chdrive (MSVCRT.@)
|
* _chdrive (MSVCRT.@)
|
||||||
*
|
*
|
||||||
|
|
|
@ -23,13 +23,13 @@ _TCHAR* _tgetcwd(_TCHAR* buf, int size)
|
||||||
{
|
{
|
||||||
return _tcsdup(dir);
|
return _tcsdup(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dir_len >= size)
|
if (dir_len >= size)
|
||||||
{
|
{
|
||||||
__set_errno(ERANGE);
|
__set_errno(ERANGE);
|
||||||
return NULL; /* buf too small */
|
return NULL; /* buf too small */
|
||||||
}
|
}
|
||||||
|
|
||||||
_tcscpy(buf,dir);
|
_tcscpy(buf,dir);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
* _getdcwd (MSVCRT.@)
|
* _getdcwd (MSVCRT.@)
|
||||||
*
|
*
|
||||||
* Get the current working directory on a given disk.
|
* Get the current working directory on a given disk.
|
||||||
*
|
*
|
||||||
* PARAMS
|
* PARAMS
|
||||||
* drive [I] Drive letter to get the current working directory from.
|
* drive [I] Drive letter to get the current working directory from.
|
||||||
* buf [O] Destination for the current working directory.
|
* buf [O] Destination for the current working directory.
|
||||||
|
|
|
@ -16,7 +16,7 @@ double _chgsign( double __x )
|
||||||
|
|
||||||
if ( u.x->sign == 1 )
|
if ( u.x->sign == 1 )
|
||||||
u.x->sign = 0;
|
u.x->sign = 0;
|
||||||
else
|
else
|
||||||
u.x->sign = 1;
|
u.x->sign = 1;
|
||||||
|
|
||||||
return __x;
|
return __x;
|
||||||
|
|
|
@ -37,11 +37,11 @@ unsigned int _control87(unsigned int unNew, unsigned int unMask)
|
||||||
{
|
{
|
||||||
unsigned int FpuCw;
|
unsigned int FpuCw;
|
||||||
unsigned int DummyCw = 0;
|
unsigned int DummyCw = 0;
|
||||||
|
|
||||||
/* get the controlword */
|
/* get the controlword */
|
||||||
asm volatile("fstcw %0\n\t" : "=m"(FpuCw));
|
asm volatile("fstcw %0\n\t" : "=m"(FpuCw));
|
||||||
FpuCw &= 0x0000ffff;
|
FpuCw &= 0x0000ffff;
|
||||||
|
|
||||||
/* translate it into _control87 format */
|
/* translate it into _control87 format */
|
||||||
if (FpuCw & X87_CW_IM)
|
if (FpuCw & X87_CW_IM)
|
||||||
DummyCw |= _EM_INVALID;
|
DummyCw |= _EM_INVALID;
|
||||||
|
@ -88,10 +88,10 @@ unsigned int _control87(unsigned int unNew, unsigned int unMask)
|
||||||
/* unset (un)masked bits */
|
/* unset (un)masked bits */
|
||||||
DummyCw &= ~unMask;
|
DummyCw &= ~unMask;
|
||||||
unNew &= unMask;
|
unNew &= unMask;
|
||||||
|
|
||||||
/* set new bits */
|
/* set new bits */
|
||||||
DummyCw |= unNew;
|
DummyCw |= unNew;
|
||||||
|
|
||||||
/* translate back into x87 format
|
/* translate back into x87 format
|
||||||
* FIXME: translate infinity control!
|
* FIXME: translate infinity control!
|
||||||
*/
|
*/
|
||||||
|
@ -141,7 +141,7 @@ unsigned int _control87(unsigned int unNew, unsigned int unMask)
|
||||||
|
|
||||||
/* set controlword */
|
/* set controlword */
|
||||||
asm volatile("fldcw %0" : : "m"(FpuCw));
|
asm volatile("fldcw %0" : : "m"(FpuCw));
|
||||||
|
|
||||||
return DummyCw;
|
return DummyCw;
|
||||||
|
|
||||||
#if 0 /* The follwing is the original code, broken I think! -blight */
|
#if 0 /* The follwing is the original code, broken I think! -blight */
|
||||||
|
|
|
@ -11,7 +11,7 @@ double _copysign (double __d, double __s)
|
||||||
double* __d;
|
double* __d;
|
||||||
double_t* d;
|
double_t* d;
|
||||||
} d;
|
} d;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
double* __s;
|
double* __s;
|
||||||
double_t* s;
|
double_t* s;
|
||||||
|
|
|
@ -36,7 +36,7 @@ typedef int fpclass_t;
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
fpclass_t _fpclass(double __d)
|
fpclass_t _fpclass(double __d)
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
double* __d;
|
double* __d;
|
||||||
|
@ -63,14 +63,14 @@ fpclass_t _fpclass(double __d)
|
||||||
return FP_NINF;
|
return FP_NINF;
|
||||||
else
|
else
|
||||||
return FP_PINF;
|
return FP_PINF;
|
||||||
}
|
}
|
||||||
else if ( d.d->mantissah == 0 && d.d->mantissal != 0 ) {
|
else if ( d.d->mantissah == 0 && d.d->mantissal != 0 ) {
|
||||||
return FP_QNAN;
|
return FP_QNAN;
|
||||||
}
|
}
|
||||||
else if ( d.d->mantissah == 0 && d.d->mantissal != 0 ) {
|
else if ( d.d->mantissah == 0 && d.d->mantissal != 0 ) {
|
||||||
return FP_SNAN;
|
return FP_SNAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,14 @@ Cambridge, MA 02139, USA. */
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
int _isnan(double __x)
|
int _isnan(double __x)
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
double* __x;
|
double* __x;
|
||||||
double_t* x;
|
double_t* x;
|
||||||
} x;
|
} x;
|
||||||
x.__x = &__x;
|
x.__x = &__x;
|
||||||
return ( x.x->exponent == 0x7ff && ( x.x->mantissah != 0 || x.x->mantissal != 0 ));
|
return ( x.x->exponent == 0x7ff && ( x.x->mantissah != 0 || x.x->mantissal != 0 ));
|
||||||
}
|
}
|
||||||
|
|
||||||
int _isnanl(long double __x)
|
int _isnanl(long double __x)
|
||||||
|
@ -45,26 +45,26 @@ int _isnanl(long double __x)
|
||||||
long_double_t* x;
|
long_double_t* x;
|
||||||
} x;
|
} x;
|
||||||
x.__x = &__x;
|
x.__x = &__x;
|
||||||
|
|
||||||
|
|
||||||
/* IEEE 854 NaN's have the maximum possible
|
/* IEEE 854 NaN's have the maximum possible
|
||||||
exponent and a nonzero mantissa. */
|
exponent and a nonzero mantissa. */
|
||||||
|
|
||||||
return (( x.x->exponent == 0x7fff)
|
return (( x.x->exponent == 0x7fff)
|
||||||
&& ( (x.x->mantissah & 0x80000000) != 0)
|
&& ( (x.x->mantissah & 0x80000000) != 0)
|
||||||
&& ( (x.x->mantissah & (unsigned int)0x7fffffff) != 0 || x.x->mantissal != 0 ));
|
&& ( (x.x->mantissah & (unsigned int)0x7fffffff) != 0 || x.x->mantissal != 0 ));
|
||||||
}
|
}
|
||||||
|
|
||||||
int _isinf(double __x)
|
int _isinf(double __x)
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
double* __x;
|
double* __x;
|
||||||
double_t* x;
|
double_t* x;
|
||||||
} x;
|
} x;
|
||||||
|
|
||||||
x.__x = &__x;
|
x.__x = &__x;
|
||||||
return ( x.x->exponent == 0x7ff && ( x.x->mantissah == 0 && x.x->mantissal == 0 ));
|
return ( x.x->exponent == 0x7ff && ( x.x->mantissah == 0 && x.x->mantissal == 0 ));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -84,14 +84,14 @@ int _isinfl(long double __x)
|
||||||
long double* __x;
|
long double* __x;
|
||||||
long_double_t* x;
|
long_double_t* x;
|
||||||
} x;
|
} x;
|
||||||
|
|
||||||
x.__x = &__x;
|
x.__x = &__x;
|
||||||
|
|
||||||
|
|
||||||
/* An IEEE 854 infinity has an exponent with the
|
/* An IEEE 854 infinity has an exponent with the
|
||||||
maximum possible value and a zero mantissa. */
|
maximum possible value and a zero mantissa. */
|
||||||
|
|
||||||
|
|
||||||
if ( x.x->exponent == 0x7fff && ( (x.x->mantissah == 0x80000000 ) && x.x->mantissal == 0 ))
|
if ( x.x->exponent == 0x7fff && ( (x.x->mantissah == 0x80000000 ) && x.x->mantissal == 0 ))
|
||||||
return x.x->sign ? -1 : 1;
|
return x.x->sign ? -1 : 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -5,15 +5,15 @@
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
double _scalb( double __x, long e )
|
double _scalb( double __x, long e )
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
double* __x;
|
double* __x;
|
||||||
double_t* x;
|
double_t* x;
|
||||||
} x;
|
} x;
|
||||||
|
|
||||||
x.__x = &__x;
|
x.__x = &__x;
|
||||||
|
|
||||||
x.x->exponent += e;
|
x.x->exponent += e;
|
||||||
|
|
||||||
return __x;
|
return __x;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
unsigned int _statusfp (void)
|
unsigned int _statusfp (void)
|
||||||
{
|
{
|
||||||
|
|
||||||
register unsigned short __res;
|
register unsigned short __res;
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* float.h
|
* float.h
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is a part of the mingw-runtime package.
|
* This file is a part of the mingw-runtime package.
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
* NOTE: GCC provides float.h, but it doesn't include the non-standard
|
* NOTE: GCC provides float.h, but it doesn't include the non-standard
|
||||||
* stuff for accessing the fp controller. We include_next the
|
* stuff for accessing the fp controller. We include_next the
|
||||||
* GCC-supplied header and just define the MS-specific extensions
|
* GCC-supplied header and just define the MS-specific extensions
|
||||||
* here.
|
* here.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ _CRTIMP unsigned int __cdecl _statusfp (void); /* Report the FPU status word */
|
||||||
word to 0x37f (64 bit mantissa precison rather than 53 bit).
|
word to 0x37f (64 bit mantissa precison rather than 53 bit).
|
||||||
By default, the mingw version of _fpreset sets fp control as
|
By default, the mingw version of _fpreset sets fp control as
|
||||||
per fninit. To use the MSVCRT.dll _fpreset, include CRT_fp8.o when
|
per fninit. To use the MSVCRT.dll _fpreset, include CRT_fp8.o when
|
||||||
building your application.
|
building your application.
|
||||||
*/
|
*/
|
||||||
void __cdecl _fpreset (void);
|
void __cdecl _fpreset (void);
|
||||||
void __cdecl fpreset (void);
|
void __cdecl fpreset (void);
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: include/msvcrt/msvcrtdbg.h
|
* FILE: include/msvcrt/msvcrtdbg.h
|
||||||
* PURPOSE: Useful debugging macros
|
* PURPOSE: Useful debugging macros
|
||||||
* PROGRAMMER:
|
* PROGRAMMER:
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -24,12 +24,12 @@
|
||||||
|
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
#define sT "S"
|
#define sT "S"
|
||||||
#else
|
#else
|
||||||
#define sT "s"
|
#define sT "s"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define TRACE(...)
|
#define TRACE(...)
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
#define CHECKPOINT1
|
#define CHECKPOINT1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(NDEBUG) && defined(DBG)
|
#if !defined(NDEBUG) && defined(DBG)
|
||||||
#define DPRINT(args...) do { DbgPrint("(MSVCRT:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
#define DPRINT(args...) do { DbgPrint("(MSVCRT:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
||||||
#define CHECKPOINT do { DbgPrint("MSVCRT:%s:%d\n",__FILE__,__LINE__); } while(0);
|
#define CHECKPOINT do { DbgPrint("MSVCRT:%s:%d\n",__FILE__,__LINE__); } while(0);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -59,7 +59,7 @@ time_t FileTimeToUnixTime(const FILETIME* filetime, DWORD *remainder);
|
||||||
|
|
||||||
|
|
||||||
#define __FILE_REC_MAX 20
|
#define __FILE_REC_MAX 20
|
||||||
typedef struct __file_rec
|
typedef struct __file_rec
|
||||||
{
|
{
|
||||||
struct __file_rec* next;
|
struct __file_rec* next;
|
||||||
int count;
|
int count;
|
||||||
|
@ -178,8 +178,8 @@ int _isinf(double x);
|
||||||
#define _IOLBF 0x0040 /* line buffered */
|
#define _IOLBF 0x0040 /* line buffered */
|
||||||
#define _IONBF 0x0004 /* not buffered */
|
#define _IONBF 0x0004 /* not buffered */
|
||||||
|
|
||||||
#define _IO_LBF 0x80000 /* this value is used insteat of _IOLBF within the
|
#define _IO_LBF 0x80000 /* this value is used insteat of _IOLBF within the
|
||||||
structure FILE as value for _flags,
|
structure FILE as value for _flags,
|
||||||
because _IOLBF has the same value as _IOSTRG */
|
because _IOLBF has the same value as _IOSTRG */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ int _taccess( const _TCHAR *_path, int _amode )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,8 +50,8 @@ int access_dirT(const _TCHAR *_path)
|
||||||
_dosmaperr(GetLastError());
|
_dosmaperr(GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY)
|
if ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY)
|
||||||
{
|
{
|
||||||
__set_errno(EACCES);
|
__set_errno(EACCES);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -30,7 +30,7 @@ int _tchmod(const _TCHAR* filename, mode_t mode)
|
||||||
|
|
||||||
if ( mode == 0 )
|
if ( mode == 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (mode & _S_IWRITE) {
|
if (mode & _S_IWRITE) {
|
||||||
if (FileAttributes & FILE_ATTRIBUTE_READONLY) {
|
if (FileAttributes & FILE_ATTRIBUTE_READONLY) {
|
||||||
FileAttributes &= ~FILE_ATTRIBUTE_READONLY;
|
FileAttributes &= ~FILE_ATTRIBUTE_READONLY;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
int _close(int _fd)
|
int _close(int _fd)
|
||||||
{
|
{
|
||||||
TRACE("_close(%i)", _fd);
|
TRACE("_close(%i)", _fd);
|
||||||
|
|
||||||
if (_fd == -1)
|
if (_fd == -1)
|
||||||
return(-1);
|
return(-1);
|
||||||
if (CloseHandle((HANDLE)_get_osfhandle(_fd)) == FALSE)
|
if (CloseHandle((HANDLE)_get_osfhandle(_fd)) == FALSE)
|
||||||
|
|
|
@ -13,18 +13,18 @@ int _dup(int handle)
|
||||||
HANDLE hProcess = GetCurrentProcess();
|
HANDLE hProcess = GetCurrentProcess();
|
||||||
BOOL result;
|
BOOL result;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
hFile = (HANDLE)_get_osfhandle(handle);
|
hFile = (HANDLE)_get_osfhandle(handle);
|
||||||
if (hFile == INVALID_HANDLE_VALUE) {
|
if (hFile == INVALID_HANDLE_VALUE) {
|
||||||
__set_errno(EBADF);
|
__set_errno(EBADF);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
result = DuplicateHandle(hProcess,
|
result = DuplicateHandle(hProcess,
|
||||||
hFile,
|
hFile,
|
||||||
hProcess,
|
hProcess,
|
||||||
&hFile,
|
&hFile,
|
||||||
0,
|
0,
|
||||||
TRUE,
|
TRUE,
|
||||||
DUPLICATE_SAME_ACCESS);
|
DUPLICATE_SAME_ACCESS);
|
||||||
if (result == FALSE) {
|
if (result == FALSE) {
|
||||||
_dosmaperr(GetLastError());
|
_dosmaperr(GetLastError());
|
||||||
|
|
|
@ -64,7 +64,7 @@ int _tfindnext(
|
||||||
long handle,
|
long handle,
|
||||||
#else
|
#else
|
||||||
int handle,
|
int handle,
|
||||||
#endif
|
#endif
|
||||||
struct _tfinddata_t* result)
|
struct _tfinddata_t* result)
|
||||||
{
|
{
|
||||||
WIN32_FIND_DATA FindFileData;
|
WIN32_FIND_DATA FindFileData;
|
||||||
|
|
|
@ -15,6 +15,6 @@ int _locking(int _fd, int mode, long nbytes)
|
||||||
_dosmaperr(GetLastError());
|
_dosmaperr(GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ __int64 _lseeki64(int _fildes, __int64 _offset, int _whence)
|
||||||
LARGE_INTEGER offset;
|
LARGE_INTEGER offset;
|
||||||
offset.QuadPart = _offset;
|
offset.QuadPart = _offset;
|
||||||
|
|
||||||
offset.u.LowPart = SetFilePointer((HANDLE)fdinfo(_fildes)->hFile,
|
offset.u.LowPart = SetFilePointer((HANDLE)fdinfo(_fildes)->hFile,
|
||||||
offset.u.LowPart, &offset.u.HighPart, _whence);
|
offset.u.LowPart, &offset.u.HighPart, _whence);
|
||||||
return ((((__int64)offset.u.HighPart) << 32) + offset.u.LowPart);
|
return ((((__int64)offset.u.HighPart) << 32) + offset.u.LowPart);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* 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
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/io/mktemp.c
|
* FILE: lib/msvcrt/io/mktemp.c
|
||||||
* PURPOSE: Makes a temp file based on a template
|
* PURPOSE: Makes a temp file based on a template
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* Copyright 2004 Eric Pouech
|
* Copyright 2004 Eric Pouech
|
||||||
* Copyright 2004 Juan Lang
|
* Copyright 2004 Juan Lang
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// rember to interlock the allocation of fileno when making this thread safe
|
// rember to interlock the allocation of fileno when making this thread safe
|
||||||
|
|
||||||
// possibly store extra information at the handle
|
// possibly store extra information at the handle
|
||||||
|
@ -97,13 +97,13 @@ static inline FD_INFO* fdinfo(int fd)
|
||||||
inline BOOL is_valid_fd(int fd)
|
inline BOOL is_valid_fd(int fd)
|
||||||
{
|
{
|
||||||
BOOL b = (fd >= 0 && fd < g_fdend && (fdinfo(fd)->fdflags & FOPEN));
|
BOOL b = (fd >= 0 && fd < g_fdend && (fdinfo(fd)->fdflags & FOPEN));
|
||||||
|
|
||||||
if (!b){
|
if (!b){
|
||||||
DPRINT1("not valid fd %i, g_fdend %i, fdinfo %x, bucket %x, fdflags %x\n",
|
DPRINT1("not valid fd %i, g_fdend %i, fdinfo %x, bucket %x, fdflags %x\n",
|
||||||
fd,g_fdend,fdinfo(fd),fdinfo_bucket(fd),fdinfo(fd)->fdflags);
|
fd,g_fdend,fdinfo(fd),fdinfo_bucket(fd),fdinfo(fd)->fdflags);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,12 +115,12 @@ char split_oflags(int oflags)
|
||||||
char fdflags = 0;
|
char fdflags = 0;
|
||||||
|
|
||||||
if (oflags & _O_APPEND) fdflags |= FAPPEND;
|
if (oflags & _O_APPEND) fdflags |= FAPPEND;
|
||||||
|
|
||||||
if (oflags & _O_BINARY) ;
|
if (oflags & _O_BINARY) ;
|
||||||
else if (oflags & _O_TEXT) fdflags |= FTEXT;
|
else if (oflags & _O_TEXT) fdflags |= FTEXT;
|
||||||
else if (_fmode& _O_BINARY) ;
|
else if (_fmode& _O_BINARY) ;
|
||||||
else fdflags |= FTEXT; /* default to TEXT*/
|
else fdflags |= FTEXT; /* default to TEXT*/
|
||||||
|
|
||||||
if (oflags & _O_NOINHERIT) fdflags |= FNOINHERIT;
|
if (oflags & _O_NOINHERIT) fdflags |= FNOINHERIT;
|
||||||
|
|
||||||
if (oflags & ~(_O_BINARY|_O_TEXT|_O_APPEND|_O_TRUNC|
|
if (oflags & ~(_O_BINARY|_O_TEXT|_O_APPEND|_O_TRUNC|
|
||||||
|
@ -235,7 +235,7 @@ int _open(const char* _path, int _oflag,...)
|
||||||
|
|
||||||
hFile = CreateFileA(_path,
|
hFile = CreateFileA(_path,
|
||||||
dwDesiredAccess,
|
dwDesiredAccess,
|
||||||
dwShareMode,
|
dwShareMode,
|
||||||
&sa,
|
&sa,
|
||||||
dwCreationDistribution,
|
dwCreationDistribution,
|
||||||
dwFlagsAndAttributes,
|
dwFlagsAndAttributes,
|
||||||
|
@ -259,9 +259,9 @@ int _open(const char* _path, int _oflag,...)
|
||||||
static void init_bucket(FDINFO* entry)
|
static void init_bucket(FDINFO* entry)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0;
|
for(i=0;
|
||||||
i < FDINFO_ENTRIES_PER_BUCKET;
|
i < FDINFO_ENTRIES_PER_BUCKET;
|
||||||
i++, entry++)
|
i++, entry++)
|
||||||
{
|
{
|
||||||
entry->hFile = INVALID_HANDLE_VALUE;
|
entry->hFile = INVALID_HANDLE_VALUE;
|
||||||
|
@ -278,29 +278,29 @@ static BOOL alloc_init_bucket(int fd)
|
||||||
{
|
{
|
||||||
fdinfo_bucket(fd) = malloc(FDINFO_ENTRIES_PER_BUCKET * sizeof(FDINFO));
|
fdinfo_bucket(fd) = malloc(FDINFO_ENTRIES_PER_BUCKET * sizeof(FDINFO));
|
||||||
if (!fdinfo_bucket(fd)) return FALSE;
|
if (!fdinfo_bucket(fd)) return FALSE;
|
||||||
|
|
||||||
init_bucket(fdinfo_bucket(fd));
|
init_bucket(fdinfo_bucket(fd));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* INTERNAL
|
* INTERNAL
|
||||||
* Allocate an fd slot from a Win32 HANDLE, starting from fd
|
* Allocate an fd slot from a Win32 HANDLE, starting from fd
|
||||||
* caller must hold the files lock
|
* caller must hold the files lock
|
||||||
*/
|
*/
|
||||||
static int alloc_fd_from(HANDLE hand, char flag, int fd)
|
static int alloc_fd_from(HANDLE hand, char flag, int fd)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (fd >= FDINFO_ENTRIES)
|
if (fd >= FDINFO_ENTRIES)
|
||||||
{
|
{
|
||||||
DPRINT1("files exhausted!\n");
|
DPRINT1("files exhausted!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fdinfo_bucket(fd))
|
if (!fdinfo_bucket(fd))
|
||||||
{
|
{
|
||||||
if (!alloc_init_bucket(fd)){
|
if (!alloc_init_bucket(fd)){
|
||||||
|
@ -308,10 +308,10 @@ static int alloc_fd_from(HANDLE hand, char flag, int fd)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fdinfo(fd)->hFile = hand;
|
fdinfo(fd)->hFile = hand;
|
||||||
fdinfo(fd)->fdflags = FOPEN | (flag & (FNOINHERIT | FAPPEND | FTEXT));
|
fdinfo(fd)->fdflags = FOPEN | (flag & (FNOINHERIT | FAPPEND | FTEXT));
|
||||||
fdinfo(fd)->pipechar = LF;
|
fdinfo(fd)->pipechar = LF;
|
||||||
fdinfo(fd)->lockinitflag = 0;
|
fdinfo(fd)->lockinitflag = 0;
|
||||||
//fdinfo(fd)->lock
|
//fdinfo(fd)->lock
|
||||||
|
|
||||||
|
@ -342,9 +342,9 @@ static int alloc_fd_from(HANDLE hand, char flag, int fd)
|
||||||
{
|
{
|
||||||
g_fdstart++;
|
g_fdstart++;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update last fd in use */
|
/* update last fd in use */
|
||||||
if (fd >= g_fdend)
|
if (fd >= g_fdend)
|
||||||
g_fdend = fd + 1;
|
g_fdend = fd + 1;
|
||||||
|
@ -369,18 +369,18 @@ static int alloc_fd_from(HANDLE hand, char flag, int fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* INTERNAL: Allocate an fd slot from a Win32 HANDLE
|
* INTERNAL: Allocate an fd slot from a Win32 HANDLE
|
||||||
*/
|
*/
|
||||||
int alloc_fd(HANDLE hand, char flag)
|
int alloc_fd(HANDLE hand, char flag)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
LOCK_FILES();
|
LOCK_FILES();
|
||||||
|
|
||||||
// TRACE(":handle (%p) allocating fd (%d)\n",hand,MSVCRT_fdstart);
|
// TRACE(":handle (%p) allocating fd (%d)\n",hand,MSVCRT_fdstart);
|
||||||
ret = alloc_fd_from(hand, flag, g_fdstart);
|
ret = alloc_fd_from(hand, flag, g_fdstart);
|
||||||
|
|
||||||
UNLOCK_FILES();
|
UNLOCK_FILES();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -406,11 +406,11 @@ char __fileno_getmode(int fd)
|
||||||
void free_fd(int fd)
|
void free_fd(int fd)
|
||||||
{
|
{
|
||||||
LOCK_FILES();
|
LOCK_FILES();
|
||||||
|
|
||||||
|
|
||||||
fdinfo(fd)->hFile = INVALID_HANDLE_VALUE;
|
fdinfo(fd)->hFile = INVALID_HANDLE_VALUE;
|
||||||
fdinfo(fd)->fdflags = 0;
|
fdinfo(fd)->fdflags = 0;
|
||||||
|
|
||||||
if (fd < 3) /* don't use 0,1,2 for user files */
|
if (fd < 3) /* don't use 0,1,2 for user files */
|
||||||
{
|
{
|
||||||
switch (fd)
|
switch (fd)
|
||||||
|
@ -424,12 +424,12 @@ void free_fd(int fd)
|
||||||
{
|
{
|
||||||
if (fd == g_fdend - 1)
|
if (fd == g_fdend - 1)
|
||||||
g_fdend--;
|
g_fdend--;
|
||||||
|
|
||||||
if (fd < g_fdstart)
|
if (fd < g_fdstart)
|
||||||
g_fdstart = fd;
|
g_fdstart = fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UNLOCK_FILES();
|
UNLOCK_FILES();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,10 +443,10 @@ int _open_osfhandle(long osfhandle, int oflags)
|
||||||
The _open_osfhandle() function in MSVCRT is expected to take the absence
|
The _open_osfhandle() function in MSVCRT is expected to take the absence
|
||||||
of either _O_TEXT or _O_BINARY to mean _O_BINARY. Currently it defaults to
|
of either _O_TEXT or _O_BINARY to mean _O_BINARY. Currently it defaults to
|
||||||
_O_TEXT.
|
_O_TEXT.
|
||||||
|
|
||||||
An example of this is MFC's CStdioFile::Open in binary mode - it passes flags
|
An example of this is MFC's CStdioFile::Open in binary mode - it passes flags
|
||||||
of 0 when it wants to write a binary file - under WINE we do text mode conversions!
|
of 0 when it wants to write a binary file - under WINE we do text mode conversions!
|
||||||
|
|
||||||
The attached patch ensures that _O_BINARY is set if neither is set in the passed-in
|
The attached patch ensures that _O_BINARY is set if neither is set in the passed-in
|
||||||
flags.
|
flags.
|
||||||
|
|
||||||
|
@ -485,7 +485,7 @@ flags.
|
||||||
long _get_osfhandle(int fd)
|
long _get_osfhandle(int fd)
|
||||||
{
|
{
|
||||||
TRACE("_get_osfhandle(%i)",fd);
|
TRACE("_get_osfhandle(%i)",fd);
|
||||||
|
|
||||||
if (!is_valid_fd(fd)) {
|
if (!is_valid_fd(fd)) {
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
@ -501,29 +501,29 @@ int __fileno_dup2(int handle1, int handle2)
|
||||||
{
|
{
|
||||||
HANDLE hProcess;
|
HANDLE hProcess;
|
||||||
BOOL result;
|
BOOL result;
|
||||||
|
|
||||||
if (handle1 >= FDINFO_ENTRIES || handle1 < 0 || handle2 >= FDINFO_ENTRIES || handle2 < 0) {
|
if (handle1 >= FDINFO_ENTRIES || handle1 < 0 || handle2 >= FDINFO_ENTRIES || handle2 < 0) {
|
||||||
__set_errno(EBADF);
|
__set_errno(EBADF);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// if (_pioinfo[handle1]->fd == -1) {
|
// if (_pioinfo[handle1]->fd == -1) {
|
||||||
if (fdinfo(handle1)->hFile == INVALID_HANDLE_VALUE) {
|
if (fdinfo(handle1)->hFile == INVALID_HANDLE_VALUE) {
|
||||||
__set_errno(EBADF);
|
__set_errno(EBADF);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (handle1 == handle2)
|
if (handle1 == handle2)
|
||||||
return handle1;
|
return handle1;
|
||||||
// if (_pioinfo[handle2]->fd != -1) {
|
// if (_pioinfo[handle2]->fd != -1) {
|
||||||
if (fdinfo(handle2)->hFile != INVALID_HANDLE_VALUE) {
|
if (fdinfo(handle2)->hFile != INVALID_HANDLE_VALUE) {
|
||||||
_close(handle2);
|
_close(handle2);
|
||||||
}
|
}
|
||||||
hProcess = GetCurrentProcess();
|
hProcess = GetCurrentProcess();
|
||||||
result = DuplicateHandle(hProcess,
|
result = DuplicateHandle(hProcess,
|
||||||
fdinfo(handle1)->hFile,
|
fdinfo(handle1)->hFile,
|
||||||
hProcess,
|
hProcess,
|
||||||
&fdinfo(handle2)->hFile,
|
&fdinfo(handle2)->hFile,
|
||||||
0,
|
0,
|
||||||
TRUE,
|
TRUE,
|
||||||
DUPLICATE_SAME_ACCESS);
|
DUPLICATE_SAME_ACCESS);
|
||||||
if (result) {
|
if (result) {
|
||||||
// _pioinfo[handle2]->fd = handle2;
|
// _pioinfo[handle2]->fd = handle2;
|
||||||
|
@ -539,7 +539,7 @@ int __fileno_dup2(int handle1, int handle2)
|
||||||
SetStdHandle(STD_ERROR_HANDLE, fdinfo(handle2)->hFile);
|
SetStdHandle(STD_ERROR_HANDLE, fdinfo(handle2)->hFile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return handle1;
|
return handle1;
|
||||||
} else {
|
} else {
|
||||||
__set_errno(EMFILE); // Is this the correct error no.?
|
__set_errno(EMFILE); // Is this the correct error no.?
|
||||||
|
@ -563,7 +563,7 @@ BOOL __fileno_init(void)
|
||||||
init_bucket(first_bucket);
|
init_bucket(first_bucket);
|
||||||
|
|
||||||
GetStartupInfoA(&si);
|
GetStartupInfoA(&si);
|
||||||
|
|
||||||
if (si.cbReserved2 != 0 && si.lpReserved2 != NULL)
|
if (si.cbReserved2 != 0 && si.lpReserved2 != NULL)
|
||||||
{
|
{
|
||||||
char* fdflags_ptr;
|
char* fdflags_ptr;
|
||||||
|
@ -584,7 +584,7 @@ BOOL __fileno_init(void)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*fdflags_ptr & FOPEN) && *handle_ptr != INVALID_HANDLE_VALUE)
|
if ((*fdflags_ptr & FOPEN) && *handle_ptr != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
fdinfo(i)->fdflags = *fdflags_ptr;
|
fdinfo(i)->fdflags = *fdflags_ptr;
|
||||||
|
@ -596,13 +596,13 @@ BOOL __fileno_init(void)
|
||||||
fdinfo(i)->fdflags = 0;
|
fdinfo(i)->fdflags = 0;
|
||||||
fdinfo(i)->hFile = INVALID_HANDLE_VALUE;
|
fdinfo(i)->hFile = INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
fdflags_ptr++; handle_ptr++;
|
fdflags_ptr++; handle_ptr++;
|
||||||
}
|
}
|
||||||
for (g_fdstart = 3; g_fdstart < g_fdend; g_fdstart++)
|
for (g_fdstart = 3; g_fdstart < g_fdend; g_fdstart++)
|
||||||
if (fdinfo(g_fdstart)->hFile == INVALID_HANDLE_VALUE) break;
|
if (fdinfo(g_fdstart)->hFile == INVALID_HANDLE_VALUE) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
InitializeCriticalSection(&g_file_cs);
|
InitializeCriticalSection(&g_file_cs);
|
||||||
|
|
||||||
|
|
||||||
|
@ -653,7 +653,7 @@ unsigned create_io_inherit_block(STARTUPINFOA* si)
|
||||||
HANDLE* handle_ptr;
|
HANDLE* handle_ptr;
|
||||||
|
|
||||||
TRACE("create_io_inherit_block(%x)",si);
|
TRACE("create_io_inherit_block(%x)",si);
|
||||||
|
|
||||||
si->cbReserved2 = sizeof(unsigned) + (sizeof(char) + sizeof(HANDLE)) * g_fdend;
|
si->cbReserved2 = sizeof(unsigned) + (sizeof(char) + sizeof(HANDLE)) * g_fdend;
|
||||||
si->lpReserved2 = calloc(si->cbReserved2, 1);
|
si->lpReserved2 = calloc(si->cbReserved2, 1);
|
||||||
if (!si->lpReserved2)
|
if (!si->lpReserved2)
|
||||||
|
@ -679,7 +679,7 @@ unsigned create_io_inherit_block(STARTUPINFOA* si)
|
||||||
*handle_ptr = INVALID_HANDLE_VALUE;
|
*handle_ptr = INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
fdflags_ptr++; handle_ptr++;
|
fdflags_ptr++; handle_ptr++;
|
||||||
}
|
}
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -692,16 +692,16 @@ unsigned create_io_inherit_block(STARTUPINFOA* si)
|
||||||
int _setmode(int fd, int newmode)
|
int _setmode(int fd, int newmode)
|
||||||
{
|
{
|
||||||
int prevmode;
|
int prevmode;
|
||||||
|
|
||||||
TRACE("_setmode(%d, %d)", fd, newmode);
|
TRACE("_setmode(%d, %d)", fd, newmode);
|
||||||
|
|
||||||
if (!is_valid_fd(fd))
|
if (!is_valid_fd(fd))
|
||||||
{
|
{
|
||||||
DPRINT1("_setmode: inval fd (%d)\n",fd);
|
DPRINT1("_setmode: inval fd (%d)\n",fd);
|
||||||
//errno = EBADF;
|
//errno = EBADF;
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newmode & ~(_O_TEXT|_O_BINARY))
|
if (newmode & ~(_O_TEXT|_O_BINARY))
|
||||||
{
|
{
|
||||||
DPRINT1("_setmode: fd (%d) mode (0x%08x) unknown\n",fd,newmode);
|
DPRINT1("_setmode: fd (%d) mode (0x%08x) unknown\n",fd,newmode);
|
||||||
|
@ -709,7 +709,7 @@ int _setmode(int fd, int newmode)
|
||||||
}
|
}
|
||||||
|
|
||||||
prevmode = fdinfo(fd)->fdflags & FTEXT ? _O_TEXT : _O_BINARY;
|
prevmode = fdinfo(fd)->fdflags & FTEXT ? _O_TEXT : _O_BINARY;
|
||||||
|
|
||||||
if ((newmode & _O_TEXT) == _O_TEXT)
|
if ((newmode & _O_TEXT) == _O_TEXT)
|
||||||
{
|
{
|
||||||
fdinfo(fd)->fdflags |= FTEXT;
|
fdinfo(fd)->fdflags |= FTEXT;
|
||||||
|
@ -721,7 +721,7 @@ int _setmode(int fd, int newmode)
|
||||||
*/
|
*/
|
||||||
fdinfo(fd)->fdflags &= ~FTEXT;
|
fdinfo(fd)->fdflags &= ~FTEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(prevmode);
|
return(prevmode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ int _read(int _fd, void *_buf, unsigned int _nbyte)
|
||||||
_dosmaperr(error);
|
_dosmaperr(error);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* text mode */
|
/* text mode */
|
||||||
if (_rbyte && istext)
|
if (_rbyte && istext)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ int _utime(const char* filename, struct _utimbuf* buf)
|
||||||
{
|
{
|
||||||
int fn;
|
int fn;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
fn = _open(filename, _O_RDWR);
|
fn = _open(filename, _O_RDWR);
|
||||||
if (fn == -1) {
|
if (fn == -1) {
|
||||||
__set_errno(EBADF);
|
__set_errno(EBADF);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* 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
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/io/mktemp.c
|
* FILE: lib/msvcrt/io/mktemp.c
|
||||||
* PURPOSE: Makes a temp file based on a template
|
* PURPOSE: Makes a temp file based on a template
|
||||||
|
|
|
@ -62,7 +62,7 @@ int _wopen(const wchar_t* _path, int _oflag, ...)
|
||||||
*
|
*
|
||||||
* _O_BINARY Opens file in binary (untranslated) mode. (See fopen for a description of binary mode.)
|
* _O_BINARY Opens file in binary (untranslated) mode. (See fopen for a description of binary mode.)
|
||||||
* _O_TEXT Opens file in text (translated) mode. (For more information, see Text and Binary Mode File I/O and fopen.)
|
* _O_TEXT Opens file in text (translated) mode. (For more information, see Text and Binary Mode File I/O and fopen.)
|
||||||
*
|
*
|
||||||
* _O_APPEND Moves file pointer to end of file before every write operation.
|
* _O_APPEND Moves file pointer to end of file before every write operation.
|
||||||
*/
|
*/
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -47,7 +47,7 @@ int _write(int _fd, const void* _buf, unsigned int _nbyte)
|
||||||
|
|
||||||
DPRINT("_write(fd %d, buf %x, nbyte %d)\n", _fd, _buf, _nbyte);
|
DPRINT("_write(fd %d, buf %x, nbyte %d)\n", _fd, _buf, _nbyte);
|
||||||
if (__fileno_getmode(_fd) & O_TEXT) {
|
if (__fileno_getmode(_fd) & O_TEXT) {
|
||||||
result = _nbyte;
|
result = _nbyte;
|
||||||
tmp = (char*) malloc(BUFSIZE);
|
tmp = (char*) malloc(BUFSIZE);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
__set_errno(ENOMEM);
|
__set_errno(ENOMEM);
|
||||||
|
@ -80,7 +80,7 @@ int _write(int _fd, const void* _buf, unsigned int _nbyte)
|
||||||
if (count == 0 || _nbyte == 0) {
|
if (count == 0 || _nbyte == 0) {
|
||||||
if (!WriteFile((HANDLE)_get_osfhandle(_fd), tmp, BUFSIZE - count, &wbyte, NULL)) {
|
if (!WriteFile((HANDLE)_get_osfhandle(_fd), tmp, BUFSIZE - count, &wbyte, NULL)) {
|
||||||
_dosmaperr(GetLastError());
|
_dosmaperr(GetLastError());
|
||||||
result = -1;
|
result = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (wbyte < (BUFSIZE - count)) {
|
if (wbyte < (BUFSIZE - count)) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ int _wutime(const wchar_t* filename, struct _utimbuf* buf)
|
||||||
{
|
{
|
||||||
int fn;
|
int fn;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
fn = _wopen(filename, _O_RDWR);
|
fn = _wopen(filename, _O_RDWR);
|
||||||
if (fn == -1) {
|
if (fn == -1) {
|
||||||
__set_errno(EBADF);
|
__set_errno(EBADF);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright 2000 Jon Griffiths
|
* Copyright 2000 Jon Griffiths
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
@ -65,7 +65,7 @@ locale "lang[_country[.code_page]]"
|
||||||
| ".code_page"
|
| ".code_page"
|
||||||
| ""
|
| ""
|
||||||
| NULL
|
| NULL
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int parse_locale(char *locale, char *lang, char *country, char *code_page)
|
int parse_locale(char *locale, char *lang, char *country, char *code_page)
|
||||||
{
|
{
|
||||||
|
@ -86,8 +86,8 @@ int parse_locale(char *locale, char *lang, char *country, char *code_page)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*country = 0;
|
*country = 0;
|
||||||
|
|
||||||
|
|
||||||
if ( *locale == '.' ) {
|
if ( *locale == '.' ) {
|
||||||
locale++;
|
locale++;
|
||||||
while ( *locale != 0 && *locale != '.' )
|
while ( *locale != 0 && *locale != '.' )
|
||||||
|
@ -97,9 +97,9 @@ int parse_locale(char *locale, char *lang, char *country, char *code_page)
|
||||||
locale++;
|
locale++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*code_page = 0;
|
*code_page = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct map_lcid2str {
|
const struct map_lcid2str {
|
||||||
|
@ -110,7 +110,7 @@ const struct map_lcid2str {
|
||||||
{0x0409,"English", "United States"},
|
{0x0409,"English", "United States"},
|
||||||
{0x0809,"English", "United Kingdom"},
|
{0x0809,"English", "United Kingdom"},
|
||||||
{0x0000,"Unknown", "Unknown"}
|
{0x0000,"Unknown", "Unknown"}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct map_cntr {
|
const struct map_cntr {
|
||||||
|
|
|
@ -13,16 +13,16 @@ frexp(double __x, int *exptr)
|
||||||
double* __x;
|
double* __x;
|
||||||
double_t* x;
|
double_t* x;
|
||||||
} x;
|
} x;
|
||||||
|
|
||||||
x.__x = &__x;
|
x.__x = &__x;
|
||||||
|
|
||||||
if ( exptr != NULL )
|
if ( exptr != NULL )
|
||||||
*exptr = x.x->exponent - 0x3FE;
|
*exptr = x.x->exponent - 0x3FE;
|
||||||
|
|
||||||
|
|
||||||
x.x->exponent = 0x3FE;
|
x.x->exponent = 0x3FE;
|
||||||
|
|
||||||
return __x;
|
return __x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,17 +15,17 @@
|
||||||
* inflicting too much of a performance hit.
|
* inflicting too much of a performance hit.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
/* Approximate square roots of DBL_MAX and DBL_MIN. Numbers
|
/* Approximate square roots of DBL_MAX and DBL_MIN. Numbers
|
||||||
between these two shouldn't neither overflow nor underflow
|
between these two shouldn't neither overflow nor underflow
|
||||||
when squared. */
|
when squared. */
|
||||||
#define __SQRT_DBL_MAX 1.3e+154
|
#define __SQRT_DBL_MAX 1.3e+154
|
||||||
#define __SQRT_DBL_MIN 2.3e-162
|
#define __SQRT_DBL_MIN 2.3e-162
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
@ -34,26 +34,26 @@ _hypot(double x, double y)
|
||||||
{
|
{
|
||||||
double abig = fabs(x), asmall = fabs(y);
|
double abig = fabs(x), asmall = fabs(y);
|
||||||
double ratio;
|
double ratio;
|
||||||
|
|
||||||
/* Make abig = max(|x|, |y|), asmall = min(|x|, |y|). */
|
/* Make abig = max(|x|, |y|), asmall = min(|x|, |y|). */
|
||||||
if (abig < asmall)
|
if (abig < asmall)
|
||||||
{
|
{
|
||||||
double temp = abig;
|
double temp = abig;
|
||||||
|
|
||||||
abig = asmall;
|
abig = asmall;
|
||||||
asmall = temp;
|
asmall = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Trivial case. */
|
/* Trivial case. */
|
||||||
if (asmall == 0.)
|
if (asmall == 0.)
|
||||||
return abig;
|
return abig;
|
||||||
|
|
||||||
/* Scale the numbers as much as possible by using its ratio.
|
/* Scale the numbers as much as possible by using its ratio.
|
||||||
For example, if both ABIG and ASMALL are VERY small, then
|
For example, if both ABIG and ASMALL are VERY small, then
|
||||||
X^2 + Y^2 might be VERY inaccurate due to loss of
|
X^2 + Y^2 might be VERY inaccurate due to loss of
|
||||||
significant digits. Dividing ASMALL by ABIG scales them
|
significant digits. Dividing ASMALL by ABIG scales them
|
||||||
to a certain degree, so that accuracy is better. */
|
to a certain degree, so that accuracy is better. */
|
||||||
|
|
||||||
if ((ratio = asmall / abig) > __SQRT_DBL_MIN && abig < __SQRT_DBL_MAX)
|
if ((ratio = asmall / abig) > __SQRT_DBL_MIN && abig < __SQRT_DBL_MAX)
|
||||||
return abig * sqrt(1.0 + ratio*ratio);
|
return abig * sqrt(1.0 + ratio*ratio);
|
||||||
else
|
else
|
||||||
|
@ -62,9 +62,9 @@ _hypot(double x, double y)
|
||||||
produces any intermediate result greater than roughly the
|
produces any intermediate result greater than roughly the
|
||||||
larger of X and Y. Should converge to machine-precision
|
larger of X and Y. Should converge to machine-precision
|
||||||
accuracy in 3 iterations. */
|
accuracy in 3 iterations. */
|
||||||
|
|
||||||
double r = ratio*ratio, t, s, p = abig, q = asmall;
|
double r = ratio*ratio, t, s, p = abig, q = asmall;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
t = 4. + r;
|
t = 4. + r;
|
||||||
if (t == 4.)
|
if (t == 4.)
|
||||||
|
@ -74,15 +74,15 @@ _hypot(double x, double y)
|
||||||
q *= s;
|
q *= s;
|
||||||
r = (q / p) * (q / p);
|
r = (q / p) * (q / p);
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
|
|
||||||
#include <msvcrt/stdio.h>
|
#include <msvcrt/stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
|
@ -94,8 +94,8 @@ main(void)
|
||||||
printf("hypot(DBL_MAX, 1.0) =\t\t %25.17g\n", _hypot(DBL_MAX, 1.0));
|
printf("hypot(DBL_MAX, 1.0) =\t\t %25.17g\n", _hypot(DBL_MAX, 1.0));
|
||||||
printf("hypot(1.0, DBL_MAX) =\t\t %25.17g\n", _hypot(1.0, DBL_MAX));
|
printf("hypot(1.0, DBL_MAX) =\t\t %25.17g\n", _hypot(1.0, DBL_MAX));
|
||||||
printf("hypot(0.0, DBL_MAX) =\t\t %25.17g\n", _hypot(0.0, DBL_MAX));
|
printf("hypot(0.0, DBL_MAX) =\t\t %25.17g\n", _hypot(0.0, DBL_MAX));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
double _j0(double x)
|
double _j0(double x)
|
||||||
{
|
{
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ double _j0(double x)
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
double _y0(double x)
|
double _y0(double x)
|
||||||
{
|
{
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
double _j1(double x)
|
double _j1(double x)
|
||||||
{
|
{
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ double _j1(double x)
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
double _y1(double x)
|
double _y1(double x)
|
||||||
{
|
{
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ double _jn(int n, double x)
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
double _yn(int n, double x)
|
double _yn(int n, double x)
|
||||||
{
|
{
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*
|
*
|
||||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -38,7 +38,7 @@ double modf(double __x, double *__i)
|
||||||
iptr.__i = __i;
|
iptr.__i = __i;
|
||||||
|
|
||||||
|
|
||||||
j0 = x.x->exponent - 0x3ff; /* exponent of x */
|
j0 = x.x->exponent - 0x3ff; /* exponent of x */
|
||||||
if(j0<20) { /* integer part in high x */
|
if(j0<20) { /* integer part in high x */
|
||||||
if(j0<0) { /* |x|<1 */
|
if(j0<0) { /* |x|<1 */
|
||||||
*__i = 0.0;
|
*__i = 0.0;
|
||||||
|
@ -128,7 +128,7 @@ long double modfl(long double __x, long double *__i)
|
||||||
iptr.iptr->exponent = x.x->exponent;
|
iptr.iptr->exponent = x.x->exponent;
|
||||||
iptr.iptr->mantissah = x.x->mantissah&((~i));
|
iptr.iptr->mantissah = x.x->mantissah&((~i));
|
||||||
iptr.iptr->mantissal = 0;
|
iptr.iptr->mantissal = 0;
|
||||||
|
|
||||||
return __x - *__i;
|
return __x - *__i;
|
||||||
}
|
}
|
||||||
} else if (j0>63) { /* no fraction part */
|
} else if (j0>63) { /* no fraction part */
|
||||||
|
@ -152,7 +152,7 @@ long double modfl(long double __x, long double *__i)
|
||||||
iptr.iptr->exponent = x.x->exponent;
|
iptr.iptr->exponent = x.x->exponent;
|
||||||
iptr.iptr->mantissah = x.x->mantissah;
|
iptr.iptr->mantissah = x.x->mantissah;
|
||||||
iptr.iptr->mantissal = x.x->mantissal&(~i);
|
iptr.iptr->mantissal = x.x->mantissal&(~i);
|
||||||
|
|
||||||
return __x - *__i;
|
return __x - *__i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ static unsigned char zen_to_han_symbol_table_2[ZTOH_SYMBOLS] = {
|
||||||
#define JISKANA(c) ((c) >= 0x8340 && (c) <= 0x8396 && (c) != 0x837f)
|
#define JISKANA(c) ((c) >= 0x8340 && (c) <= 0x8396 && (c) != 0x837f)
|
||||||
#define JTOKANA(c) ((c) <= 0x82dd ? (c) + 0xa1 : (c) + 0xa2)
|
#define JTOKANA(c) ((c) <= 0x82dd ? (c) + 0xa1 : (c) + 0xa2)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/mbstring/ischira.c
|
* FILE: lib/msvcrt/mbstring/ischira.c
|
||||||
* PURPOSE:
|
* PURPOSE:
|
||||||
* PROGRAMER: Boudewijn Dekker
|
* PROGRAMER: Boudewijn Dekker
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 12/04/99: Created
|
* 12/04/99: Created
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/mbstring/iskpun.c
|
* FILE: lib/msvcrt/mbstring/iskpun.c
|
||||||
* PURPOSE:
|
* PURPOSE:
|
||||||
* PROGRAMER: Boudewijn Dekker
|
* PROGRAMER: Boudewijn Dekker
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 12/04/99: Created
|
* 12/04/99: Created
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/mbstring/islwr.c
|
* FILE: lib/msvcrt/mbstring/islwr.c
|
||||||
* PURPOSE:
|
* PURPOSE:
|
||||||
* PROGRAMER: Boudewijn Dekker
|
* PROGRAMER: Boudewijn Dekker
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 12/04/99: Created
|
* 12/04/99: Created
|
||||||
|
|
|
@ -32,7 +32,7 @@ int _ismbcalpha( unsigned int c )
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/mbstring/ismbkaln.c
|
* FILE: lib/msvcrt/mbstring/ismbkaln.c
|
||||||
* PURPOSE:
|
* PURPOSE:
|
||||||
* PROGRAMER: Boudewijn Dekker
|
* PROGRAMER: Boudewijn Dekker
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 12/04/99: Created
|
* 12/04/99: Created
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/mbstring/ismblead.c
|
* FILE: lib/msvcrt/mbstring/ismblead.c
|
||||||
* PURPOSE: Checks for a lead byte
|
* PURPOSE: Checks for a lead byte
|
||||||
* PROGRAMER: Boudewijn Dekker
|
* PROGRAMER: Boudewijn Dekker
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* Modified from Taiji Yamada japanese code system utilities
|
* Modified from Taiji Yamada japanese code system utilities
|
||||||
|
@ -47,7 +47,7 @@ int _ismbblead(unsigned int c)
|
||||||
//int _ismbblead(unsigned int byte)
|
//int _ismbblead(unsigned int byte)
|
||||||
//{
|
//{
|
||||||
//
|
//
|
||||||
// return (int)IsDBCSLeadByte(byte)
|
// return (int)IsDBCSLeadByte(byte)
|
||||||
//}
|
//}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -56,11 +56,11 @@ int _ismbblead(unsigned int c)
|
||||||
int _ismbslead( const unsigned char *str, const unsigned char *t)
|
int _ismbslead( const unsigned char *str, const unsigned char *t)
|
||||||
{
|
{
|
||||||
unsigned char *s = (unsigned char *)str;
|
unsigned char *s = (unsigned char *)str;
|
||||||
while(*s != 0 && s != t)
|
while(*s != 0 && s != t)
|
||||||
{
|
{
|
||||||
|
|
||||||
s+= _mbclen2(*s);
|
s+= _mbclen2(*s);
|
||||||
}
|
}
|
||||||
return _ismbblead( *s);
|
return _ismbblead( *s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/mbstring/ismbtrl.c
|
* FILE: lib/msvcrt/mbstring/ismbtrl.c
|
||||||
* PURPOSE: Checks for a trailing byte
|
* PURPOSE: Checks for a trailing byte
|
||||||
* PROGRAMER: Boudewijn Dekker
|
* PROGRAMER: Boudewijn Dekker
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 12/04/99: Created
|
* 12/04/99: Created
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
size_t _mbclen2(const unsigned int s);
|
size_t _mbclen2(const unsigned int s);
|
||||||
|
|
||||||
// iskanji2() : (0x40 <= c <= 0x7E 0x80 <= c <= 0xFC)
|
// iskanji2() : (0x40 <= c <= 0x7E 0x80 <= c <= 0xFC)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
|
@ -36,11 +36,11 @@ int _ismbbtrail(unsigned int c)
|
||||||
int _ismbstrail( const unsigned char *str, const unsigned char *t)
|
int _ismbstrail( const unsigned char *str, const unsigned char *t)
|
||||||
{
|
{
|
||||||
unsigned char *s = (unsigned char *)str;
|
unsigned char *s = (unsigned char *)str;
|
||||||
while(*s != 0 && s != t)
|
while(*s != 0 && s != t)
|
||||||
{
|
{
|
||||||
|
|
||||||
s+= _mbclen2(*s);
|
s+= _mbclen2(*s);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _ismbbtrail(*s);
|
return _ismbbtrail(*s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/mbstring/isuppr.c
|
* FILE: lib/msvcrt/mbstring/isuppr.c
|
||||||
* PURPOSE:
|
* PURPOSE:
|
||||||
* PROGRAMER: Boudewijn Dekker
|
* PROGRAMER: Boudewijn Dekker
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 12/04/99: Created
|
* 12/04/99: Created
|
||||||
|
|
|
@ -22,7 +22,7 @@ int _mbbtype(unsigned char c , int type)
|
||||||
{
|
{
|
||||||
return _MBC_TRAIL;
|
return _MBC_TRAIL;
|
||||||
}
|
}
|
||||||
else if (( c >= 0x20 && c >= 0x7E ) || ( c >= 0xA1 && c <= 0xDF ) ||
|
else if (( c >= 0x20 && c >= 0x7E ) || ( c >= 0xA1 && c <= 0xDF ) ||
|
||||||
( c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC ) )
|
( c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC ) )
|
||||||
return _MBC_ILLEGAL;
|
return _MBC_ILLEGAL;
|
||||||
else
|
else
|
||||||
|
@ -33,13 +33,13 @@ int _mbbtype(unsigned char c , int type)
|
||||||
}
|
}
|
||||||
else if ( (c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC) )
|
else if ( (c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC) )
|
||||||
return _MBC_LEAD;
|
return _MBC_LEAD;
|
||||||
else if (( c >= 0x20 && c >= 0x7E ) || ( c >= 0xA1 && c <= 0xDF ) ||
|
else if (( c >= 0x20 && c >= 0x7E ) || ( c >= 0xA1 && c <= 0xDF ) ||
|
||||||
( c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC ) )
|
( c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC ) )
|
||||||
return _MBC_ILLEGAL;
|
return _MBC_ILLEGAL;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/mbstring/mbscoll.c
|
* FILE: lib/msvcrt/mbstring/mbscoll.c
|
||||||
* PURPOSE:
|
* PURPOSE:
|
||||||
* PROGRAMER: Boudewijn Dekker
|
* PROGRAMER: Boudewijn Dekker
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 12/04/99: Created
|
* 12/04/99: Created
|
||||||
|
@ -25,9 +25,9 @@ int _mbscoll(const unsigned char *str1, const unsigned char *str2)
|
||||||
int l1, l2;
|
int l1, l2;
|
||||||
|
|
||||||
while ( *s1 != 0 ) {
|
while ( *s1 != 0 ) {
|
||||||
|
|
||||||
if (*s1 == 0)
|
if (*s1 == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
l1 = _ismbblead(*s1);
|
l1 = _ismbblead(*s1);
|
||||||
l2 = _ismbblead(*s2);
|
l2 = _ismbblead(*s2);
|
||||||
|
@ -69,7 +69,7 @@ int _mbsbcoll(const unsigned char *str1, const unsigned char *str2)
|
||||||
|
|
||||||
|
|
||||||
while ( *s1 != 0 ) {
|
while ( *s1 != 0 ) {
|
||||||
|
|
||||||
|
|
||||||
l1 = _ismbblead(*s1);
|
l1 = _ismbblead(*s1);
|
||||||
l2 = _ismbblead(*s2);
|
l2 = _ismbblead(*s2);
|
||||||
|
|
|
@ -14,5 +14,5 @@ unsigned char * _mbsdec(const unsigned char *str, const unsigned char *cur)
|
||||||
if (_ismbblead(*(s-1)) )
|
if (_ismbblead(*(s-1)) )
|
||||||
s--;
|
s--;
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,9 @@ int _mbsicmp(const unsigned char *str1, const unsigned char *str2)
|
||||||
int l1, l2;
|
int l1, l2;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
if (*s1 == 0)
|
if (*s1 == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
l1 = _ismbblead(*s1);
|
l1 = _ismbblead(*s1);
|
||||||
l2 = _ismbblead(*s2);
|
l2 = _ismbblead(*s2);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/mbstring/mbsicoll.c
|
* FILE: lib/msvcrt/mbstring/mbsicoll.c
|
||||||
* PURPOSE:
|
* PURPOSE:
|
||||||
* PROGRAMER: Boudewijn Dekker
|
* PROGRAMER: Boudewijn Dekker
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 12/04/99: Created
|
* 12/04/99: Created
|
||||||
|
@ -25,9 +25,9 @@ int _mbsicoll(const unsigned char *str1, const unsigned char *str2)
|
||||||
int l1, l2;
|
int l1, l2;
|
||||||
|
|
||||||
while ( *s1 != 0 ) {
|
while ( *s1 != 0 ) {
|
||||||
|
|
||||||
if (*s1 == 0)
|
if (*s1 == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
l1 = _ismbblead(*s1);
|
l1 = _ismbblead(*s1);
|
||||||
l2 = _ismbblead(*s2);
|
l2 = _ismbblead(*s2);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
unsigned char * _mbsinc(const unsigned char *s)
|
unsigned char * _mbsinc(const unsigned char *s)
|
||||||
{
|
{
|
||||||
unsigned char *c = (unsigned char *)s;
|
unsigned char *c = (unsigned char *)s;
|
||||||
if (_ismbblead(*s) )
|
if (_ismbblead(*s) )
|
||||||
c++;
|
c++;
|
||||||
c++;
|
c++;
|
||||||
return c;
|
return c;
|
||||||
|
|
|
@ -12,7 +12,7 @@ size_t _mbslen(const unsigned char *str)
|
||||||
|
|
||||||
if (str == 0)
|
if (str == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (s = (unsigned char *)str; *s; s+=_mbclen2(*s),i++);
|
for (s = (unsigned char *)str; *s; s+=_mbclen2(*s),i++);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/mbstring/mbsncat.c
|
* FILE: lib/msvcrt/mbstring/mbsncat.c
|
||||||
* PURPOSE: Concatenate two multi byte string to maximum of n characters or bytes
|
* PURPOSE: Concatenate two multi byte string to maximum of n characters or bytes
|
||||||
* PROGRAMER: Boudewijn Dekker
|
* PROGRAMER: Boudewijn Dekker
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
|
@ -21,7 +21,7 @@ unsigned char * _mbsncat(unsigned char *dst, const unsigned char *src, size_t n)
|
||||||
unsigned char *d = dst;
|
unsigned char *d = dst;
|
||||||
const unsigned char *s = src;
|
const unsigned char *s = src;
|
||||||
if (n != 0) {
|
if (n != 0) {
|
||||||
d = dst + _mbslen(dst); // get the end of string
|
d = dst + _mbslen(dst); // get the end of string
|
||||||
d += _mbclen2(*d); // move 1 or 2 up
|
d += _mbclen2(*d); // move 1 or 2 up
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -43,10 +43,10 @@ unsigned char * _mbsncat(unsigned char *dst, const unsigned char *src, size_t n)
|
||||||
*/
|
*/
|
||||||
unsigned char * _mbsnbcat(unsigned char *dst, const unsigned char *src, size_t n)
|
unsigned char * _mbsnbcat(unsigned char *dst, const unsigned char *src, size_t n)
|
||||||
{
|
{
|
||||||
unsigned char *d;
|
unsigned char *d;
|
||||||
const unsigned char *s = src;
|
const unsigned char *s = src;
|
||||||
if (n != 0) {
|
if (n != 0) {
|
||||||
d = dst + _mbslen(dst); // get the end of string
|
d = dst + _mbslen(dst); // get the end of string
|
||||||
d += _mbclen2(*d); // move 1 or 2 up
|
d += _mbclen2(*d); // move 1 or 2 up
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -8,14 +8,14 @@ size_t _mbsnccnt(const unsigned char *str, size_t n)
|
||||||
unsigned char *s = (unsigned char *)str;
|
unsigned char *s = (unsigned char *)str;
|
||||||
size_t cnt = 0;
|
size_t cnt = 0;
|
||||||
while(*s != 0 && n > 0) {
|
while(*s != 0 && n > 0) {
|
||||||
if (_ismbblead(*s) )
|
if (_ismbblead(*s) )
|
||||||
s++;
|
s++;
|
||||||
else
|
else
|
||||||
n--;
|
n--;
|
||||||
s++;
|
s++;
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,6 @@ size_t _mbsnbcnt(const unsigned char *str, size_t n)
|
||||||
n--;
|
n--;
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (size_t)(s - str);
|
return (size_t)(s - str);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,9 @@ int _mbsncmp(const unsigned char *str1, const unsigned char *str2, size_t n)
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return 0;
|
return 0;
|
||||||
do {
|
do {
|
||||||
|
|
||||||
if (*s1 == 0)
|
if (*s1 == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
l1 = _ismbblead(*s1);
|
l1 = _ismbblead(*s1);
|
||||||
l2 = _ismbblead(*s2);
|
l2 = _ismbblead(*s2);
|
||||||
|
@ -74,9 +74,9 @@ int _mbsnbcmp(const unsigned char *str1, const unsigned char *str2, size_t n)
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return 0;
|
return 0;
|
||||||
do {
|
do {
|
||||||
|
|
||||||
if (*s1 == 0)
|
if (*s1 == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
l1 = _ismbblead(*s1);
|
l1 = _ismbblead(*s1);
|
||||||
l2 = _ismbblead(*s2);
|
l2 = _ismbblead(*s2);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/mbstring/mbsncoll.c
|
* FILE: lib/msvcrt/mbstring/mbsncoll.c
|
||||||
* PURPOSE:
|
* PURPOSE:
|
||||||
* PROGRAMER: Boudewijn Dekker
|
* PROGRAMER: Boudewijn Dekker
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 12/04/99: Created
|
* 12/04/99: Created
|
||||||
|
@ -26,9 +26,9 @@ int _mbsncoll(const unsigned char *str1, const unsigned char *str2, size_t n)
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return 0;
|
return 0;
|
||||||
do {
|
do {
|
||||||
|
|
||||||
if (*s1 == 0)
|
if (*s1 == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
l1 = _ismbblead(*s1);
|
l1 = _ismbblead(*s1);
|
||||||
l2 = _ismbblead(*s2);
|
l2 = _ismbblead(*s2);
|
||||||
|
@ -75,9 +75,9 @@ int _mbsnbcoll(const unsigned char *str1, const unsigned char *str2, size_t n)
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return 0;
|
return 0;
|
||||||
do {
|
do {
|
||||||
|
|
||||||
if (*s1 == 0)
|
if (*s1 == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
l1 = _ismbblead(*s1);
|
l1 = _ismbblead(*s1);
|
||||||
l2 = _ismbblead(*s2);
|
l2 = _ismbblead(*s2);
|
||||||
|
|
|
@ -24,9 +24,9 @@ unsigned char* _mbsncpy(unsigned char *str1, const unsigned char *str2, size_t n
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return 0;
|
return 0;
|
||||||
do {
|
do {
|
||||||
|
|
||||||
if (*s2 == 0)
|
if (*s2 == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ( !_ismbblead(*s2) ) {
|
if ( !_ismbblead(*s2) ) {
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ unsigned char* _mbsncpy(unsigned char *str1, const unsigned char *str2, size_t n
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The _mbsnbcpy function copies count bytes from src to dest. If src is shorter
|
* The _mbsnbcpy function copies count bytes from src to dest. If src is shorter
|
||||||
* than dest, the string is padded with null characters. If dest is less than or
|
* than dest, the string is padded with null characters. If dest is less than or
|
||||||
* equal to count it is not terminated with a null character.
|
* equal to count it is not terminated with a null character.
|
||||||
*
|
*
|
||||||
* @implemented
|
* @implemented
|
||||||
|
@ -65,10 +65,10 @@ unsigned char * _mbsnbcpy(unsigned char *str1, const unsigned char *str2, size_t
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return 0;
|
return 0;
|
||||||
do {
|
do {
|
||||||
|
|
||||||
if (*s2 == 0) {
|
if (*s2 == 0) {
|
||||||
*s1 = *s2;
|
*s1 = *s2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !_ismbblead(*s2) ) {
|
if ( !_ismbblead(*s2) ) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/mbstring/mbsnset.c
|
* FILE: lib/msvcrt/mbstring/mbsnset.c
|
||||||
* PURPOSE: Fills a string with a multibyte character
|
* PURPOSE: Fills a string with a multibyte character
|
||||||
* PROGRAMER: Boudewijn Dekker
|
* PROGRAMER: Boudewijn Dekker
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
|
@ -20,7 +20,7 @@ unsigned char * _mbsnset(unsigned char *src, unsigned int val, size_t count)
|
||||||
unsigned short *short_src = (unsigned short *)src;
|
unsigned short *short_src = (unsigned short *)src;
|
||||||
|
|
||||||
if ( _mbclen2(val) == 1 ) {
|
if ( _mbclen2(val) == 1 ) {
|
||||||
|
|
||||||
while(count > 0) {
|
while(count > 0) {
|
||||||
*char_src = val;
|
*char_src = val;
|
||||||
char_src++;
|
char_src++;
|
||||||
|
@ -49,7 +49,7 @@ unsigned char * _mbsnbset(unsigned char *src, unsigned int val, size_t count)
|
||||||
unsigned short *short_src = (unsigned short *)src;
|
unsigned short *short_src = (unsigned short *)src;
|
||||||
|
|
||||||
if ( _mbclen2(val) == 1 ) {
|
if ( _mbclen2(val) == 1 ) {
|
||||||
|
|
||||||
while(count > 0) {
|
while(count > 0) {
|
||||||
*char_src = val;
|
*char_src = val;
|
||||||
char_src++;
|
char_src++;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/mbstring/mbsrchr.c
|
* FILE: lib/msvcrt/mbstring/mbsrchr.c
|
||||||
* PURPOSE: Searches for a character in reverse
|
* PURPOSE: Searches for a character in reverse
|
||||||
* PROGRAMER: Boudewijn Dekker
|
* PROGRAMER: Boudewijn Dekker
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
|
|
|
@ -17,7 +17,7 @@ unsigned char * _mbsrev(unsigned char *s)
|
||||||
if ( *e == 0 )
|
if ( *e == 0 )
|
||||||
break;
|
break;
|
||||||
*e = a;
|
*e = a;
|
||||||
}
|
}
|
||||||
e++;
|
e++;
|
||||||
}
|
}
|
||||||
while (s<e) {
|
while (s<e) {
|
||||||
|
@ -27,7 +27,7 @@ unsigned char * _mbsrev(unsigned char *s)
|
||||||
s++;
|
s++;
|
||||||
e--;
|
e--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/mbstring/mbsset.c
|
* FILE: lib/msvcrt/mbstring/mbsset.c
|
||||||
* PURPOSE: Fills a string with a multibyte character
|
* PURPOSE: Fills a string with a multibyte character
|
||||||
* PROGRAMER: Boudewijn Dekker
|
* PROGRAMER: Boudewijn Dekker
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
|
@ -21,7 +21,7 @@ unsigned char * _mbsset(unsigned char *src, unsigned int c)
|
||||||
unsigned short *short_src = (unsigned short *)src;
|
unsigned short *short_src = (unsigned short *)src;
|
||||||
|
|
||||||
if ( _mbclen2(c) == 1 ) {
|
if ( _mbclen2(c) == 1 ) {
|
||||||
|
|
||||||
while(*char_src != 0) {
|
while(*char_src != 0) {
|
||||||
*char_src = c;
|
*char_src = c;
|
||||||
char_src++;
|
char_src++;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/mbstring/mbsupr.c
|
* FILE: lib/msvcrt/mbstring/mbsupr.c
|
||||||
* PURPOSE:
|
* PURPOSE:
|
||||||
* PROGRAMER: Boudewijn Dekker
|
* PROGRAMER: Boudewijn Dekker
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 12/04/99: Created
|
* 12/04/99: Created
|
||||||
|
@ -14,7 +14,7 @@ unsigned int _mbbtoupper(unsigned int c)
|
||||||
{
|
{
|
||||||
if (!_ismbblead(c) )
|
if (!_ismbblead(c) )
|
||||||
return toupper(c);
|
return toupper(c);
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ int _fltused;
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
STDCALL
|
STDCALL
|
||||||
_except_handler3(void)
|
_except_handler3(void)
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ int STDCALL _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lp
|
||||||
//result = DllMain(hInst, ul_reason_for_call, lpReserved);
|
//result = DllMain(hInst, ul_reason_for_call, lpReserved);
|
||||||
|
|
||||||
result = DllMain(hInst, DLL_PROCESS_ATTACH, lpReserved);
|
result = DllMain(hInst, DLL_PROCESS_ATTACH, lpReserved);
|
||||||
|
|
||||||
|
|
||||||
return (result ? 1 : 0);
|
return (result ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <internal/file.h>
|
#include <internal/file.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ unsigned int _osver = 0;
|
||||||
unsigned int _winminor = 0;
|
unsigned int _winminor = 0;
|
||||||
unsigned int _winmajor = 0;
|
unsigned int _winmajor = 0;
|
||||||
unsigned int _winver = 0;
|
unsigned int _winver = 0;
|
||||||
|
|
||||||
|
|
||||||
char *_acmdln = NULL; /* pointer to ascii command line */
|
char *_acmdln = NULL; /* pointer to ascii command line */
|
||||||
wchar_t *_wcmdln = NULL; /* pointer to wide character command line */
|
wchar_t *_wcmdln = NULL; /* pointer to wide character command line */
|
||||||
|
@ -29,7 +29,7 @@ char **_environ = NULL; /* pointer to environment block */
|
||||||
wchar_t **_wenviron = NULL; /* pointer to environment block */
|
wchar_t **_wenviron = NULL; /* pointer to environment block */
|
||||||
char **__initenv = NULL; /* pointer to initial environment block */
|
char **__initenv = NULL; /* pointer to initial environment block */
|
||||||
wchar_t **__winitenv = NULL; /* pointer to initial environment block */
|
wchar_t **__winitenv = NULL; /* pointer to initial environment block */
|
||||||
#undef _pgmptr
|
#undef _pgmptr
|
||||||
char *_pgmptr = NULL; /* pointer to program name */
|
char *_pgmptr = NULL; /* pointer to program name */
|
||||||
int __app_type = 0; //_UNKNOWN_APP; /* application type */
|
int __app_type = 0; //_UNKNOWN_APP; /* application type */
|
||||||
int __mb_cur_max = 1;
|
int __mb_cur_max = 1;
|
||||||
|
@ -83,7 +83,7 @@ int BlockEnvToEnvironA(void)
|
||||||
/* Add terminating NULL entry. */
|
/* Add terminating NULL entry. */
|
||||||
*envptr = NULL;
|
*envptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeEnvironmentStringsA(environment_strings);
|
FreeEnvironmentStringsA(environment_strings);
|
||||||
return _environ ? 0 : -1;
|
return _environ ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ int BlockEnvToEnvironW(void)
|
||||||
/* Add terminating NULL entry. */
|
/* Add terminating NULL entry. */
|
||||||
*envptr = NULL;
|
*envptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeEnvironmentStringsW(environment_strings);
|
FreeEnvironmentStringsW(environment_strings);
|
||||||
return _wenviron ? 0 : -1;
|
return _wenviron ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
@ -176,8 +176,8 @@ char **DuplicateEnvironment(char **original_environment, int wide)
|
||||||
free(*newenvptr);
|
free(*newenvptr);
|
||||||
free(newenv);
|
free(newenv);
|
||||||
return original_environment;
|
return original_environment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return newenv;
|
return newenv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/process/cwait.c
|
* FILE: lib/msvcrt/process/cwait.c
|
||||||
* PURPOSE: Waits for a process to exit
|
* PURPOSE: Waits for a process to exit
|
||||||
* PROGRAMER: Boudewijn Dekker
|
* PROGRAMER: Boudewijn Dekker
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 04/03/99: Created
|
* 04/03/99: Created
|
||||||
|
|
|
@ -61,7 +61,7 @@ int system(const char *command)
|
||||||
else
|
else
|
||||||
s++;
|
s++;
|
||||||
|
|
||||||
szCmdLine = malloc(strlen(s) + 4 + strlen(command) + 1);
|
szCmdLine = malloc(strlen(s) + 4 + strlen(command) + 1);
|
||||||
if (szCmdLine == NULL)
|
if (szCmdLine == NULL)
|
||||||
{
|
{
|
||||||
free (szComSpec);
|
free (szComSpec);
|
||||||
|
@ -111,7 +111,7 @@ int system(const char *command)
|
||||||
_dosmaperr(GetLastError());
|
_dosmaperr(GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseHandle(ProcessInformation.hThread);
|
CloseHandle(ProcessInformation.hThread);
|
||||||
|
|
||||||
// system should wait untill the calling process is finished
|
// system should wait untill the calling process is finished
|
||||||
|
|
|
@ -33,7 +33,7 @@ int _unloaddll(void* handle)
|
||||||
*/
|
*/
|
||||||
FARPROC _getdllprocaddr(void* hModule, char* lpProcName, int iOrdinal)
|
FARPROC _getdllprocaddr(void* hModule, char* lpProcName, int iOrdinal)
|
||||||
{
|
{
|
||||||
if (lpProcName != NULL)
|
if (lpProcName != NULL)
|
||||||
return GetProcAddress(hModule, lpProcName);
|
return GetProcAddress(hModule, lpProcName);
|
||||||
else
|
else
|
||||||
return GetProcAddress(hModule, (LPSTR)iOrdinal);
|
return GetProcAddress(hModule, (LPSTR)iOrdinal);
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#define argvtosT argvtosW
|
#define argvtosT argvtosW
|
||||||
#define do_spawnT do_spawnW
|
#define do_spawnT do_spawnW
|
||||||
#define valisttosT valisttosW
|
#define valisttosT valisttosW
|
||||||
#define extT extW
|
#define extT extW
|
||||||
#else
|
#else
|
||||||
#define find_execT find_execA
|
#define find_execT find_execA
|
||||||
#define argvtosT argvtosA
|
#define argvtosT argvtosA
|
||||||
|
@ -190,7 +190,7 @@ do_spawnT(int mode, const _TCHAR* cmdname, const _TCHAR* args, const _TCHAR* env
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
|
||||||
TRACE(MK_STR(do_spawnT)"(%i,'%"sT"','%"sT"','%"sT"')",mode,cmdname,args,envp);
|
TRACE(MK_STR(do_spawnT)"(%i,'%"sT"','%"sT"','%"sT"')",mode,cmdname,args,envp);
|
||||||
|
|
||||||
|
|
||||||
if (mode != _P_NOWAIT && mode != _P_NOWAITO && mode != _P_WAIT && mode != _P_DETACH && mode != _P_OVERLAY)
|
if (mode != _P_NOWAIT && mode != _P_NOWAITO && mode != _P_WAIT && mode != _P_DETACH && mode != _P_OVERLAY)
|
||||||
{
|
{
|
||||||
|
@ -208,10 +208,10 @@ do_spawnT(int mode, const _TCHAR* cmdname, const _TCHAR* args, const _TCHAR* env
|
||||||
__set_errno ( EISDIR );
|
__set_errno ( EISDIR );
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//memset (&StartupInfo, 0, sizeof(StartupInfo));
|
//memset (&StartupInfo, 0, sizeof(StartupInfo));
|
||||||
StartupInfo.cb = sizeof(StartupInfo);
|
StartupInfo.cb = sizeof(StartupInfo);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
for (last = i = 0; i < FDINFO_FD_MAX; i++)
|
for (last = i = 0; i < FDINFO_FD_MAX; i++)
|
||||||
|
@ -240,7 +240,7 @@ do_spawnT(int mode, const _TCHAR* cmdname, const _TCHAR* args, const _TCHAR* env
|
||||||
int _mode = __fileno_getmode(i);
|
int _mode = __fileno_getmode(i);
|
||||||
HANDLE h = _get_osfhandle(i);
|
HANDLE h = _get_osfhandle(i);
|
||||||
/* FIXME: The test of console handles (((ULONG)Handle) & 0x10000003) == 0x3)
|
/* FIXME: The test of console handles (((ULONG)Handle) & 0x10000003) == 0x3)
|
||||||
* is possible wrong
|
* is possible wrong
|
||||||
*/
|
*/
|
||||||
if ((((ULONG)h) & 0x10000003) == 0x3 || _mode & _O_NOINHERIT || (i < 3 && mode == _P_DETACH))
|
if ((((ULONG)h) & 0x10000003) == 0x3 || _mode & _O_NOINHERIT || (i < 3 && mode == _P_DETACH))
|
||||||
{
|
{
|
||||||
|
@ -270,7 +270,7 @@ do_spawnT(int mode, const _TCHAR* cmdname, const _TCHAR* args, const _TCHAR* env
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
create_io_inherit_block((STARTUPINFOA*) &StartupInfo);
|
create_io_inherit_block((STARTUPINFOA*) &StartupInfo);
|
||||||
|
|
||||||
bResult = CreateProcess((_TCHAR *)cmdname,
|
bResult = CreateProcess((_TCHAR *)cmdname,
|
||||||
(_TCHAR *)args,
|
(_TCHAR *)args,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -281,7 +281,7 @@ do_spawnT(int mode, const _TCHAR* cmdname, const _TCHAR* args, const _TCHAR* env
|
||||||
NULL,
|
NULL,
|
||||||
&StartupInfo,
|
&StartupInfo,
|
||||||
&ProcessInformation);
|
&ProcessInformation);
|
||||||
|
|
||||||
if (StartupInfo.lpReserved2)
|
if (StartupInfo.lpReserved2)
|
||||||
{
|
{
|
||||||
free(StartupInfo.lpReserved2);
|
free(StartupInfo.lpReserved2);
|
||||||
|
|
|
@ -25,7 +25,7 @@ FILE *__alloc_file(void)
|
||||||
__file_rec **last_fr = &__file_rec_list;
|
__file_rec **last_fr = &__file_rec_list;
|
||||||
FILE *rv=0;
|
FILE *rv=0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Try to find an empty slot */
|
/* Try to find an empty slot */
|
||||||
while (fr)
|
while (fr)
|
||||||
{
|
{
|
||||||
|
@ -73,7 +73,7 @@ int _fcloseall( void )
|
||||||
{
|
{
|
||||||
__file_rec *fr = __file_rec_list;
|
__file_rec *fr = __file_rec_list;
|
||||||
__file_rec **last_fr = &__file_rec_list;
|
__file_rec **last_fr = &__file_rec_list;
|
||||||
|
|
||||||
int total_closed = 0;
|
int total_closed = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
@ -81,14 +81,14 @@ int _fcloseall( void )
|
||||||
while (fr)
|
while (fr)
|
||||||
{
|
{
|
||||||
last_fr = &(fr->next);
|
last_fr = &(fr->next);
|
||||||
|
|
||||||
/* If one of the existing slots is available, return it */
|
/* If one of the existing slots is available, return it */
|
||||||
for (i=0; i<fr->count; i++)
|
for (i=0; i<fr->count; i++)
|
||||||
if (fr->files[i]->_flag != 0) {
|
if (fr->files[i]->_flag != 0) {
|
||||||
fclose(fr->files[i]);
|
fclose(fr->files[i]);
|
||||||
total_closed++;
|
total_closed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this one is full, go to the next */
|
/* If this one is full, go to the next */
|
||||||
if (fr->count == __FILE_REC_MAX)
|
if (fr->count == __FILE_REC_MAX)
|
||||||
fr = fr->next;
|
fr = fr->next;
|
||||||
|
|
|
@ -32,12 +32,12 @@ fclose(FILE *f)
|
||||||
if ( !(f->_flag&_IOSTRG) ) {
|
if ( !(f->_flag&_IOSTRG) ) {
|
||||||
if ( OPEN4WRITING(f) )
|
if ( OPEN4WRITING(f) )
|
||||||
r = fflush(f);
|
r = fflush(f);
|
||||||
|
|
||||||
if (_close(_fileno(f)) < 0)
|
if (_close(_fileno(f)) < 0)
|
||||||
r = EOF;
|
r = EOF;
|
||||||
if (f->_flag&_IOMYBUF)
|
if (f->_flag&_IOMYBUF)
|
||||||
free(f->_base);
|
free(f->_base);
|
||||||
|
|
||||||
// Kernel might do this later
|
// Kernel might do this later
|
||||||
if (f->_flag & _IORMONCL && f->_tmpfname)
|
if (f->_flag & _IORMONCL && f->_tmpfname)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
FILE* _tfdopen(int handle,
|
FILE* _tfdopen(int handle,
|
||||||
#ifndef _UNICODE
|
#ifndef _UNICODE
|
||||||
const
|
const
|
||||||
#endif
|
#endif
|
||||||
_TCHAR* mode)
|
_TCHAR* mode)
|
||||||
{
|
{
|
||||||
FILE* file;
|
FILE* file;
|
||||||
|
|
|
@ -62,7 +62,7 @@ int fflush(FILE *f)
|
||||||
{
|
{
|
||||||
|
|
||||||
base = f->_base;
|
base = f->_base;
|
||||||
|
|
||||||
|
|
||||||
// if the buffer is read ahead and dirty we will flush it entirely
|
// if the buffer is read ahead and dirty we will flush it entirely
|
||||||
// else the buffer is appended to the file to the extend it has valid bytes
|
// else the buffer is appended to the file to the extend it has valid bytes
|
||||||
|
|
|
@ -20,7 +20,7 @@ int _filbuf(FILE* f)
|
||||||
{
|
{
|
||||||
int size;
|
int size;
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
if ( !OPEN4READING(f)) {
|
if ( !OPEN4READING(f)) {
|
||||||
__set_errno (EINVAL);
|
__set_errno (EINVAL);
|
||||||
return EOF;
|
return EOF;
|
||||||
|
@ -43,7 +43,7 @@ int _filbuf(FILE* f)
|
||||||
if (f->_flag&_IONBF)
|
if (f->_flag&_IONBF)
|
||||||
f->_base = &c;
|
f->_base = &c;
|
||||||
|
|
||||||
// flush stdout before reading from stdin
|
// flush stdout before reading from stdin
|
||||||
if (f == stdin) {
|
if (f == stdin) {
|
||||||
if (stdout->_flag&_IO_LBF)
|
if (stdout->_flag&_IO_LBF)
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
@ -74,9 +74,9 @@ int _filbuf(FILE* f)
|
||||||
|
|
||||||
f->_ptr = f->_base;
|
f->_ptr = f->_base;
|
||||||
|
|
||||||
if (f->_flag & _IONBF)
|
if (f->_flag & _IONBF)
|
||||||
f->_base = NULL; // statically allocated buffer for sprintf
|
f->_base = NULL; // statically allocated buffer for sprintf
|
||||||
|
|
||||||
|
|
||||||
//check for error
|
//check for error
|
||||||
if (f->_cnt <= 0) {
|
if (f->_cnt <= 0) {
|
||||||
|
@ -86,7 +86,7 @@ int _filbuf(FILE* f)
|
||||||
f->_flag |= _IOERR;
|
f->_flag |= _IOERR;
|
||||||
f->_cnt = 0;
|
f->_cnt = 0;
|
||||||
|
|
||||||
// FIXME should set errno
|
// FIXME should set errno
|
||||||
|
|
||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
|
@ -113,9 +113,9 @@ int _readcnv(int fn, void *buf, size_t siz )
|
||||||
n = _read(fn, buf, siz );
|
n = _read(fn, buf, siz );
|
||||||
|
|
||||||
while (_bufsiz > 0) {
|
while (_bufsiz > 0) {
|
||||||
if (*bufp == '\r')
|
if (*bufp == '\r')
|
||||||
cr++;
|
cr++;
|
||||||
else if ( cr != 0 )
|
else if ( cr != 0 )
|
||||||
*bufp = *(bufp + cr);
|
*bufp = *(bufp + cr);
|
||||||
bufp++;
|
bufp++;
|
||||||
_bufsiz--;
|
_bufsiz--;
|
||||||
|
|
|
@ -115,7 +115,7 @@ int _writecnv(int fn, void* buf, size_t siz)
|
||||||
int cr1 = 0;
|
int cr1 = 0;
|
||||||
int cr2 = 0;
|
int cr2 = 0;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
cr1 = cntcr(bufp, bufsiz);
|
cr1 = cntcr(bufp, bufsiz);
|
||||||
tmp = malloc(cr1);
|
tmp = malloc(cr1);
|
||||||
memcpy(tmp, bufp + bufsiz - cr1, cr1);
|
memcpy(tmp, bufp + bufsiz - cr1, cr1);
|
||||||
|
@ -129,7 +129,7 @@ int _writecnv(int fn, void* buf, size_t siz)
|
||||||
}
|
}
|
||||||
|
|
||||||
int convert(char* endp, int bufsiz, int n)
|
int convert(char* endp, int bufsiz, int n)
|
||||||
{
|
{
|
||||||
endp = endp + bufsiz + n;
|
endp = endp + bufsiz + n;
|
||||||
while (bufsiz > 0) {
|
while (bufsiz > 0) {
|
||||||
*endp = *(endp - n);
|
*endp = *(endp - n);
|
||||||
|
|
|
@ -43,7 +43,7 @@ FILE* _tfopen(const _TCHAR *file, const _TCHAR *mode)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int fd, rw, oflags = 0;
|
int fd, rw, oflags = 0;
|
||||||
|
|
||||||
if (file == 0)
|
if (file == 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (mode == 0)
|
if (mode == 0)
|
||||||
|
|
|
@ -13,9 +13,9 @@ _ftprintf(register FILE *iop, const _TCHAR *fmt, ...)
|
||||||
int len;
|
int len;
|
||||||
_TCHAR localbuf[BUFSIZ];
|
_TCHAR localbuf[BUFSIZ];
|
||||||
va_list a=0;
|
va_list a=0;
|
||||||
|
|
||||||
|
|
||||||
va_start( a, fmt );
|
|
||||||
|
va_start( a, fmt );
|
||||||
if (iop->_flag & _IONBF)
|
if (iop->_flag & _IONBF)
|
||||||
{
|
{
|
||||||
iop->_flag &= ~_IONBF;
|
iop->_flag &= ~_IONBF;
|
||||||
|
|
|
@ -15,7 +15,7 @@ size_t fread(void *vptr, size_t size, size_t count, FILE *iop)
|
||||||
int c, copy;
|
int c, copy;
|
||||||
|
|
||||||
to_read = size * count;
|
to_read = size * count;
|
||||||
|
|
||||||
if (!OPEN4READING(iop))
|
if (!OPEN4READING(iop))
|
||||||
{
|
{
|
||||||
__set_errno (EINVAL);
|
__set_errno (EINVAL);
|
||||||
|
|
|
@ -19,7 +19,7 @@ int fseek(FILE *f, long offset, int ptrname)
|
||||||
__set_errno (EINVAL);
|
__set_errno (EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
f->_flag &= ~_IOEOF;
|
f->_flag &= ~_IOEOF;
|
||||||
if (!OPEN4WRITING(f))
|
if (!OPEN4WRITING(f))
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ int fseek(FILE *f, long offset, int ptrname)
|
||||||
f->_ptr = f->_base;
|
f->_ptr = f->_base;
|
||||||
f->_flag &= ~_IOUNGETC;
|
f->_flag &= ~_IOUNGETC;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p = fflush(f);
|
p = fflush(f);
|
||||||
return _lseek(_fileno(f), offset, ptrname) == -1 || p == EOF ?
|
return _lseek(_fileno(f), offset, ptrname) == -1 || p == EOF ?
|
||||||
|
|
|
@ -31,7 +31,7 @@ FILE* _tfsopen(const _TCHAR *file, const _TCHAR *mode, int shflag)
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int fd, rw, oflags = 0;
|
int fd, rw, oflags = 0;
|
||||||
_TCHAR tbchar;
|
_TCHAR tbchar;
|
||||||
|
|
||||||
int shf;
|
int shf;
|
||||||
|
|
||||||
if (file == 0)
|
if (file == 0)
|
||||||
|
|
|
@ -10,7 +10,7 @@ void _fwalk(void (*func)(FILE *))
|
||||||
{
|
{
|
||||||
__file_rec *fr;
|
__file_rec *fr;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (fr=__file_rec_list; fr; fr=fr->next)
|
for (fr=__file_rec_list; fr; fr=fr->next)
|
||||||
for (i=0; i<fr->count; i++)
|
for (i=0; i<fr->count; i++)
|
||||||
if (fr->files[i]->_flag)
|
if (fr->files[i]->_flag)
|
||||||
|
|
|
@ -92,7 +92,7 @@ link_warning (gets, "the `gets' function is dangerous and should not be used.")
|
||||||
|
|
||||||
/* Read a newline-terminated multibyte string from stdin into S,
|
/* Read a newline-terminated multibyte string from stdin into S,
|
||||||
removing the trailing newline. Return S or NULL. */
|
removing the trailing newline. Return S or NULL. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
gets (s)
|
gets (s)
|
||||||
char *s;
|
char *s;
|
||||||
|
@ -114,7 +114,7 @@ gets (s)
|
||||||
while ((c = getc(stdin)) != EOF) {
|
while ((c = getc(stdin)) != EOF) {
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
break;
|
break;
|
||||||
if ( isascii(c) )
|
if ( isascii(c) )
|
||||||
*cs++ = c;
|
*cs++ = c;
|
||||||
#ifdef _MULTIBYTE
|
#ifdef _MULTIBYTE
|
||||||
else if ( isleadbyte(c) ) {
|
else if ( isleadbyte(c) ) {
|
||||||
|
@ -142,5 +142,5 @@ gets (s)
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,7 +30,7 @@ int _getw(FILE *stream)
|
||||||
|
|
||||||
/* Is there a better way? */
|
/* Is there a better way? */
|
||||||
if (fread( &w, sizeof(w), 1, stream) != 1) {
|
if (fread( &w, sizeof(w), 1, stream) != 1) {
|
||||||
// EOF is a legitimate integer value so users must
|
// EOF is a legitimate integer value so users must
|
||||||
// check feof or ferror to verify an EOF return.
|
// check feof or ferror to verify an EOF return.
|
||||||
return(EOF);
|
return(EOF);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ FILE *_tpopen (const _TCHAR *cm, const _TCHAR *md) /* program name, pipe mode */
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_tcscpy(szCmdLine, s);
|
_tcscpy(szCmdLine, s);
|
||||||
s = _tcsrchr(szCmdLine, '.');
|
s = _tcsrchr(szCmdLine, '.');
|
||||||
if (s)
|
if (s)
|
||||||
|
@ -73,7 +73,7 @@ FILE *_tpopen (const _TCHAR *cm, const _TCHAR *md) /* program name, pipe mode */
|
||||||
StartupInfo.hStdInput = hReadPipe;
|
StartupInfo.hStdInput = hReadPipe;
|
||||||
StartupInfo.dwFlags |= STARTF_USESTDHANDLES;
|
StartupInfo.dwFlags |= STARTF_USESTDHANDLES;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = CreateProcess(szComSpec,
|
result = CreateProcess(szComSpec,
|
||||||
szCmdLine,
|
szCmdLine,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -119,7 +119,7 @@ FILE *_tpopen (const _TCHAR *cm, const _TCHAR *md) /* program name, pipe mode */
|
||||||
int _pclose (FILE *pp)
|
int _pclose (FILE *pp)
|
||||||
{
|
{
|
||||||
TRACE("_pclose(%x)",pp);
|
TRACE("_pclose(%x)",pp);
|
||||||
|
|
||||||
fclose(pp);
|
fclose(pp);
|
||||||
if (!TerminateProcess(pp->_tmpfname ,0))
|
if (!TerminateProcess(pp->_tmpfname ,0))
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
|
@ -54,7 +54,7 @@ int putc(int c, FILE* fp)
|
||||||
if (fp->_cnt > 0) {
|
if (fp->_cnt > 0) {
|
||||||
fp->_cnt--;
|
fp->_cnt--;
|
||||||
*(fp)->_ptr++ = (unsigned char)c;
|
*(fp)->_ptr++ = (unsigned char)c;
|
||||||
return (int)(unsigned char)c;
|
return (int)(unsigned char)c;
|
||||||
} else {
|
} else {
|
||||||
return _flsbuf((unsigned char)c, fp);
|
return _flsbuf((unsigned char)c, fp);
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ wint_t putwc(wint_t c, FILE* fp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
return WEOF;
|
return WEOF;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ int puts(const char *s)
|
||||||
int _putws(const wchar_t *s)
|
int _putws(const wchar_t *s)
|
||||||
{
|
{
|
||||||
wint_t c;
|
wint_t c;
|
||||||
|
|
||||||
while ((c = *s++)) {
|
while ((c = *s++)) {
|
||||||
putwchar(c);
|
putwchar(c);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
* modify it under the terms of the GNU Library General Public License as
|
* modify it under the terms of the GNU Library General Public License as
|
||||||
* published by the Free Software Foundation; either version 2 of the
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
* License, or (at your option) any later version.
|
* License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* The GNU C Library is distributed in the hope that it will be useful,
|
* The GNU C Library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* 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
|
* License along with the GNU C Library; see the file COPYING.LIB. If
|
||||||
* not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
* not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||||
|
|
|
@ -20,11 +20,11 @@ extern __file_rec *__file_rec_list;
|
||||||
int _rmtmp( void )
|
int _rmtmp( void )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
loop files and check for _tmpfname
|
loop files and check for _tmpfname
|
||||||
*/
|
*/
|
||||||
__file_rec *fr = __file_rec_list;
|
__file_rec *fr = __file_rec_list;
|
||||||
__file_rec **last_fr = &__file_rec_list;
|
__file_rec **last_fr = &__file_rec_list;
|
||||||
|
|
||||||
int total_closed = 0;
|
int total_closed = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char temp_name[260];
|
char temp_name[260];
|
||||||
|
@ -53,5 +53,5 @@ loop files and check for _tmpfname
|
||||||
/* it isn't full, we can add to it */
|
/* it isn't full, we can add to it */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return total_closed;
|
return total_closed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,9 @@ int setvbuf(FILE *f, char *buf, int type, size_t len)
|
||||||
if ( f->_base != NULL )
|
if ( f->_base != NULL )
|
||||||
fflush(f);
|
fflush(f);
|
||||||
/* Cannot use _IOLBF as flag value because _IOLBF is equal to _IOSTRG */
|
/* Cannot use _IOLBF as flag value because _IOLBF is equal to _IOSTRG */
|
||||||
if (type == _IOLBF)
|
if (type == _IOLBF)
|
||||||
type = _IO_LBF;
|
type = _IO_LBF;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case _IOFBF:
|
case _IOFBF:
|
||||||
|
|
|
@ -33,14 +33,14 @@ _TINT _ungettc(_TINT c, FILE *f)
|
||||||
|
|
||||||
f->_cnt+=sizeof(_TCHAR);
|
f->_cnt+=sizeof(_TCHAR);
|
||||||
f->_ptr-=sizeof(_TCHAR);
|
f->_ptr-=sizeof(_TCHAR);
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
if (*((_TCHAR*)(f->_ptr)) != c)
|
if (*((_TCHAR*)(f->_ptr)) != c)
|
||||||
{
|
{
|
||||||
f->_flag |= _IOUNGETC;
|
f->_flag |= _IOUNGETC;
|
||||||
*((_TCHAR*)(f->_ptr)) = c;
|
*((_TCHAR*)(f->_ptr)) = c;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* This is the old unicode version. Dunno what version is most correct. -Gunnar */
|
/* This is the old unicode version. Dunno what version is most correct. -Gunnar */
|
||||||
f->_flag |= _IOUNGETC;
|
f->_flag |= _IOUNGETC;
|
||||||
*((_TCHAR*)(f->_ptr)) = c;
|
*((_TCHAR*)(f->_ptr)) = c;
|
||||||
|
|
|
@ -213,7 +213,7 @@ static int numberf(FILE * f, double __n, char exp_sign, int size, int precision
|
||||||
double* __n;
|
double* __n;
|
||||||
double_t* n;
|
double_t* n;
|
||||||
} n;
|
} n;
|
||||||
|
|
||||||
n.__n = &__n;
|
n.__n = &__n;
|
||||||
|
|
||||||
if ( exp_sign == 'g' || exp_sign == 'G' || exp_sign == 'e' || exp_sign == 'E' ) {
|
if ( exp_sign == 'g' || exp_sign == 'G' || exp_sign == 'e' || exp_sign == 'E' ) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ _vsntprintf(_TCHAR *str, size_t maxlen, const _TCHAR *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
FILE f = {0};
|
FILE f = {0};
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
f._flag = _IOWRT|_IOSTRG|_IOBINARY;
|
f._flag = _IOWRT|_IOSTRG|_IOBINARY;
|
||||||
f._ptr = (char*)str;
|
f._ptr = (char*)str;
|
||||||
f._cnt = maxlen;
|
f._cnt = maxlen;
|
||||||
|
|
|
@ -9,7 +9,7 @@ struct __atexit *__atexit_ptr = 0;
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
void exit(int status)
|
void exit(int status)
|
||||||
{
|
{
|
||||||
//int i;
|
//int i;
|
||||||
struct __atexit *a = __atexit_ptr;
|
struct __atexit *a = __atexit_ptr;
|
||||||
|
|
|
@ -57,9 +57,9 @@ int __set_errno(int error)
|
||||||
void _dosmaperr(unsigned long oserror)
|
void _dosmaperr(unsigned long oserror)
|
||||||
{
|
{
|
||||||
int pos, base, lim;
|
int pos, base, lim;
|
||||||
|
|
||||||
__set_doserrno(oserror);
|
__set_doserrno(oserror);
|
||||||
|
|
||||||
/* Use binary chop to find the corresponding errno code */
|
/* Use binary chop to find the corresponding errno code */
|
||||||
for (base=0, lim=sizeof(doserrmap)/sizeof(doserrmap[0]); lim; lim >>= 1) {
|
for (base=0, lim=sizeof(doserrmap)/sizeof(doserrmap[0]); lim; lim >>= 1) {
|
||||||
pos = base+(lim >> 1);
|
pos = base+(lim >> 1);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/stdlib/itoa.c
|
* FILE: lib/msvcrt/stdlib/itoa.c
|
||||||
* PURPOSE: converts a integer to ascii
|
* PURPOSE: converts a integer to ascii
|
||||||
* PROGRAMER:
|
* PROGRAMER:
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 1995: Created
|
* 1995: Created
|
||||||
* 1998: Added ltoa Boudewijn Dekker
|
* 1998: Added ltoa Boudewijn Dekker
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/msvcrt/stdlib/itow.c
|
* FILE: lib/msvcrt/stdlib/itow.c
|
||||||
* PURPOSE: converts a integer to wchar_t
|
* PURPOSE: converts a integer to wchar_t
|
||||||
* PROGRAMER:
|
* PROGRAMER:
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 1995: Created
|
* 1995: Created
|
||||||
* 1998: Added ltoa Boudewijn Dekker
|
* 1998: Added ltoa Boudewijn Dekker
|
||||||
|
@ -147,7 +147,7 @@ wchar_t* _ultow(unsigned long value, wchar_t* string, int radix)
|
||||||
#endif /*_MSVCRT_LIB_*/
|
#endif /*_MSVCRT_LIB_*/
|
||||||
}
|
}
|
||||||
sp = string;
|
sp = string;
|
||||||
|
|
||||||
while (tp > tmp) {
|
while (tp > tmp) {
|
||||||
*sp++ = *--tp;
|
*sp++ = *--tp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ int _putenv(const char* val)
|
||||||
{
|
{
|
||||||
int size, result;
|
int size, result;
|
||||||
wchar_t *woption;
|
wchar_t *woption;
|
||||||
|
|
||||||
size = MultiByteToWideChar(CP_ACP, 0, val, -1, NULL, 0);
|
size = MultiByteToWideChar(CP_ACP, 0, val, -1, NULL, 0);
|
||||||
woption = malloc(size* sizeof(wchar_t));
|
woption = malloc(size* sizeof(wchar_t));
|
||||||
if (woption == NULL)
|
if (woption == NULL)
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue