~vcs-imports/ipfire/ipfire-3.x

« back to all changes in this revision

Viewing changes to pkgs/core/net-tools/patches/net-tools-1.60-hostname-short.patch

  • Committer: Michael Tremer
  • Date: 2010-11-04 11:54:16 UTC
  • Revision ID: git-v1:236898d61338706c7a8f22f80eb7a2d917619805
net-tools: New package.

Originally created by Stefan Schantl.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff -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) {