2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 2N/A/* All Rights Reserved */ 2N/A * University Copyright- Copyright (c) 1982, 1986, 1988 2N/A * The Regents of the University of California 2N/A * All Rights Reserved 2N/A * University Acknowledgment- Portions of this document are derived from 2N/A * software developed by the University of California, Berkeley, and its 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * Resolver state default settings 2N/A 4,
/* number of times to retransmit */ 2N/A 1,
/* number of name servers */ 2N/A * Set up default settings. If the configuration file exist, the values 2N/A * there will have precedence. Otherwise, the server address is set to 2N/A * INADDR_LOOPBACK and the default domain name comes from the gethostname(). 2N/A * BUT if the NIS/RPC domain name is set, that is used if all else fails. 2N/A * The configuration file should only be used if you want to redefine your 2N/A * domain or run without a server on your machine. 2N/A * Note the user can always override then domain name with the environment 2N/A * variable LOCALDOMAIN which has absolute priority. 2N/A * Return 0 if completes successfully, -1 on error 2N/A int nserv = 0;
/* number of nameserver records read from file */ 2N/A /* we are looking for a non-loopback interface */ 2N/A if (
int_up == 0)
/* all the non-LOOPBACK interfaces are DOWN */ 2N/A#
endif /* SIOCGIFNUM */ 2N/A * for the benefit of hidden NIS domains, we use the same procedure 2N/A * as sendmail: convert leading + to dot, then drop to first dot 2N/A /* Allow user to override the local domain definition */ 2N/A /* read the config file */ 2N/A /* read default domain name */ 2N/A if ((*
cp ==
'\0') || (*
cp ==
'\n'))
2N/A /* set search list */ 2N/A if ((*
cp ==
'\0') || (*
cp ==
'\n'))
2N/A * Set search list to be blank-separated strings 2N/A /* null terminate last domain if there are excess */ 2N/A while (*
cp !=
'\0' && *
cp !=
' ' && *
cp !=
'\t')
2N/A /* read nameservers to query */ 2N/A if ((*
cp ==
'\0') || (*
cp ==
'\n'))
2N/A /* find components of local domain that might be searched */