libc.cc

Go to the documentation of this file.
00001 /*
00002  * This file is part of openSDK.
00003  *
00004  * Copyright (C) 2007 openSDK team
00005  *
00006  * openSDK is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; version 2.
00009  *
00010  * openSDK is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with openSDK; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  *
00019  *     $Id: libc.cc,v 1.3 2007/07/15 15:06:13 nuno-lopes Exp $
00020  */
00021 
00022 #include <cstring>
00023 #include <cstdio>
00024 #include <sys/types.h>
00025 #include <sys/stat.h>
00026 #include <fcntl.h>
00027 #include <ModuleData.h>
00028 
00029 extern "C" {
00030 
00032 char *__wrap_strtok(char *str, const char *delim)
00033 {
00034         return strtok_r(str, delim, &MOD_DATA(strtok_ptr));
00035 }
00036 
00037 
00039 FILE *__wrap_fopen(const char *path, const char *mode)
00040 {
00041         path = (*path == '/' ? (path+1) : path);
00042         char *newpath = resolve_case_insensitive_path(path);
00043 
00044         FILE *fp = fopen(newpath, mode);
00045 
00046         free(newpath);
00047         return fp;
00048 }
00049 
00050 
00052 int __wrap_open(const char *path, int flags, mode_t mode)
00053 {
00054         path = (*path == '/' ? (path+1) : path);
00055         char *newpath = resolve_case_insensitive_path(path);
00056 
00057         int fd = open(newpath, flags, mode);
00058 
00059         free(newpath);
00060         return fd;
00061 }
00062 
00063 }

Generated on Sun Dec 2 23:04:28 2007 for openSDK by  doxygen 1.3.9.1