File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / libxml2 / win32 / wince / wincecompat.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:37:58 2012 UTC (12 years, 4 months ago) by misho
Branches: libxml2, MAIN
CVS tags: v2_8_0p0, v2_8_0, v2_7_8, HEAD
libxml2

    1: /*
    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: 
   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"};
   18: 
   19: 
   20: int errno=0;
   21: 
   22: int read(int handle, char *buffer, unsigned int len)
   23: {
   24: 	return(fread(&buffer[0], len, 1, (FILE *) handle));
   25: }
   26: 
   27: int write(int handle, const char *buffer, unsigned int len)
   28: {
   29: 	return(fwrite(&buffer[0], len,1,(FILE *) handle));
   30: }
   31: 
   32: int 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) )
   37: 		mode[0]="w";
   38: 	else if (oflag==O_RDONLY)
   39: 		mode[0]="r";
   40: 	return fopen(filename, mode);
   41: 
   42: }
   43: 
   44: int close(int handle)
   45: {
   46: 	return ( fclose((FILE *) handle) );
   47: }
   48: 
   49: 
   50: char *getcwd( char *buffer, unsigned int size)
   51: {
   52:     /* Windows CE don't have the concept of a current directory
   53:      * so we just return NULL to indicate an error
   54:      */
   55:     return NULL;
   56: }
   57: 
   58: char *getenv( const char *varname )
   59: {
   60: 	return NULL;
   61: }
   62: 
   63: char *strerror(int errnum)
   64: {
   65: 	if (errnum>MAX_STRERROR)
   66: 		return strError[MAX_STRERROR];
   67: 	else
   68: 		return strError[errnum];
   69: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>