aboutsummaryrefslogtreecommitdiff
path: root/bin/hostname
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@FreeBSD.org>2006-12-08 07:19:51 +0000
committerTim Kientzle <kientzle@FreeBSD.org>2006-12-08 07:19:51 +0000
commita426a2865cd5e574ad1f8d019802cead0ef898cd (patch)
tree73b1d0d714b3f6a038a316ac17ef2ba1872e72ea /bin/hostname
parent6027060830f5a90de0413d7cb6e6d00c313b90b3 (diff)
Notes
Diffstat (limited to 'bin/hostname')
-rw-r--r--bin/hostname/hostname.16
-rw-r--r--bin/hostname/hostname.c7
2 files changed, 11 insertions, 2 deletions
diff --git a/bin/hostname/hostname.1 b/bin/hostname/hostname.1
index 5cf4534b610e..62df0df44235 100644
--- a/bin/hostname/hostname.1
+++ b/bin/hostname/hostname.1
@@ -29,7 +29,7 @@
.\" @(#)hostname.1 8.2 (Berkeley) 4/28/95
.\" $FreeBSD$
.\"
-.Dd December 5, 2006
+.Dd December 7, 2006
.Dt HOSTNAME 1
.Os
.Sh NAME
@@ -37,6 +37,7 @@
.Nd set or print name of current host system
.Sh SYNOPSIS
.Nm
+.Op Fl f
.Op Fl s
.Op Ar name-of-host
.Sh DESCRIPTION
@@ -56,6 +57,9 @@ variable in
.Pp
Options:
.Bl -tag -width flag
+.It Fl f
+Include domain information in the printed name.
+This is the default behavior.
.It Fl s
Trim off any domain information from the printed
name.
diff --git a/bin/hostname/hostname.c b/bin/hostname/hostname.c
index 512327baf733..dd3f7e9970b0 100644
--- a/bin/hostname/hostname.c
+++ b/bin/hostname/hostname.c
@@ -58,8 +58,13 @@ main(int argc, char *argv[])
char *p, hostname[MAXHOSTNAMELEN];
sflag = 0;
- while ((ch = getopt(argc, argv, "s")) != -1)
+ while ((ch = getopt(argc, argv, "sf")) != -1)
switch (ch) {
+ case 'f':
+ /* On Linux, "hostname -f" prints FQDN. */
+ /* BSD "hostname" always print FQDN by
+ * default, so we accept but ignore -f. */
+ break;
case 's':
sflag = 1;
break;