9 static stralloc data = {0};
11 static int init(stralloc *rules)
22 if (!x) x =
"/etc/dnsrewrite";
25 if (i == -1)
return -1;
30 for (j = 0;j < data.len;++j)
31 if (data.s[j] ==
'\n') {
34 if (rules->s[rules->len - 1] !=
' ')
35 if (rules->s[rules->len - 1] !=
'\t')
36 if (rules->s[rules->len - 1] !=
'\r')
52 for (j = 0;j < data.len;++j)
53 if (data.s[j] ==
' ') {
65 if (i == -1)
return -1;
70 for (j = 0;j < data.len;++j)
71 if (data.s[j] ==
'\n') {
78 if (!k) { ++i;
continue; }
93 if (gethostname(host,
sizeof host) == -1)
return -1;
94 host[(
sizeof host) - 1] = 0;
108 static unsigned int uses;
109 static struct taia deadline;
110 static stralloc rules = {0};
121 if (init(&rules) == -1)
return -1;
int stralloc_copy(stralloc *, const stralloc *)
int stralloc_cats(stralloc *, const char *)
int dns_resolvconfrewrite(stralloc *out)
int openreadclose(const char *fn, stralloc *sa, unsigned int bufsize)
int stralloc_append(stralloc *, const char *)
int taia_now(struct taia *)
int taia_less(const struct taia *, const struct taia *)
unsigned int str_chr(const char *, int)
void taia_add(struct taia *, const struct taia *, const struct taia *)
unsigned int byte_chr(const char *, unsigned int n, int)
void taia_uint(struct taia *, unsigned int)
char * env_get(const char *s)
int stralloc_catb(stralloc *, const char *, unsigned int)
int stralloc_copys(stralloc *, const char *)
#define byte_equal(s, n, t)