edelib  2.0.0
edelib/Missing.h
00001 /*
00002  * $Id: Missing.h 2944 2009-11-17 13:20:31Z karijes $
00003  *
00004  * Provides the missing functions
00005  * Copyright (c) 2005-2007 edelib authors
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this library. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00021 #ifndef __EDELIB_MISSING_H__
00022 #define __EDELIB_MISSING_H__
00023 
00024 #include "edelib-global.h"
00025 
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029 
00030 /* include dirent intentionally so we can emulate it if missing */
00031 #include <dirent.h>
00032 
00042 EDELIB_API int edelib_setenv(const char* name, const char* value, int overwrite);
00043 
00048 EDELIB_API int edelib_unsetenv(const char* name);
00049 
00053 EDELIB_API unsigned int edelib_strnlen(const char* str, unsigned int maxlen);
00054 
00059 EDELIB_API char* edelib_strndup(const char* str, unsigned int maxlen);
00060 
00067 EDELIB_API unsigned long edelib_strlcpy(char* dst, const char* src, unsigned long sz);
00068 
00075 EDELIB_API unsigned long edelib_strlcat(char* dst, const char* src, unsigned long sz);
00076 
00081 EDELIB_API int edelib_scandir(const char* dir, struct dirent*** namelist, 
00082                 int (*filter)(const struct dirent* name),
00083                 int (*compar)(struct dirent** n1, struct dirent** n2));
00084 
00089 EDELIB_API int edelib_alphasort(struct dirent **n1, struct dirent **n2);
00090 
00095 EDELIB_API int edelib_daemon(int nochdir, int noclose);
00096 
00097 #ifdef __cplusplus
00098 }
00099 #endif
00100 
00101 #endif