2 * Copyright (c) 2010 Marco Peereboom <marco@peereboom.us>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #define FPARSELN_UNESCESC 0x01
18 #define FPARSELN_UNESCCONT 0x02
19 #define FPARSELN_UNESCCOMM 0x04
20 #define FPARSELN_UNESCREST 0x08
21 #define FPARSELN_UNESCALL 0x0f
23 #if !__has_builtin(strlcpy)
24 size_t strlcpy(char *, const char *, size_t);
26 #if !__has_builtin(strlcat)
27 size_t strlcat(char *, const char *, size_t);
30 char *fgetln(FILE *, size_t *);
31 char *fparseln(FILE *, size_t *, size_t *, const char [3], int);
33 long long strtonum(const char *, long long, long long, const char **);
35 int fmt_scaled(long long number
, char *result
);
41 /* there is no limit to ulrich drepper's crap */
43 #define TAILQ_END(head) NULL
46 #ifndef TAILQ_FOREACH_SAFE
47 #define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
48 for ((var) = TAILQ_FIRST(head); \
49 (var) != TAILQ_END(head) && \
50 ((tvar) = TAILQ_NEXT(var, field), 1); \
55 * fmt_scaled(3) specific flags. (from OpenBSD util.h)
57 #define FMT_SCALED_STRSIZE 7 /* minus sign, 4 digits, suffix, null byte */
59 int getpeereid(int s
, uid_t
*euid
, gid_t
*gid
);