release
[hcoop/zz_old/debian/djbdns.git] / okclient.c
CommitLineData
dc0d77d7
CE
1#include <sys/types.h>
2#include <sys/stat.h>
3#include "str.h"
4#include "ip4.h"
5#include "okclient.h"
6
7static char fn[3 + IP4_FMT];
8
9int okclient(char ip[4])
10{
11 struct stat st;
12 int i;
13
14 fn[0] = 'i';
15 fn[1] = 'p';
16 fn[2] = '/';
17 fn[3 + ip4_fmt(fn + 3,ip)] = 0;
18
19 for (;;) {
20 if (stat(fn,&st) == 0) return 1;
21 /* treat temporary error as rejection */
22 i = str_rchr(fn,'.');
23 if (!fn[i]) return 0;
24 fn[i] = 0;
25 }
26}