FreeBSD Bugzilla – Attachment 175028 Details for
Bug 212875
[patch] add -d (domain) flag to hostname
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to add -d flag to hostname
hostname.domain.patch (text/plain), 1.14 KB, created by
Ben RUBSON
on 2016-09-21 06:58:45 UTC
(
hide
)
Description:
patch to add -d flag to hostname
Filename:
MIME Type:
Creator:
Ben RUBSON
Created:
2016-09-21 06:58:45 UTC
Size:
1.14 KB
patch
obsolete
>--- hostname.1.ori 2016-08-12 02:09:38.000000000 +0200 >+++ hostname.1 2016-09-21 08:54:07.714869000 +0200 >@@ -37,7 +37,7 @@ > .Nd set or print name of current host system > .Sh SYNOPSIS > .Nm >-.Op Fl fs >+.Op Fl fsd > .Op Ar name-of-host > .Sh DESCRIPTION > The >@@ -62,6 +62,8 @@ > .It Fl s > Trim off any domain information from the printed > name. >+.It Fl d >+Only print domain information. > .El > .Sh SEE ALSO > .Xr gethostname 3 , >--- hostname.c.ori 2016-08-12 02:09:38.000000000 +0200 >+++ hostname.c 2016-09-21 08:51:54.767720000 +0200 >@@ -54,11 +54,12 @@ > int > main(int argc, char *argv[]) > { >- int ch, sflag; >+ int ch, sflag, dflag; > char *p, hostname[MAXHOSTNAMELEN]; > > sflag = 0; >- while ((ch = getopt(argc, argv, "fs")) != -1) >+ dflag = 0; >+ while ((ch = getopt(argc, argv, "fsd")) != -1) > switch (ch) { > case 'f': > /* >@@ -70,6 +71,9 @@ > case 's': > sflag = 1; > break; >+ case 'd': >+ dflag = 1; >+ break; > case '?': > default: > usage(); >@@ -91,6 +95,11 @@ > if (p != NULL) > *p = '\0'; > } >+ else if (dflag) { >+ p = strchr(hostname, '.'); >+ if (p != NULL) >+ strcpy(hostname,++p); >+ } > (void)printf("%s\n", hostname); > } > exit(0);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 212875
:
175028
|
175863
|
175866