1 | /* $Id: compat.h 2 2009-10-12 09:51:22Z mamonski $ */ |
---|
2 | /* |
---|
3 | * FedStage DRMAA utilities library |
---|
4 | * Copyright (C) 2006-2008 FedStage Systems |
---|
5 | * |
---|
6 | * This program is free software: you can redistribute it and/or modify |
---|
7 | * it under the terms of the GNU General Public License as published by |
---|
8 | * the Free Software Foundation, either version 3 of the License, or |
---|
9 | * (at your option) any later version. |
---|
10 | * |
---|
11 | * This program is distributed in the hope that it will be useful, |
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | * GNU General Public License for more details. |
---|
15 | * |
---|
16 | * You should have received a copy of the GNU General Public License |
---|
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef __DRMAA_UTILS__COMPAT_H |
---|
21 | #define __DRMAA_UTILS__COMPAT_H |
---|
22 | |
---|
23 | #ifdef HAVE_CONFIG_H |
---|
24 | # include <config.h> |
---|
25 | #endif |
---|
26 | |
---|
27 | #include <sys/types.h> |
---|
28 | |
---|
29 | #include <stddef.h> |
---|
30 | #include <stdarg.h> |
---|
31 | |
---|
32 | #ifdef HAVE_STDINT_H |
---|
33 | # include <stdint.h> |
---|
34 | #else |
---|
35 | # ifdef HAVE_INTTYPES_H |
---|
36 | # include <inttypes.h> |
---|
37 | # else |
---|
38 | # warning "no stdint.h nor inttypes.h found" |
---|
39 | # endif |
---|
40 | #endif /* ! HAVE_STDINT_H */ |
---|
41 | |
---|
42 | #ifdef HAVE_STDBOOL_H |
---|
43 | # include <stdbool.h> |
---|
44 | #else |
---|
45 | # ifndef bool |
---|
46 | # define bool int |
---|
47 | # endif |
---|
48 | # ifndef true |
---|
49 | # define true 1 |
---|
50 | # endif |
---|
51 | # ifndef false |
---|
52 | # define false 0 |
---|
53 | # endif |
---|
54 | #endif /* ! HAVE_STDBOOL_H */ |
---|
55 | |
---|
56 | #ifndef HAVE_STRLCPY |
---|
57 | size_t strlcpy( char *dest, const char *src, size_t size ) |
---|
58 | __attribute__(( weak )); |
---|
59 | #endif |
---|
60 | |
---|
61 | #ifndef HAVE_STRNDUP |
---|
62 | char *strndup( const char *s, size_t n ) |
---|
63 | __attribute__(( weak )); |
---|
64 | #endif |
---|
65 | |
---|
66 | #ifndef HAVE_ASPRINTF |
---|
67 | int asprintf( char **strp, const char *fmt, ... ) |
---|
68 | __attribute__(( weak )); |
---|
69 | #endif |
---|
70 | |
---|
71 | #ifndef HAVE_VASPRINTF |
---|
72 | int vasprintf( char **strp, const char *fmt, va_list ap ) |
---|
73 | __attribute__(( weak )); |
---|
74 | #endif |
---|
75 | |
---|
76 | #endif /* __DRMAA_UTILS__COMPAT_H */ |
---|
77 | |
---|