Implemented makepath, rand() returns correct range, fixed fputc.
This commit is contained in:
parent
d5240f13db
commit
cc08b38f95
|
@ -51,6 +51,9 @@ AJ 990101:
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "winnls.h"
|
#include "winnls.h"
|
||||||
|
|
||||||
|
/* windows.h RAND_MAX is smaller than normal RAND_MAX */
|
||||||
|
#define CRTDLL_RAND_MAX 0x7fff
|
||||||
|
|
||||||
static DOS_FULL_NAME CRTDLL_tmpname;
|
static DOS_FULL_NAME CRTDLL_tmpname;
|
||||||
|
|
||||||
UINT CRTDLL_argc_dll; /* CRTDLL.23 */
|
UINT CRTDLL_argc_dll; /* CRTDLL.23 */
|
||||||
|
@ -670,7 +673,7 @@ INT __cdecl CRTDLL_fflush( CRTDLL_FILE *file )
|
||||||
*/
|
*/
|
||||||
INT __cdecl CRTDLL_rand()
|
INT __cdecl CRTDLL_rand()
|
||||||
{
|
{
|
||||||
return rand();
|
return (rand() & CRTDLL_RAND_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -734,6 +737,7 @@ INT __cdecl CRTDLL_fgetc( CRTDLL_FILE *file )
|
||||||
DWORD res;
|
DWORD res;
|
||||||
char ch;
|
char ch;
|
||||||
if (!ReadFile( file->handle, &ch, 1, &res, NULL )) return -1;
|
if (!ReadFile( file->handle, &ch, 1, &res, NULL )) return -1;
|
||||||
|
if (res != 1) return -1;
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1719,6 +1723,50 @@ VOID __cdecl CRTDLL__splitpath(LPCSTR path, LPSTR drive, LPSTR directory, LPSTR
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
* _makepath (CRTDLL.182)
|
||||||
|
*/
|
||||||
|
|
||||||
|
VOID __cdecl CRTDLL__makepath(LPSTR path, LPCSTR drive,
|
||||||
|
LPCSTR directory, LPCSTR filename,
|
||||||
|
LPCSTR extension )
|
||||||
|
{
|
||||||
|
char ch;
|
||||||
|
TRACE(crtdll,"CRTDLL__makepath got %s %s %s %s\n", drive, directory,
|
||||||
|
filename, extension);
|
||||||
|
|
||||||
|
if ( !path )
|
||||||
|
return;
|
||||||
|
|
||||||
|
path[0] = 0;
|
||||||
|
if ( drive )
|
||||||
|
if ( drive[0] ) {
|
||||||
|
sprintf(path, "%c:", drive[0]);
|
||||||
|
}
|
||||||
|
if ( directory )
|
||||||
|
if ( directory[0] ) {
|
||||||
|
strcat(path, directory);
|
||||||
|
ch = path[strlen(path)-1];
|
||||||
|
if (ch != '/' && ch != '\\')
|
||||||
|
strcat(path,"\\");
|
||||||
|
}
|
||||||
|
if ( filename )
|
||||||
|
if ( filename[0] ) {
|
||||||
|
strcat(path, filename);
|
||||||
|
if ( extension ) {
|
||||||
|
if ( extension[0] ) {
|
||||||
|
if ( extension[0] != '.' ) {
|
||||||
|
strcat(path,".");
|
||||||
|
}
|
||||||
|
strcat(path,extension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACE(crtdll,"CRTDLL__makepath returns %s\n",path);
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* _getcwd (CRTDLL.120)
|
* _getcwd (CRTDLL.120)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -183,7 +183,7 @@ type win32
|
||||||
179 stub _lseek
|
179 stub _lseek
|
||||||
180 cdecl _ltoa(long str long) CRTDLL__ltoa
|
180 cdecl _ltoa(long str long) CRTDLL__ltoa
|
||||||
181 stub _ltow
|
181 stub _ltow
|
||||||
182 stub _makepath
|
182 cdecl _makepath (ptr str str str str) CRTDLL__makepath
|
||||||
183 stub _matherr
|
183 stub _matherr
|
||||||
184 stub _mbbtombc
|
184 stub _mbbtombc
|
||||||
185 stub _mbbtype
|
185 stub _mbbtype
|
||||||
|
|
Loading…
Reference in New Issue