blob: 8801b5381988b1008d76cdacf3afaae6419145ca (
plain)
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
|
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <xf86.h>
#include <xf86Opt.h>
#include "qxl_option_helpers.h"
int get_int_option(OptionInfoPtr options, int option_index,
const char *env_name)
{
if (env_name && getenv(env_name)) {
return atoi(getenv(env_name));
}
return options[option_index].value.num;
}
const char *get_str_option(OptionInfoPtr options, int option_index,
const char *env_name)
{
if (getenv(env_name)) {
return getenv(env_name);
}
return options[option_index].value.str;
}
int get_bool_option(OptionInfoPtr options, int option_index,
const char *env_name)
{
if (getenv(env_name)) {
/* we don't support the whole range of boolean true and
* false values documented in man xorg.conf, just the c
* convention - 0 is false, anything else is true, so
* just like a number. */
return !!atoi(getenv(env_name));
}
return options[option_index].value.bool;
}
|