Mirror of git://git.busybox.net/busybox with our patches on top
Source
while (i < server_config.max_leases && (fread(&lease, sizeof lease, 1, fp) == 1)) {
/*
* files.c -- DHCP server file manipulation *
* Rewrite by Russ Dill <Russ.Dill@asu.edu> July 2001
*/
/*
* Domain names may have 254 chars, and string options can be 254
* chars long. However, 80 bytes will be enough for most, and won't
* hog up memory. If you have a special application, change it
*/
/* on these functions, make sure you datatype matches */
static int read_ip(const char *line, void *arg)
{
struct in_addr *addr = arg;
struct hostent *host;
int retval = 1;
if (!inet_aton(line, addr)) {
if ((host = gethostbyname(line)))
addr->s_addr = *((unsigned long *) host->h_addr_list[0]);
else retval = 0;
}
return retval;
}
static int read_str(const char *line, void *arg)
{
char **dest = arg;
if (*dest) free(*dest);
*dest = strdup(line);
return 1;
}
static int read_u32(const char *line, void *arg)
{
uint32_t *dest = arg;
char *endptr;
*dest = strtoul(line, &endptr, 0);
return endptr[0] == '\0';
}
static int read_yn(const char *line, void *arg)
{