Debian Codegraph @

compat/compat.h

raw symbols SCIP
1 /*
2 * Copyright 2017 Red Hat Inc., Durham, North Carolina.
3 * All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * Authors:
20 * Jan Černý <[email protected]>
21 */
22
23 #ifndef OSCAP_COMPAT_H_
24 #define OSCAP_COMPAT_H_
25
26 #include "oscap_export.h"
27 #include "oscap_platforms.h"
28
29 /* Fallback functions fixing portability issues */
30
31 #ifndef HAVE_STRSEP
32 char *strsep(char **stringp, const char *delim);
33 #endif
34
35 #ifndef HAVE_STRPTIME
36 #include <time.h>
37 char *strptime(const char *buf, const char *format, struct tm *tm);
38 #endif
39
40 #if defined(unix) || defined(__unix__) || defined(__unix)
41 #define OSCAP_UNIX
42 #endif
43
44 #ifdef OS_WINDOWS
45 #define PATH_MAX _MAX_PATH
46 #endif
47
48 #ifdef _MSC_VER
49 #include <BaseTsd.h>
50 typedef SSIZE_T ssize_t;
51 #define __PRETTY_FUNCTION__ __FUNCTION__
52 #define __attribute__(x)
53
54 /* Definitions for access() */
55 #define F_OK 0
56 #define W_OK 2
57 #define R_OK 4
58
59 #endif
60
61 #if !defined(HAVE_DEV_TO_TTY) && !defined(OS_WINDOWS)
62 #include <sys/types.h>
63 #define ABBREV_DEV 1 /* remove /dev/ */
64 #define ABBREV_TTY 2 /* remove tty */
65 #define ABBREV_PTS 4 /* remove pts/ */
66
67 extern unsigned dev_to_tty(char *__restrict ret, unsigned chop, dev_t dev_t_dev, int pid, unsigned int flags);
68 #endif
69
70 #endif