00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _TSK_OS_H
00011 #define _TSK_OS_H
00012
00013
00014
00015
00016
00017 #if defined(sun)
00018 #define SUPPORTED
00019 #define USE_LIBAFF
00020 #define USE_LIBEWF
00021 #define HAVE_UNISTD
00022
00023 #include <sys/sysmacros.h>
00024
00025
00026 #include <inttypes.h>
00027 #include <sys/inttypes.h>
00028 #endif
00029
00030
00031
00032 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined (__OpenBSD__) || defined (__APPLE__) || \
00033 defined(linux) || defined (__linux__) || defined(__bsdi__)
00034
00035 #define SUPPORTED
00036 #define USE_LIBAFF
00037 #define USE_LIBEWF
00038 #define HAVE_UNISTD
00039
00040 #include <inttypes.h>
00041 #endif
00042
00043
00044 #if defined(__CYGWIN__)
00045 #define SUPPORTED
00046 #define USE_LIBAFF
00047 #define USE_LIBEWF
00048 #define HAVE_UNISTD
00049
00050 #include <inttypes.h>
00051
00052 #define roundup(x, y) \
00053 ( ( ((x)+((y) - 1)) / (y)) * (y) )
00054
00055 #endif
00056
00057
00058 #if defined(__INTERNIX)
00059 #define SUPPORTED
00060 #include <inttypes.h>
00061 #define HAVE_UNISTD
00062
00063 #define roundup(x, y) \
00064 ( ( ((x)+((y) - 1)) / (y)) * (y) )
00065
00066 #endif
00067
00068
00069 #if defined(_WIN32) || defined (__WIN32__)
00070 #define SUPPORTED
00071 #define TSK_WIN32
00072 #ifndef UNICODE
00073 #define UNICODE
00074 #endif
00075 #ifndef _UNICODE
00076 #define _UNICODE
00077 #endif
00078 #define WIN32_LEAN_AND_MEAN
00079
00080 #include <windows.h>
00081 #include <tchar.h>
00082 #include <io.h>
00083
00084 #define _CRT_SECURE_NO_DEPRECATE 1
00085
00086 #include "intrin.h"
00087
00088 typedef unsigned __int8 uint8_t;
00089 typedef __int8 int8_t;
00090 typedef unsigned __int16 uint16_t;
00091 typedef __int16 int16_t;
00092 typedef unsigned __int32 uint32_t;
00093 typedef __int32 int32_t;
00094 typedef unsigned __int64 uint64_t;
00095 typedef __int64 int64_t;
00096 typedef int mode_t;
00097 typedef uint16_t gid_t;
00098 typedef uint16_t uid_t;
00099
00100 #define snprintf _snprintf
00101 #define strcasecmp(string1, string2) _strnicmp(string1, string2, strlen(string1))
00102
00103 #define roundup(x, y) \
00104 ( ( ((x)+((y) - 1)) / (y)) * (y) )
00105
00106 #endif
00107
00108
00109
00110
00111
00112
00113
00114
00115 #ifdef TSK_WIN32
00116
00117
00118 typedef TCHAR TSK_TCHAR;
00119 #define _TSK_T _T
00120
00121 #define TSTAT _tstat
00122 #define STAT_STR _stat64i32
00123 #define TSTRTOK _tcstok
00124 #define TSTRLEN _tcslen
00125 #define TSTRCMP _tcscmp
00126 #define TSTRNCPY _tcsncpy
00127 #define TSTRNCAT _tcsncat
00128 #define TSTRCHR _tcschr
00129 #define TSTRTOUL _tcstoul
00130 #define TSTRTOULL _tcstoui64
00131 #define TATOI _tstoi
00132 #define TFPRINTF fwprintf
00133 #define TSNPRINTF _snwprintf
00134 #define PUTENV _wputenv
00135 #define TZSET _tzset
00136
00137 #define PRIcTSK _TSK_T("S")
00138 #define PRIwTSK _TSK_T("s")
00139
00140 #define PRIttocTSK "S"
00141
00142 #define unlink _unlink
00143 #define MAIN _tmain
00144 #define fseeko _fseeki64
00145
00146 #define strtok_r(a,b,c) strtok(a,b)
00147
00148 #else
00149
00150
00151 typedef char TSK_TCHAR;
00152 #define _TSK_T(x) x
00153
00154 #define TSTAT stat
00155 #define STAT_STR stat
00156 #define TSTRTOK strtok
00157 #define TSTRLEN strlen
00158 #define TSTRCMP strcmp
00159 #define TSTRNCPY strncpy
00160 #define TSTRNCAT strncat
00161 #define TSTRCHR strchr
00162 #define TSTRTOUL strtoul
00163 #define TSTRTOULL strtoull
00164 #define TATOI atoi
00165 #define TFPRINTF fprintf
00166 #define TSNPRINTF snprintf
00167
00168 #define PUTENV putenv
00169 #define TZSET tzset
00170
00171 #define PRIcTSK _TSK_T("s")
00172 #define PRIwTSK _TSK_T("S")
00173
00174 #define PRIttocTSK "s"
00175
00176 #define MAIN main
00177
00178 #endif
00179
00180
00181
00182
00183 #ifndef SUPPORTED
00184 #error "This operating system is not supported"
00185 #endif
00186
00187 #endif