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