2 * wincecompat.c : wince compatiblity module
4 * See Copyright for the status of this software.
6 * javier@tiresiassoft.com
11 #include "wincecompat.h"
13 char *strError[]= {"Error 0","","No such file or directory","","","","","Arg list too long",
14 "Exec format error","Bad file number","","","Not enough core","Permission denied","","",
15 "","File exists","Cross-device link","","","","Invalid argument","","Too many open files",
16 "","","","No space left on device","","","","","Math argument","Result too large","",
17 "Resource deadlock would occur", "Unknown error under wince"};
22 int read(int handle, char *buffer, unsigned int len)
24 return(fread(&buffer[0], len, 1, (FILE *) handle));
27 int write(int handle, const char *buffer, unsigned int len)
29 return(fwrite(&buffer[0], len,1,(FILE *) handle));
32 int open(const char *filename,int oflag, ...)
34 char mode[3]; /* mode[0] ="w/r/a" mode[1]="+" */
36 if ( oflag==(O_WRONLY|O_CREAT) )
38 else if (oflag==O_RDONLY)
40 return fopen(filename, mode);
46 return ( fclose((FILE *) handle) );
50 char *getcwd( char *buffer, unsigned int size)
52 /* Windows CE don't have the concept of a current directory
53 * so we just return NULL to indicate an error
58 char *getenv( const char *varname )
63 char *strerror(int errnum)
65 if (errnum>MAX_STRERROR)
66 return strError[MAX_STRERROR];
68 return strError[errnum];