?RCS: $Id: d_gethname.U 1 2006-08-24 12:32:52Z rmanfredi $ ?RCS: ?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 4.0. ?RCS: ?RCS: $Log: d_gethname.U,v $ ?RCS: Revision 3.0.1.1 1994/10/29 16:13:00 ram ?RCS: patch36: call ./xenix explicitely instead of relying on PATH ?RCS: ?RCS: Revision 3.0 1993/08/18 12:06:11 ram ?RCS: Baseline for dist 3.0 netwide release. ?RCS: ?MAKE:d_gethname d_uname d_phostname aphostname: phostname cat \ myhostname package d_portable Loc echo n c +i_whoami +usrinc \ Myread Guess Oldconfig Csym ?MAKE: -pick add $@ %< ?S:d_gethname: ?S: This variable conditionally defines the HAS_GETHOSTNAME symbol, which ?S: indicates to the C program that the gethostname() routine may be ?S: used to derive the host name. ?S:. ?S:d_uname: ?S: This variable conditionally defines the HAS_UNAME symbol, which ?S: indicates to the C program that the uname() routine may be ?S: used to derive the host name. ?S:. ?S:d_phostname: ?S: This variable conditionally defines the PHOSTNAME symbol, which ?S: contains the shell command which, when fed to popen(), may be ?S: used to derive the host name. ?S:. ?S:aphostname: ?S: Thie variable contains the command which can be used to compute the ?S: host name. The command is fully qualified by its absolute path, to make ?S: it safe when used by a process with super-user privileges. ?S:. ?C:HAS_GETHOSTNAME (GETHOSTNAME): ?C: This symbol, if defined, indicates that the C program may use the ?C: gethostname() routine to derive the host name. See also HAS_UNAME ?C: and PHOSTNAME. ?C:. ?C:HAS_UNAME (UNAME): ?C: This symbol, if defined, indicates that the C program may use the ?C: uname() routine to derive the host name. See also HAS_GETHOSTNAME ?C: and PHOSTNAME. ?C:. ?C:PHOSTNAME: ?C: This symbol, if defined, indicates that the C program may use the ?C: contents of PHOSTNAME as a command to feed to the popen() routine ?C: to derive the host name. See also HAS_GETHOSTNAME and HAS_UNAME. ?C: Note that the command uses a fully qualified path, so that it is safe ?C: even if used by a process with super-user privileges. ?C:. ?H:#$d_gethname HAS_GETHOSTNAME /**/ ?H:#$d_uname HAS_UNAME /**/ ?H:#$d_phostname PHOSTNAME "$aphostname" /* How to get the host name */ ?H:. ?T:file val call ?LINT:change i_whoami : see how we will look up host name echo " " if false; then : dummy stub to allow use of elif @if HAS_GETHOSTNAME elif set gethostname val -f d_gethname; eval $csym; $val; then echo 'gethostname() found.' >&4 d_gethname="$define" call=gethostname @end @if HAS_UNAME elif set uname val -f d_uname; eval $csym; $val; then if ./xenix; then $cat <<'EOM' uname() was found, but you're running xenix, and older versions of xenix have a broken uname(). If you don't really know whether your xenix is old enough to have a broken system call, use the default answer. EOM dflt=y case "$d_uname" in "$define") dflt=n;; esac rp='Is your uname() broken?' . ./myread case "$ans" in n*) d_uname="$define"; call=uname;; esac else echo 'uname() found.' >&4 d_uname="$define" call=uname fi @end fi case "$d_gethname" in '') d_gethname="$undef";; esac case "$d_uname" in '') d_uname="$undef";; esac @if PHOSTNAME || MYHOSTNAME case "$d_uname$d_gethname" in *define*) dflt=n cat <&4;; @ end esac;; esac @elsif PHOSTNAME case "$d_uname$d_gethname" in *define*) ;; *) case "$phostname" in '') @ if WHOAMI case "$i_whoami" in "$define") $cat <&4;; esac;; @ else echo "There will be no way for $package to get your hostname." >&4;; @ end *) echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4 ;; esac;; esac @elsif MYHOSTNAME case "$d_uname$d_gethname" in *define*) ;; *) @ if WHOAMI case "$i_whoami" in "$define") dflt=y $cat <&4;; esac;; @ else echo 'Hardwiring "'$myhostname'".' >&4;; @ end esac @end case "$d_phostname" in '') d_phostname="$undef";; esac