#!/bin/sh
# $Id: getns.sh,v 1.4 2006/11/29 05:51:44 ca Exp $
# Copyright (c) 2005, 2006 Sendmail, Inc. and its suppliers.
# All rights reserved.
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
# ----------------------------------------
# set NS (nameserver) variable for test programs
# ----------------------------------------
# get nameserver
if test X"${MTA_NAMESERVER}" != "X"
then
NS=${MTA_NAMESERVER}
else
NS=`grep '^nameserver' /etc/resolv.conf | head -n1 | sed -e 's/nameserver[ ]*\([0-9][0-9\.]*\).*$/\1/'`
if test X"${NS}" = "X"
then
echo "$0: ERROR: no nameserver found in /etc/resolv.conf"
fi
fi
syntax highlighted by Code2HTML, v. 0.9.1