implement use of _get_osfhandle

svn path=/trunk/; revision=257
This commit is contained in:
Boudewijn Dekker 1999-02-21 09:11:06 +00:00
parent 2c7fb0c72e
commit f6e36a9f86
8 changed files with 10 additions and 14 deletions

View file

@ -3,8 +3,7 @@
#include <string.h>
#include <stdlib.h>
#include <libc/file.h>
//#include <libc/local.h>
//#include <libc/stdiohk.h>
FILE * __alloc_file(void);

View file

@ -1,11 +1,10 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
//#include <libc/stubs.h>
#include <stdio.h>
#include <io.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
//#include <unistd.h>
#include <libc/file.h>
#ifndef __dj_include_stdio_h_

View file

@ -35,7 +35,7 @@ fputs(const char *s, FILE *f)
return(r);
*/
int r = 0;
if ( !WriteFile(filehnd(f->_file),s,strlen(s),&r,NULL) )
if ( !WriteFile(_get_osfhandle(f->_file),s,strlen(s),&r,NULL) )
return -1;
return r;

View file

@ -8,7 +8,7 @@ int getc(FILE *f)
{
int c;
DWORD NumberOfBytesRead;
if ( !ReadFile(filehnd(f->_file),&c, 1, &NumberOfBytesRead, NULL) )
if ( !ReadFile(_get_osfhandle(f->_file),&c, 1, &NumberOfBytesRead, NULL) )
return -1;
if ( NumberOfBytesRead == 0 )
return -1;

View file

@ -21,7 +21,7 @@ int putc(int c, FILE *fp)
}
return(_flsbuf(c,fp));
}
if ( !WriteFile(filehnd(fp->_file),&c,1,&r,NULL) )
if ( !WriteFile(_get_osfhandle(fp->_file),&c,1,&r,NULL) )
return -1;
return r;

View file

@ -14,7 +14,7 @@ puts(const char *s)
return putchar('\n');
*/
int r = 0;
if ( !WriteFile(filehnd(stdout->_file),s,strlen(s),&r,NULL) )
if ( !WriteFile(_get_osfhandle(stdout->_file),s,strlen(s),&r,NULL) )
return -1;
return putchar('\n');;

View file

@ -1,4 +1,5 @@
#include <windows.h>
#include <io.h>
int remove(const char *fn)
{
@ -6,4 +7,4 @@ int remove(const char *fn)
return -1;
return 0;
}

View file

@ -2,12 +2,9 @@
#include <stdio.h>
#include <io.h>
int rename(const char *old, const char *new)
{
return _rename(old,new);
}
int _rename(const char *old, const char *new)
int rename(const char *old, const char *new)
{
if ( !MoveFile(old,new) )
return -1;