91 stralloc ip6address = {0};
102 if (!stralloc_cats(&
key,
"@"))
nomem();
106 if (!stralloc_catb(&
key,ip6address.s,ip6address.len))
nomem();
125 case 0:
if (!stralloc_copys(&
key,
"_"))
nomem();
134 left = byte_rchr(
address.s,i,
'.');
135 if (left == i) left = 0;
else ++left;
142 if (top > 255) top = 255;
145 if (!stralloc_catb(&
key,strnum,fmt_ulong(strnum,bot)))
nomem();
161 case 0:
if (!stralloc_copys(&
key,
"^"))
nomem();
174 case 0:
if (cdb_make_add(&c,ip6address.s,ip6address.len,
data.s,
data.len) == -1)
188int main(
int argc,
char *
const *argv) {
203 logmsg(
WHO,111,ERROR,B(
"unable to create: ",
fntemp));
204 if (cdb_make_start(&c,fd) == -1)
die_write();
207 if (getln(buffer_0,&
line,&
match,
'\n') == -1)
208 logmsg(
WHO,111,FATAL,
"unable to read input");
214 if (x[0] ==
'#')
continue;
215 if (x[0] ==
'\n')
continue;
219 if (ch !=
'\n')
if (ch !=
' ')
if (ch !=
'\t')
break;
226 i = byte_chr(x,len,
',');
227 colon = byte_rchr(x,i,
':');
229 if (colon == len)
continue;
234 x += colon + 1; len -= colon + 1;
236 if ((len >= 4) && byte_equal(x,4,
"deny")) {
237 if (!stralloc_catb(&
data,
"D",2))
nomem();
240 else if ((len >= 5) && byte_equal(x,5,
"allow")) {
248 case ',': i = byte_chr(x,len,
'=');
250 if (!stralloc_catb(&
data,
"+",1))
nomem();
251 if (!stralloc_catb(&
data,x + 1,i))
nomem();
252 x += i + 1; len -= i + 1;
256 i = byte_chr(x,len,ch);
260 x += i + 1; len -= i + 1;
268 if (cdb_make_finish(&c) == -1)
die_write();
272 logmsg(
WHO,111,ERROR,B(
"unable to move ",
fntemp,
" to: ",
fn));