blob: bd49c575408b88230692f1774e6447c05ac99881 [file] [log] [blame]
Igor Zlatkovic4320d872002-09-29 17:56:43 +00001/*
2 * wincecompat.c : wince compatiblity module
3 *
4 * See Copyright for the status of this software.
5 *
6 * javier@tiresiassoft.com
7 *
8 * 17 Sep 2002 created
9 */
10
11#include "wincecompat.h"
12
13char *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"};
18
19
20int errno=0;
21
22int read(int handle, char *buffer, unsigned int len)
23{
24 return(fread(&buffer[0], len, 1, (FILE *) handle));
25}
26
27int write(int handle, const char *buffer, unsigned int len)
28{
29 return(fwrite(&buffer[0], len,1,(FILE *) handle));
30}
31
32int open(const char *filename,int oflag, ...)
33{
34 char mode[3]; /* mode[0] ="w/r/a" mode[1]="+" */
35 mode[2]=0;
36 if ( oflag==(O_WRONLY|O_CREAT) )
Patrick Ganstereraabc0842012-08-10 12:34:24 +020037 mode[0]='w';
Igor Zlatkovic4320d872002-09-29 17:56:43 +000038 else if (oflag==O_RDONLY)
Patrick Ganstereraabc0842012-08-10 12:34:24 +020039 mode[0]='r';
40 return (int) fopen(filename, mode);
Igor Zlatkovic4320d872002-09-29 17:56:43 +000041}
42
43int close(int handle)
44{
45 return ( fclose((FILE *) handle) );
46}
47
48
Daniel Veillard59d3ed82007-04-17 12:44:58 +000049char *getcwd( char *buffer, unsigned int size)
50{
51 /* Windows CE don't have the concept of a current directory
52 * so we just return NULL to indicate an error
53 */
54 return NULL;
55}
56
Igor Zlatkovic4320d872002-09-29 17:56:43 +000057char *getenv( const char *varname )
58{
59 return NULL;
60}
61
62char *strerror(int errnum)
63{
64 if (errnum>MAX_STRERROR)
65 return strError[MAX_STRERROR];
66 else
67 return strError[errnum];
68}