/* ****************************************************************************** * HEADER FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: stdlib.h,v $ $Revision: 1.6 $ * $Source: /home/interpeak/CVSRoot/ipxinc/include/stdlib.h,v $ * $Author: lob $ $Date: 2010-12-16 11:01:21 $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Lennart Bang ****************************************************************************** */ #ifndef IP_STDLIB_H #define IP_STDLIB_H /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ #include "ipcom_config.h" /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #define IPCOM_USE_CLIB_PROTO #include "ipcom_clib.h" #ifdef IPCOM_STDOUT_TO_SYSLOG #include "ipcom_stdio_syslog.h" #endif #include "sys/types.h" #ifdef __cplusplus extern "C" { #endif /* **************************************************************************** * 4 DEFINES **************************************************************************** */ #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 /* **************************************************************************** * 5 TYPES **************************************************************************** */ /* **************************************************************************** * 6 FUNCTIONS **************************************************************************** */ #define getenv(n) ipcom_getenv(n) #define setenv(n, v, r) ipcom_setenv(n, v, r) #if defined(IPBOUNDS) || defined(__BOUNDS_CHECKING_ON) extern void *malloc(size_t size); #elif defined(IPCOM_USE_DMALLOC) && !defined(IPCOM_DMALLOC_C) #define malloc(s) ipcom_dmalloc(s, __FILE__, __FUNCTION__, __LINE__) #elif (defined(IPCOM_MALLOC) && IPCOM_MALLOC == 1) || defined(IPCOM_PORT_MALLOC) #define malloc ipcom_malloc #elif defined(IPCOM_MALLOC) #define malloc IPCOM_MALLOC #endif #if defined(IPBOUNDS) || defined(__BOUNDS_CHECKING_ON) extern void *calloc(size_t nelem, size_t elsize); #elif defined(IPCOM_USE_DMALLOC) && !defined(IPCOM_DMALLOC_C) #define calloc(n,s) ipcom_dcalloc(n,s, __FILE__, __FUNCTION__, __LINE__) #elif (defined(IPCOM_CALLOC) && IPCOM_CALLOC == 1) || defined(IPCOM_PORT_CALLOC) #define calloc(n,s) ipcom_calloc(n,s) #elif defined(IPCOM_CALLOC) #define calloc(n,s) IPCOM_CALLOC(n,s) #endif #if defined(IPBOUNDS) || defined(__BOUNDS_CHECKING_ON) extern void *realloc(void *ptr, size_t size); #elif defined(IPCOM_USE_DMALLOC) && !defined(IPCOM_DMALLOC_C) #define realloc(p,s) ipcom_drealloc(p,s, __FILE__, __FUNCTION__, __LINE__) #elif (defined(IPCOM_REALLOC) && IPCOM_REALLOC == 1) || defined(IPCOM_PORT_REALLOC) #define realloc ipcom_realloc #elif defined(IPCOM_REALLOC) #define realloc IPCOM_REALLOC #endif #if defined(IPBOUNDS) || defined(__BOUNDS_CHECKING_ON) extern void free(void *ptr); #elif defined(IPCOM_USE_DMALLOC) && !defined(IPCOM_DMALLOC_C) #define free(p) ipcom_dfree(p) #elif (defined(IPCOM_FREE) && IPCOM_FREE == 1) || defined(IPCOM_PORT_FREE) #define free ipcom_free #elif defined(IPCOM_FREE) #define free IPCOM_FREE #endif #if (defined(IPCOM_ABORT) && IPCOM_ABORT == 1) || defined(IPCOM_PORT_ABORT) #define abort ipcom_abort #elif defined(IPCOM_ABORT) #define abort IPCOM_ABORT #endif #if (defined(IPCOM_EXIT) && IPCOM_EXIT == 1) || defined(IPCOM_PORT_EXIT) #define exit(s) ipcom_exit(s) #elif defined(IPCOM_EXIT) #define exit(s) IPCOM_EXIT(s) #endif #if (defined(IPCOM_STRTOD) && IPCOM_STRTOD == 1) || defined(IPCOM_PORT_STRTOD) #define strtod(n,e) ipcom_strtod(n,e) #elif defined(IPCOM_STRTOD) #define strtod(n,e) IPCOM_STRTOD(n,e) #endif #if (defined(IPCOM_ATOI) && IPCOM_ATOI == 1) || defined(IPCOM_PORT_ATOI) #define atoi(s) ipcom_atoi(s) #elif defined(IPCOM_ATOI) #define atoi(s) IPCOM_ATOI(s) #endif #if (defined(IPCOM_ATOL) && IPCOM_ATOL == 1) || defined(IPCOM_PORT_ATOL) #define atol(s) ipcom_atol(s) #elif defined(IPCOM_ATOL) #define atol(s) IPCOM_ATOL(s) #endif #if (defined(IPCOM_QSORT) && IPCOM_QSORT == 1) || defined(IPCOM_PORT_QSORT) #define qsort ipcom_qsort #elif defined(IPCOM_QSORT) #define qsort IPCOM_QSORT #endif #if (defined(IPCOM_BSEARCH) && IPCOM_BSEARCH == 1) || defined(IPCOM_PORT_BSEARCH) #define bsearch ipcom_bsearch #elif defined(IPCOM_BSEARCH) #define bsearch IPCOM_BSEARCH #endif #if (defined(IPCOM_STRTOL) && IPCOM_STRTOL == 1) || defined(IPCOM_PORT_STRTOL) #define strtol(s,e,b) ipcom_strtol(s,e,b) #elif defined(IPCOM_STRTOL) #define strtol(s,e,b) IPCOM_STRTOL(s,e,b) #endif #if (defined(IPCOM_STRTOUL) && IPCOM_STRTOUL == 1) || defined(IPCOM_PORT_STRTOUL) #define strtoul(s,e,b) ipcom_strtoul(s,e,b) #elif defined(IPCOM_STRTOUL) #define strtoul(s,e,b) IPCOM_STRTOUL(s,e,b) #endif #if (defined(IPCOM_RANDOM) && IPCOM_RANDOM == 1) || defined(IPCOM_PORT_RANDOM) #define random ipcom_random #elif defined(IPCOM_RANDOM) #define random IPCOM_RANDOM #endif #if (defined(IPCOM_RAND) && IPCOM_RAND == 1) || defined(IPCOM_PORT_RAND) #define rand ipcom_rand #elif defined(IPCOM_RAND) #define rand IPCOM_RAND #endif #if (defined(IPCOM_SRANDOM) && IPCOM_SRANDOM == 1) || defined(IPCOM_PORT_SRANDOM) #define srandom(a) ipcom_srandom(a) #elif defined(IPCOM_SRANDOM) #define srandom(a) IPCOM_SRANDOM(a) #endif #if (defined(IPCOM_SRAND) && IPCOM_SRAND == 1) || defined(IPCOM_PORT_SRAND) #define srand(a) ipcom_srand(a) #elif defined(IPCOM_SRAND) #define srand(a) IPCOM_SRAND(a) #endif #ifdef IPCOM_STDOUT_TO_SYSLOG /* exit */ #ifdef exit #undef exit #endif #define exit ipcom_exit_syslog #endif #ifdef NETSNMP_INTERPEAK #define abs(i) ipnetsnmp_abs(i) IP_PUBLIC int ipnetsnmp_abs(int i); #define mkstemp(t) ipnetsnmp_mkstemp(t) IP_PUBLIC int ipnetsnmp_mkstemp(char *template); #define system(c) ipnetsnmp_system(c) IP_PUBLIC int ipnetsnmp_system(const char *command); #endif /* #ifdef NETSNMP_INTERPEAK */ #ifdef __cplusplus } #endif #endif /* **************************************************************************** * END OF FILE **************************************************************************** */