]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blame - net-tools/patches/net-tools-1.60-hostname-short.patch
Merge remote-tracking branch 'maniacikarus/samba'
[people/ms/ipfire-3.x.git] / net-tools / patches / net-tools-1.60-hostname-short.patch
CommitLineData
236898d6
MT
1diff -up net-tools-1.60/hostname.c.hostname-short net-tools-1.60/hostname.c
2--- net-tools-1.60/hostname.c.hostname-short 2009-09-30 17:44:21.000000000 +0200
3+++ net-tools-1.60/hostname.c 2009-09-08 11:55:03.000000000 +0200
4@@ -176,11 +176,6 @@ static void showhname(char *hname, int c
5 case 'f':
6 printf("%s\n", hp->h_name);
7 break;
8- case 's':
9- if (p != NULL)
10- *p = '\0';
11- printf("%s\n", hp->h_name);
12- break;
13 default:
14 ;
15 }
16@@ -270,6 +265,7 @@ int main(int argc, char **argv)
17 char myname[MAXHOSTNAMELEN + 1] =
18 {0};
19 char *file = NULL;
20+ char *p;
21
22 static const struct option long_options[] =
23 {
24@@ -370,7 +366,13 @@ int main(int argc, char **argv)
25 if (!type)
26 printf("%s\n", myname);
27 else
28- showhname(myname, type);
29+ if (type == 's') {
30+ if (p = strchr(myname, '.'))
31+ *p = '\0';
32+ printf("%s\n", myname);
33+ }
34+ else
35+ showhname(myname, type);
36 break;
37 case 3:
38 if (file) {