summaryrefslogtreecommitdiff
path: root/mcon/U/myhostname.U
diff options
context:
space:
mode:
Diffstat (limited to 'mcon/U/myhostname.U')
-rw-r--r--mcon/U/myhostname.U33
1 files changed, 25 insertions, 8 deletions
diff --git a/mcon/U/myhostname.U b/mcon/U/myhostname.U
index 4edb7b3..3e33f70 100644
--- a/mcon/U/myhostname.U
+++ b/mcon/U/myhostname.U
@@ -1,12 +1,12 @@
-?RCS: $Id: myhostname.U,v 3.0.1.3 1997/02/28 16:15:55 ram Exp $
+?RCS: $Id$
?RCS:
-?RCS: Copyright (c) 1991-1993, Raphael Manfredi
+?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS:
?RCS: You may redistribute only under the terms of the Artistic Licence,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic Licence; a copy of which may be found at the root
-?RCS: of the source tree for dist 3.0.
+?RCS: of the source tree for dist 4.0.
?RCS:
?RCS: $Log: myhostname.U,v $
?RCS: Revision 3.0.1.3 1997/02/28 16:15:55 ram
@@ -23,7 +23,7 @@
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?MAKE:myhostname phostname mydomain: contains sed test Myread Oldconfig \
- Guess Loc awk echo sort uniq +usrinc rm hostcat Tr
+ Guess Loc awk echo sort uniq +usrinc rm hostcat Tr osname
?MAKE: -pick add $@ %<
?S:myhostname (hostname):
?S: This variable contains the eventual value of the MYHOSTNAME symbol,
@@ -60,7 +60,7 @@
?H:#define MYHOSTNAME "$myhostname" /**/
?H:#define MYDOMAIN "$mydomain" /**/
?H:.
-?T:cont i tans tmp_re
+?T:cont i tans tmp_re file
: now get the host name
echo " "
echo "Figuring out host name..." >&4
@@ -115,6 +115,9 @@ if $test "$cont"; then
fi
fi
fi
+case "$myhostname" in
+'') myhostname=noname ;;
+esac
: you do not want to know about this
set $myhostname
myhostname=$1
@@ -178,14 +181,21 @@ case "$myhostname" in
tmp_re="[ . ]"
$test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
END { print sum }" hosts` = x1 || tmp_re="[ ]"
- dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
+ dflt=.`$awk \
+ "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
hosts | $sort | $uniq | \
$sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
case `$echo X$dflt` in
X*\ *) echo "(Several hosts in /etc/hosts matched hostname)"
dflt=.
;;
- X.) echo "(You do not have fully-qualified names in /etc/hosts)"
+?X: There is no /etc/hosts on os390
+ X.)
+ if $test -f /etc/hosts; then
+ echo "(You do not have fully-qualified names in /etc/hosts)"
+ else
+ echo "(I cannot locate a hosts database anywhere)"
+ fi
;;
esac
case "$dflt" in
@@ -215,9 +225,16 @@ case "$myhostname" in
esac
;;
esac
+ case "$dflt$osname" in
+ .os390)
+ file="//'SYS1.TCPPARMS(TCPDATA)'"
+ echo "(Attempting domain name extraction from $file)"
+ dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "$file" 2>/dev/null`
+ ;;
+ esac
case "$dflt" in
.) echo "(Lost all hope -- silly guess then)"
- dflt='.uucp'
+ dflt='.nonet'
;;
esac
$rm -f hosts