/*-
* Copyright (c) 1994, Garrett Wollman
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#endif /* LIBC_SCCS and not lint */
#include <netdb.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <paths.h>
#include <string.h>
#include "Socklib_internals.h"
enum service_type {
SERVICE_NONE = 0,
SERVICE_NIS };
static struct {
const char *name;
} service_names[] = {
{ "hosts", SERVICE_TABLE },
{ _PATH_HOSTS, SERVICE_TABLE },
{ "hosttable", SERVICE_TABLE },
{ "htable", SERVICE_TABLE },
{ "bind", SERVICE_BIND },
{ "dns", SERVICE_BIND },
{ "domain", SERVICE_BIND },
{ "yp", SERVICE_NIS },
{ "yellowpages", SERVICE_NIS },
{ "nis", SERVICE_NIS },
{ 0, SERVICE_NONE }
};
static int service_done = 0;
static enum service_type
int i;
return service_names[i].type;
}
}
return SERVICE_NONE;
}
static void
{
register int cc = 0;
/* make some assumptions */
service_order[0] = SERVICE_TABLE;
} else {
if(buf[0] == '#')
continue;
p = buf;
;
continue;
do {
cc++;
}
;
}
}
service_done = 1;
}
struct netent *
{
int nserv = 0;
if (!service_done)
while (!hp) {
switch (service_order[nserv]) {
case SERVICE_NONE:
return NULL;
case SERVICE_TABLE:
break;
case SERVICE_BIND:
break;
case SERVICE_NIS:
break;
}
nserv++;
}
return hp;
}
struct netent *
{
int nserv = 0;
if (!service_done)
while (!hp) {
switch (service_order[nserv]) {
case SERVICE_NONE:
return 0;
case SERVICE_TABLE:
break;
case SERVICE_BIND:
break;
case SERVICE_NIS:
break;
}
nserv++;
}
return hp;
}
void
{
}
void
{
_endnethtent();
}