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
71
72
73
74
75
76
77
|
/*
* Compile-time options
*/
#include "ctwm.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ctopts.h"
/*
* What options we're build with
*/
static char *ctopts[] = {
"I18N", // Used to be optional, now standard. Remove?
#ifdef XPM
"XPM",
#endif
#ifdef JPEG
"JPEG",
#endif
#ifdef USEM4
"USEM4",
#endif
#ifdef SOUNDS
"SOUNDS",
#endif
#ifdef EWMH
"EWMH",
#endif
#ifdef XRANDR
"XRANDR",
#endif
#ifdef DEBUG
"DEBUG",
#endif
NULL
};
/*
* Build a string of our compile-time opts
*/
char *
ctopts_string(char *sep)
{
char *cto;
size_t slen, tlen;
int i;
/* Figure out how long our string would be */
slen = strlen(sep);
tlen = 0;
i = -1;
while(ctopts[++i]) {
tlen += strlen(ctopts[i]);
if(i > 0) {
tlen += slen;
}
}
/* Now make it */
cto = malloc(tlen + 1);
*cto = '\0';
i = -1;
while(ctopts[++i]) {
if(i > 0) {
strcat(cto, sep);
}
strcat(cto, ctopts[i]);
}
return cto;
}
|