- Make "hostname -s" display host name cut at the first dot (no matter if
the host name resolves or not) (bug #531702)
This commit is contained in:
parent
4a78a731c3
commit
19162aa535
38
net-tools-1.60-hostname-short.patch
Normal file
38
net-tools-1.60-hostname-short.patch
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
diff -up net-tools-1.60/hostname.c.hostname-short net-tools-1.60/hostname.c
|
||||||
|
--- net-tools-1.60/hostname.c.hostname-short 2009-09-30 17:44:21.000000000 +0200
|
||||||
|
+++ net-tools-1.60/hostname.c 2009-09-08 11:55:03.000000000 +0200
|
||||||
|
@@ -176,11 +176,6 @@ static void showhname(char *hname, int c
|
||||||
|
case 'f':
|
||||||
|
printf("%s\n", hp->h_name);
|
||||||
|
break;
|
||||||
|
- case 's':
|
||||||
|
- if (p != NULL)
|
||||||
|
- *p = '\0';
|
||||||
|
- printf("%s\n", hp->h_name);
|
||||||
|
- break;
|
||||||
|
default:
|
||||||
|
;
|
||||||
|
}
|
||||||
|
@@ -270,6 +265,7 @@ int main(int argc, char **argv)
|
||||||
|
char myname[MAXHOSTNAMELEN + 1] =
|
||||||
|
{0};
|
||||||
|
char *file = NULL;
|
||||||
|
+ char *p;
|
||||||
|
|
||||||
|
static const struct option long_options[] =
|
||||||
|
{
|
||||||
|
@@ -370,7 +366,13 @@ int main(int argc, char **argv)
|
||||||
|
if (!type)
|
||||||
|
printf("%s\n", myname);
|
||||||
|
else
|
||||||
|
- showhname(myname, type);
|
||||||
|
+ if (type == 's') {
|
||||||
|
+ if (p = strchr(myname, '.'))
|
||||||
|
+ *p = '\0';
|
||||||
|
+ printf("%s\n", myname);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ showhname(myname, type);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (file) {
|
@ -1,14 +1,14 @@
|
|||||||
--- net-tools-1.60/man/en_US/hostname.1.gethostbyname 2005-10-14 11:33:41.000000000 +0200
|
--- net-tools-1.60/man/en_US/hostname.1.gethostbyname 2005-10-14 11:33:41.000000000 +0200
|
||||||
+++ net-tools-1.60/man/en_US/hostname.1 2005-10-15 11:46:14.646697600 +0200
|
+++ net-tools-1.60/man/en_US/hostname.1 2005-10-15 11:46:14.646697600 +0200
|
||||||
@@ -99,6 +99,32 @@
|
@@ -99,6 +99,33 @@
|
||||||
complete FQDN of the system is returned with
|
complete FQDN of the system is returned with
|
||||||
.BR "hostname \-\-fqdn" .
|
.BR "hostname \-\-fqdn" .
|
||||||
|
|
||||||
+.LP
|
+.LP
|
||||||
+The function
|
+The function
|
||||||
+.BR gethostname(2)
|
+.BR gethostname(2)
|
||||||
+is used to get the hostname. Only when the
|
+is used to get the hostname. When the
|
||||||
+.BR "hostname \-s"
|
+.BR "hostname \-a, \-d, \-f or \-i"
|
||||||
+is called will
|
+is called will
|
||||||
+.BR gethostbyname(3)
|
+.BR gethostbyname(3)
|
||||||
+be called. The difference in
|
+be called. The difference in
|
||||||
@ -25,7 +25,8 @@
|
|||||||
+.IR /etc/sysconfig/network
|
+.IR /etc/sysconfig/network
|
||||||
+or
|
+or
|
||||||
+.IR /etc/hosts
|
+.IR /etc/hosts
|
||||||
+. To add another dimension to this,
|
+
|
||||||
|
+To add another dimension to this,
|
||||||
+the
|
+the
|
||||||
+.B hostname
|
+.B hostname
|
||||||
+is also set when the network interface is brought up.
|
+is also set when the network interface is brought up.
|
||||||
|
@ -16,38 +16,3 @@ diff -up net-tools-1.60/man/de_DE/arp.8.man-RHEL-bugs net-tools-1.60/man/de/arp.
|
|||||||
.br
|
.br
|
||||||
.B ANMERKUNG:
|
.B ANMERKUNG:
|
||||||
Ab der Kernelversion 2.2.0 ist es nicht mehr m\(:oglich ARP-Eintr\(:age f\(:ur
|
Ab der Kernelversion 2.2.0 ist es nicht mehr m\(:oglich ARP-Eintr\(:age f\(:ur
|
||||||
diff -up net-tools-1.60/man/en_US/hostname.1.man-RHEL-bugs net-tools-1.60/man/en_US/hostname.1
|
|
||||||
--- net-tools-1.60/man/en_US/hostname.1.man-RHEL-bugs 2009-09-09 15:52:27.000000000 +0200
|
|
||||||
+++ net-tools-1.60/man/en_US/hostname.1 2009-09-09 15:52:27.000000000 +0200
|
|
||||||
@@ -100,11 +100,11 @@ complete FQDN of the system is returned
|
|
||||||
.LP
|
|
||||||
The function
|
|
||||||
.BR gethostname(2)
|
|
||||||
-is used to get the hostname. Only when the
|
|
||||||
-.BR "hostname \-s"
|
|
||||||
-is called will
|
|
||||||
-.BR gethostbyname(3)
|
|
||||||
-be called. The difference in
|
|
||||||
+is used to get the hostname.
|
|
||||||
+When \fBhostname\fR
|
|
||||||
+is called with \fB-s\fR, \fB-a\fR, \fB-i\fR, \fB-f\fR or \fB-d\fR
|
|
||||||
+the \fBgethostbyname(3)\fR will be called.
|
|
||||||
+The difference in
|
|
||||||
.BR gethostname(2)
|
|
||||||
and
|
|
||||||
.BR gethostbyname(3)
|
|
||||||
@@ -117,11 +117,9 @@ and
|
|
||||||
to decide whether to read information in
|
|
||||||
.IR /etc/sysconfig/network
|
|
||||||
or
|
|
||||||
-.IR /etc/hosts
|
|
||||||
-. To add another dimension to this,
|
|
||||||
-the
|
|
||||||
-.B hostname
|
|
||||||
-is also set when the network interface is brought up.
|
|
||||||
+.IR /etc/hosts .
|
|
||||||
+If \fBgethostbyname(3)\fR cannot resolve host name,
|
|
||||||
+\fIUnknown host\fR warning is returned.
|
|
||||||
|
|
||||||
.SS "SET NAME"
|
|
||||||
When called with one argument or with the
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Summary: Basic networking tools
|
Summary: Basic networking tools
|
||||||
Name: net-tools
|
Name: net-tools
|
||||||
Version: 1.60
|
Version: 1.60
|
||||||
Release: 96%{?dist}
|
Release: 97%{?dist}
|
||||||
License: GPL+
|
License: GPL+
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
URL: http://net-tools.berlios.de/
|
URL: http://net-tools.berlios.de/
|
||||||
@ -97,7 +97,6 @@ Patch76: net-tools-1.60-ib-warning.patch
|
|||||||
# notes in man pages, saying that these tools are obsolete
|
# notes in man pages, saying that these tools are obsolete
|
||||||
Patch77: net-tools-1.60-man-obsolete.patch
|
Patch77: net-tools-1.60-man-obsolete.patch
|
||||||
|
|
||||||
# Bug 319981 hostname -s gives hostname: Unknown host when the FQDN does not resolve
|
|
||||||
# Bug 322901 Sens negating error in man page translation (arp)
|
# Bug 322901 Sens negating error in man page translation (arp)
|
||||||
Patch78: net-tools-1.60-man-RHEL-bugs.patch
|
Patch78: net-tools-1.60-man-RHEL-bugs.patch
|
||||||
|
|
||||||
@ -112,6 +111,9 @@ Patch80: net-tools-1.60-makefile-berlios.patch
|
|||||||
# slattach: use fchown() rather than chown() to avoid race between creation and permission changing
|
# slattach: use fchown() rather than chown() to avoid race between creation and permission changing
|
||||||
Patch81: net-tools-1.60-slattach-fchown.patch
|
Patch81: net-tools-1.60-slattach-fchown.patch
|
||||||
|
|
||||||
|
# Bug 531702: make "hostname -s" display host name cut at the first dot (no matter if the host name resolves or not)
|
||||||
|
Patch82: net-tools-1.60-hostname-short.patch
|
||||||
|
|
||||||
BuildRequires: gettext, libselinux
|
BuildRequires: gettext, libselinux
|
||||||
BuildRequires: libselinux-devel
|
BuildRequires: libselinux-devel
|
||||||
|
|
||||||
@ -196,6 +198,7 @@ Most of them are obsolete. For replacement check iproute package.
|
|||||||
%patch79 -p1 -b .masqinfo-raw-ip
|
%patch79 -p1 -b .masqinfo-raw-ip
|
||||||
%patch80 -p1 -b .makefile-berlios
|
%patch80 -p1 -b .makefile-berlios
|
||||||
%patch81 -p1 -b .slattach-fchown
|
%patch81 -p1 -b .slattach-fchown
|
||||||
|
%patch82 -p1 -b .hostname-short
|
||||||
|
|
||||||
cp %SOURCE1 ./config.h
|
cp %SOURCE1 ./config.h
|
||||||
cp %SOURCE2 ./config.make
|
cp %SOURCE2 ./config.make
|
||||||
@ -283,6 +286,9 @@ rm -rf %{buildroot}
|
|||||||
%config(noreplace) %{_sysconfdir}/ethers
|
%config(noreplace) %{_sysconfdir}/ethers
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Oct 29 2009 Jiri Popelka <jpopelka@redhat.com> - 1.60-97
|
||||||
|
- Make "hostname -s" display host name cut at the first dot (no
|
||||||
|
matter if the host name resolves or not) (bug #531702)
|
||||||
|
|
||||||
* Tue Sep 30 2009 Jiri Popelka <jpopelka@redhat.com> - 1.60-96
|
* Tue Sep 30 2009 Jiri Popelka <jpopelka@redhat.com> - 1.60-96
|
||||||
- netplug moved to separate package
|
- netplug moved to separate package
|
||||||
|
Loading…
Reference in New Issue
Block a user