/*
* Copyright (C) 1995-2001 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*/
#if !defined(lint)
#endif
#include <ctype.h>
#include "ipf.h"
#include "ipt.h"
extern int opts;
static int hex_readip __P((char *, int, char **, int *));
char *fname;
{
return tfd;
}
tfd = 0;
} else {
if (tfd != -1)
}
return tfd;
}
static int hex_close()
{
tfd = -1;
}
{
register char *s, *t, *u;
/*
* interpret start of line as possibly "[ifname]" or
*/
if (ifn)
if (dir)
*dir = 0;
if (s == line)
*s = '\0';
}
*s = '\0';
if (!*line)
continue;
}
t = line + 1;
if (s - t > 0) {
*s++ = '\0';
if ((u = strchr(t, ',')) && (u < s)) {
u++;
if (ifn)
if (dir) {
if (*t == 'i')
*dir = 0;
else if (*t == 'o')
*dir = 1;
}
} else if (ifn)
*ifn = t;
}
} else
s = line;
t = (char *)ip;
if (t < (char *)ip)
putchar('\t');
while (t < (char *)ip) {
putchar(*t);
else
putchar('.');
t++;
}
}
putchar('\n');
}
}
return -1;
}
{
int state = 0;
char c;
while ((c = *src++)) {
if (ISSPACE(c)) {
if (state) {
dst++;
state = 0;
}
continue;
} else if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
(c >= 'A' && c <= 'F')) {
if (state == 0) {
*dst = (c << 4);
state++;
} else {
*dst++ |= c;
state = 0;
}
} else
break;
}
return dst;
}