summaryrefslogtreecommitdiff
path: root/bin/domainname
diff options
context:
space:
mode:
authorPhilippe Charnier <charnier@FreeBSD.org>1997-06-03 06:19:04 +0000
committerPhilippe Charnier <charnier@FreeBSD.org>1997-06-03 06:19:04 +0000
commite2b60e721de36d92826542f65e92a79b43e48b5b (patch)
tree1ff77c96277acc15fb1a422d4aeb4407f7ded3e4 /bin/domainname
parent0e6f6af18d7656ccf198d04fdd5870be04fb8ad4 (diff)
downloadsrc-test2-e2b60e721de36d92826542f65e92a79b43e48b5b.tar.gz
src-test2-e2b60e721de36d92826542f65e92a79b43e48b5b.zip
Notes
Diffstat (limited to 'bin/domainname')
-rw-r--r--bin/domainname/domainname.14
-rw-r--r--bin/domainname/domainname.c25
2 files changed, 25 insertions, 4 deletions
diff --git a/bin/domainname/domainname.1 b/bin/domainname/domainname.1
index 118e12343ba5..867bcda9712c 100644
--- a/bin/domainname/domainname.1
+++ b/bin/domainname/domainname.1
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" From: @(#)hostname.1 8.1 (Berkeley) 5/31/93
-.\" $Id$
+.\" $Id: domainname.1,v 1.4 1997/02/22 14:03:00 peter Exp $
.\"
.Dd September 18, 1994
.Dt DOMAINNAME 1
@@ -46,7 +46,7 @@
prints the name of the current YP/NIS domain. The super-user can
set the domain name by supplying an argument; this is usually done in the
network initialization script
-.Pa /etc/netstart ,
+.Pa /etc/rc.network ,
normally run at boot
time.
.Sh NOTA BENE
diff --git a/bin/domainname/domainname.c b/bin/domainname/domainname.c
index 1a173e931a02..0dfcb4ba7e1a 100644
--- a/bin/domainname/domainname.c
+++ b/bin/domainname/domainname.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: domainname.c,v 1.8 1997/02/22 14:03:01 peter Exp $
*/
#ifndef lint
@@ -51,14 +51,28 @@ static char const sccsid[] = "From: @(#)hostname.c 8.1 (Berkeley) 5/31/93";
#include <string.h>
#include <unistd.h>
+extern char *__progname;
+
+void usage __P((void));
+
int
main(argc,argv)
int argc;
char *argv[];
{
+ int ch;
char domainname[MAXHOSTNAMELEN];
- argc--, argv++;
+ while ((ch = getopt(argc, argv, "")) != -1)
+ switch (ch) {
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc > 1)
+ usage();
if (*argv) {
if (setdomainname(*argv, strlen(*argv)))
@@ -70,3 +84,10 @@ main(argc,argv)
}
exit(0);
}
+
+void
+usage()
+{
+ (void)fprintf(stderr, "usage: %s [ypdomain]\n", __progname);
+ exit(1);
+}