Remove building with NOCRYPTO option
[minix.git] / external / bsd / bind / dist / contrib / idn / idnkit-1.0-src / tools / idnconv / idnslookup.in
blob968647cfdc18101add475bddc29001159fa009d1
1 #! /bin/sh
2 # Id: idnslookup.in,v 1.1 2003/06/04 00:27:10 marka Exp
4 # Copyright (c) 2000 Japan Network Information Center. All rights reserved.
5 #
6 # By using this file, you agree to the terms and conditions set forth bellow.
7 #
8 # LICENSE TERMS AND CONDITIONS
9 #
10 # The following License Terms and Conditions apply, unless a different
11 # license is obtained from Japan Network Information Center ("JPNIC"),
12 # a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
13 # Chiyoda-ku, Tokyo 101-0047, Japan.
15 # 1. Use, Modification and Redistribution (including distribution of any
16 # modified or derived work) in source and/or binary forms is permitted
17 # under this License Terms and Conditions.
19 # 2. Redistribution of source code must retain the copyright notices as they
20 # appear in each source code file, this License Terms and Conditions.
22 # 3. Redistribution in binary form must reproduce the Copyright Notice,
23 # this License Terms and Conditions, in the documentation and/or other
24 # materials provided with the distribution. For the purposes of binary
25 # distribution the "Copyright Notice" refers to the following language:
26 # "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
28 # 4. The name of JPNIC may not be used to endorse or promote products
29 # derived from this Software without specific prior written approval of
30 # JPNIC.
32 # 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
33 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
35 # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
36 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
37 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
39 # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
41 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
42 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
44 USAGE="Usage: $0 domain-name DNS-server"
47 # Parse command line arguments.
49 if [ $# -lt 2 ] ; then
50 echo "$0: too few argument" 1>&2
51 echo $USAGE 1>&2
52 exit 1
55 if [ $# -gt 2 ] ; then
56 echo "$0: too many argument" 1>&2
57 echo $USAGE 1>&2
58 exit 1
61 case "$1" in
62 -*) echo "$0: unknown option $1" 1>&2
63 echo $USAGE 1>&2
64 exit 1
66 esac
68 LOCAL_DOMAIN_NAME="$1"
69 NAME_SERVER="$2"
72 # Append some directories to PATH.
74 [ -d /usr/sbin ] && PATH=$PATH:/usr/sbin
75 [ -d /sbin ] && PATH=$PATH:/sbin
78 # Find `nslookup' command.
80 if [ x"$NSLOOKUP" = x ] ; then
81 for I in `echo $PATH | sed -e 's/:/ /g'` ; do
82 if [ -x $I/nslookup ] ; then
83 NSLOOKUP="$I/nslookup"
84 break
86 done
87 if [ "$NSLOOKUP" = "" ] ; then
88 echo "$0: nslookup not found" 1>&2
89 exit 1
92 if [ ! -x "$NSLOOKUP" ] ; then
93 echo "$0: nslookup not found" 1>&2
94 exit 1
98 # Check if `idnconv' command exists.
100 IDNCONV=${IDNCONV-"@bindir@/idnconv"}
101 if [ ! -x "$IDNCONV" ] ; then
102 echo "$0: idnconv not found" 1>&2
103 exit 1
107 # Convert domain name to IDN encoding.
109 IDN_DOMAIN_NAME="`echo $LOCAL_DOMAIN_NAME | $IDNCONV -w`" || exit 1
112 # Invoke nslookup.
114 $NSLOOKUP $IDN_DOMAIN_NAME $NAME_SERVER < /dev/null || exit 1
116 exit 0