add some missing copyrights and tags
[xxxterm.git] / linux / util.h
blobc3bcc39b9ff4e9784ea88cecbd90ceeb1b3df319
1 /* $xxxterm$ */
2 /*
3 * Copyright (c) 2010 Marco Peereboom <marco@peereboom.us>
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #define FPARSELN_UNESCESC 0x01
19 #define FPARSELN_UNESCCONT 0x02
20 #define FPARSELN_UNESCCOMM 0x04
21 #define FPARSELN_UNESCREST 0x08
22 #define FPARSELN_UNESCALL 0x0f
24 size_t strlcpy(char *, const char *, size_t);
25 size_t strlcat(char *, const char *, size_t);
27 char *fgetln(FILE *, size_t *);
28 char *fparseln(FILE *, size_t *, size_t *, const char [3], int);
30 long long strtonum(const char *, long long, long long, const char **);
32 int fmt_scaled(long long number, char *result);
34 #ifndef WAIT_ANY
35 #define WAIT_ANY (-1)
36 #endif
38 /* there is no limit to ulrich drepper's crap */
39 #ifndef TAILQ_END
40 #define TAILQ_END(head) NULL
41 #endif
44 * fmt_scaled(3) specific flags. (from OpenBSD util.h)
46 #define FMT_SCALED_STRSIZE 7 /* minus sign, 4 digits, suffix, null byte */
48 int getpeereid(int s, uid_t *euid, gid_t *gid);