added "open search in new tab" (using C-Enter on search) per
[xombrero.git] / osx / util.h
blob50d98ff39aed60e11cfc21b24ff0eaece6f6d22a
1 /*
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);
25 #endif
26 #if !__has_builtin(strlcat)
27 size_t strlcat(char *, const char *, size_t);
28 #endif
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);
37 #ifndef WAIT_ANY
38 #define WAIT_ANY (-1)
39 #endif
41 /* there is no limit to ulrich drepper's crap */
42 #ifndef TAILQ_END
43 #define TAILQ_END(head) NULL
44 #endif
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); \
51 (var) = (tvar))
52 #endif
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);