File size: 934 Bytes
8df6da4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
/*
 * errata functions
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Library General Public License version 2.
 */
#ifndef _ERRATA_H_
#define _ERRATA_H_

#define _ERRATA(erratum) errata("ERRATA_" # erratum)
#define ERRATA(erratum) _ERRATA(erratum)

#define _ERRATA_RELAXED(erratum) errata_relaxed("ERRATA_" # erratum)
#define ERRATA_RELAXED(erratum) _ERRATA_RELAXED(erratum)

static inline bool errata_force(void)
{
	char *s = getenv("ERRATA_FORCE");

	return s && (*s == '1' || *s == 'y' || *s == 'Y');
}

static inline bool errata(const char *erratum)
{
	char *s;

	if (errata_force())
		return true;

	s = getenv(erratum);

	return s && (*s == '1' || *s == 'y' || *s == 'Y');
}

static inline bool errata_relaxed(const char *erratum)
{
	char *s;

	if (errata_force())
		return true;

	s = getenv(erratum);

	return !(s && (*s == '0' || *s == 'n' || *s == 'N'));
}

#endif