|
|
31f9af |
diff -up hostname/hostname.1.rh hostname/hostname.1
|
|
|
31f9af |
--- hostname/hostname.1.rh 2012-12-06 16:18:46.000000000 +0100
|
|
|
31f9af |
+++ hostname/hostname.1 2013-03-26 12:39:24.303468313 +0100
|
|
|
31f9af |
@@ -84,6 +84,28 @@ complete FQDN of the system is returned
|
|
|
31f9af |
.B "THE FQDN"
|
|
|
31f9af |
below).
|
|
|
31f9af |
|
|
|
31f9af |
+.LP
|
|
|
31f9af |
+The function
|
|
|
31f9af |
+.BR gethostname(2)
|
|
|
31f9af |
+is used to get the hostname. When the
|
|
|
31f9af |
+.BR "hostname \-a, \-d, \-f or \-i"
|
|
|
31f9af |
+is called will
|
|
|
31f9af |
+.BR gethostbyname(3)
|
|
|
31f9af |
+be called. The difference in
|
|
|
31f9af |
+.BR gethostname(2)
|
|
|
31f9af |
+and
|
|
|
31f9af |
+.BR gethostbyname(3)
|
|
|
31f9af |
+is that
|
|
|
31f9af |
+.BR gethostbyname(3)
|
|
|
31f9af |
+is network aware, so it consults
|
|
|
31f9af |
+.IR /etc/nsswitch.conf
|
|
|
31f9af |
+and
|
|
|
31f9af |
+.IR /etc/host.conf
|
|
|
31f9af |
+to decide whether to read information in
|
|
|
31f9af |
+.IR /etc/hostname
|
|
|
31f9af |
+or
|
|
|
31f9af |
+.IR /etc/hosts
|
|
|
31f9af |
+
|
|
|
31f9af |
.SS "SET NAME"
|
|
|
31f9af |
When called with one argument or with the
|
|
|
31f9af |
.B \-\-file
|
|
|
31f9af |
@@ -109,8 +131,7 @@ command (see
|
|
|
31f9af |
.B "THE FQDN"
|
|
|
31f9af |
below).
|
|
|
31f9af |
.LP
|
|
|
31f9af |
-The host name is usually set once at system startup in
|
|
|
31f9af |
-.I /etc/init.d/hostname.sh
|
|
|
31f9af |
+The host name is usually set once at system startup
|
|
|
31f9af |
(normally by reading the contents of a file which contains
|
|
|
31f9af |
the host name, e.g.
|
|
|
31f9af |
.IR /etc/hostname ).
|
|
|
31f9af |
diff -up hostname/Makefile.rh hostname/Makefile
|
|
|
31f9af |
--- hostname/Makefile.rh 2012-02-16 16:00:52.000000000 +0100
|
|
|
31f9af |
+++ hostname/Makefile 2013-03-26 12:39:24.303468313 +0100
|
|
|
31f9af |
@@ -3,30 +3,29 @@ CFLAGS+=-O2 -Wall
|
|
|
31f9af |
# uncomment the following line if you want to install to a different base dir.
|
|
|
31f9af |
#BASEDIR=/mnt/test
|
|
|
31f9af |
|
|
|
31f9af |
+BINDIR:=/bin
|
|
|
31f9af |
+
|
|
|
31f9af |
OBJS=hostname.o
|
|
|
31f9af |
|
|
|
31f9af |
hostname: $(OBJS)
|
|
|
31f9af |
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) -lnsl
|
|
|
31f9af |
- ln -fs hostname dnsdomainname
|
|
|
31f9af |
- ln -fs hostname domainname
|
|
|
31f9af |
- ln -fs hostname ypdomainname
|
|
|
31f9af |
- ln -fs hostname nisdomainname
|
|
|
31f9af |
|
|
|
31f9af |
install: hostname
|
|
|
31f9af |
install -d ${BASEDIR}/usr/share/man/man1
|
|
|
31f9af |
- install -o root -g root -m 0644 hostname.1 ${BASEDIR}/usr/share/man/man1
|
|
|
31f9af |
+ install -m 0644 hostname.1 ${BASEDIR}/usr/share/man/man1
|
|
|
31f9af |
+
|
|
|
31f9af |
ln -fs hostname.1 ${BASEDIR}/usr/share/man/man1/dnsdomainname.1
|
|
|
31f9af |
ln -fs hostname.1 ${BASEDIR}/usr/share/man/man1/domainname.1
|
|
|
31f9af |
ln -fs hostname.1 ${BASEDIR}/usr/share/man/man1/ypdomainname.1
|
|
|
31f9af |
ln -fs hostname.1 ${BASEDIR}/usr/share/man/man1/nisdomainname.1
|
|
|
31f9af |
#install -o root -g root -m 0644 hostname.1.fr ${BASEDIR}/usr/share/man/fr/man1/hostname.1
|
|
|
31f9af |
|
|
|
31f9af |
- install -d ${BASEDIR}/bin
|
|
|
31f9af |
- install -o root -g root -m 0755 hostname ${BASEDIR}/bin
|
|
|
31f9af |
- ln -f hostname ${BASEDIR}/bin/dnsdomainname
|
|
|
31f9af |
- ln -f hostname ${BASEDIR}/bin/domainname
|
|
|
31f9af |
- ln -f hostname ${BASEDIR}/bin/nisdomainname
|
|
|
31f9af |
- ln -f hostname ${BASEDIR}/bin/ypdomainname
|
|
|
31f9af |
+ install -d ${BASEDIR}$(BINDIR)
|
|
|
31f9af |
+ install -m 0755 hostname ${BASEDIR}$(BINDIR)
|
|
|
31f9af |
+ ln -fs hostname ${BASEDIR}$(BINDIR)/dnsdomainname
|
|
|
31f9af |
+ ln -fs hostname ${BASEDIR}$(BINDIR)/domainname
|
|
|
31f9af |
+ ln -fs hostname ${BASEDIR}$(BINDIR)/nisdomainname
|
|
|
31f9af |
+ ln -fs hostname ${BASEDIR}$(BINDIR)/ypdomainname
|
|
|
31f9af |
|
|
|
31f9af |
clean:
|
|
|
31f9af |
-rm -f $(OBJS) hostname dnsdomainname domainname nisdomainname ypdomainname
|