aboutsummaryrefslogtreecommitdiffstats
path: root/util.h
blob: 507324af8c32f24a2cce78c79c50de80db2a4958 (plain) (blame)
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
/* See LICENSE file for copyright and license details. */
#undef MIN
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define LEN(x) (sizeof(x) / sizeof(*(x)))
#define NR_ARGS	32

#undef dprintf
int dprintf(int, const char *, ...);
#undef strlcat
size_t strlcat(char *, const char *, size_t);
#undef strlcpy
size_t strlcpy(char *, const char *, size_t);
int strverscmp(const char *, const char *);
int spawnvp(char *, char *, char *[]);
int spawnlp(char *, char *, char *, ...);

#ifdef DEBUG
#define DEBUG_FD 8
#define DPRINTF_D(x) dprintf(DEBUG_FD, #x "=%d\n", x)
#define DPRINTF_U(x) dprintf(DEBUG_FD, #x "=%u\n", x)
#define DPRINTF_S(x) dprintf(DEBUG_FD, #x "=%s\n", x)
#define DPRINTF_P(x) dprintf(DEBUG_FD, #x "=0x%p\n", x)
#define DPRINTF_LLU(x) dprintf(DEBUG_FD, #x "=%llu\n", x)
#else
#define DPRINTF_D(x)
#define DPRINTF_U(x)
#define DPRINTF_S(x)
#define DPRINTF_P(x)
#define DPRINTF_LLU(x)
#endif /* DEBUG */
Un proyecto texto-plano.xyz