Replaced version w/out copyright with something I whipped up based on
authorNate Willams <nate@FreeBSD.org>
Tue, 22 Feb 1994 21:54:03 +0000 (21:54 +0000)
committerNate Willams <nate@FreeBSD.org>
Tue, 22 Feb 1994 21:54:03 +0000 (21:54 +0000)
hostname(1) and id(1).  This file has a BSD copyright since it's based on
those sources.

bin/domainname/domainname.c

index ec1233e..80408b2 100644 (file)
@@ -1,44 +1,83 @@
+/*
+ * Copyright (c) 1983, 1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+char copyright[] =
+"@(#) Copyright (c) 1983, 1988 Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif /* not lint */
+
 #ifndef lint
 #ifndef lint
-static char rcsid[] = "$Id$";
+static char sccsid1[] = "From@(#)hostname.c    5.4 (Berkeley) 5/31/90";
+static char sccsid2[] = "From@(#)id.c  5.1 (Berkeley) 6/29/91";
+static char rcsid[] = "$Id: domainname.c,v 1.2 1993/10/25 03:12:32 rgrimes Exp $
+";
 #endif /* not lint */
 
 #include <stdio.h>
 #endif /* not lint */
 
 #include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
 #include <sys/param.h>
 #include <sys/param.h>
+#include <unistd.h>
+#include <stdlib.h>
+
 
 
-static void usage __P((void));
+void   usage __P((void));
 
 
-main(argc, argv)
+main(argc,argv)
        int argc;
        char **argv;
 {
        int argc;
        char **argv;
 {
-       char dom[MAXHOSTNAMELEN];
+       char domainname[MAXHOSTNAMELEN];
 
 
-       if( argc>2 ) {
-               usage ();
-               /* NOTREACHED */
-       }
+       if (argc > 2)
+               usage();
 
 
-       if( argc==2 ) {
-               if( setdomainname(argv[1], strlen(argv[1])+1) == -1) {
+       if (argc == 2) {
+               if (setdomainname(argv[1], (strlen(argv[1]) + 1))) {
                        perror("setdomainname");
                        exit(1);
                }
        } else {
                        perror("setdomainname");
                        exit(1);
                }
        } else {
-               if( getdomainname(dom, sizeof(dom)) == -1) {
+               if (getdomainname(domainname, sizeof(domainname))) {
                        perror("getdomainname");
                        exit(1);
                }
                        perror("getdomainname");
                        exit(1);
                }
-               printf("%s\n", dom);
+               printf("%s\n", domainname);
        }
        }
-
        exit(0);
 }
 
        exit(0);
 }
 
-static void
-usage ()
+void
+usage()
 {
        (void)fprintf(stderr, "usage: domainname [name-of-domain]\n");
        exit(1);
 {
        (void)fprintf(stderr, "usage: domainname [name-of-domain]\n");
        exit(1);