A new user interface for you! Read more...

File net-tools-1.60-hostname-s.patch of Package net-tools

Index: net-tools-1.60/hostname.c
===================================================================
--- net-tools-1.60.orig/hostname.c
+++ net-tools-1.60/hostname.c
@@ -300,11 +300,6 @@ static void showhname(char *hname, int c
     case 'f':
 	printf("%s\n", res->ai_canonname);
 	break;
-    case 's':
-	if (p != NULL)
-	    *p = '\0';
-	printf("%s\n", res->ai_canonname);
-	break;
     default:
 	break;
     }
@@ -494,7 +489,12 @@ int main(int argc, char **argv)
 	    fprintf(stderr, _("gethostname()=`%s'\n"), myname);
 	if (!type)
 	    printf("%s\n", myname);
-	else
+	else if (type == 's') {
+	    char *p = strchr(myname, '.');
+	    if (p)
+		*p = '\0';
+	    printf("%s\n", myname);
+	} else
 	    showhname(myname, type);
 	break;
     case 3: