install correct aliases file
[unix-history] / usr / src / usr.sbin / arp / arp.c
index 2e468e6..b90168c 100644 (file)
@@ -1,6 +1,32 @@
+/*
+ * Copyright (c) 1984 Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Sun Microsystems, Inc.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#ifndef lint
+char copyright[] =
+"@(#) Copyright (c) 1984 Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif /* not lint */
+
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)arp.c       5.5 (Berkeley) %G%";
-#endif
+static char sccsid[] = "@(#)arp.c      5.8 (Berkeley) %G%";
+#endif /* not lint */
 
 /*
  * arp - display, set, and delete arp table entries
 
 /*
  * arp - display, set, and delete arp table entries
@@ -127,9 +153,9 @@ set(argc, argv)
        sin->sin_family = AF_INET;
        sin->sin_addr.s_addr = inet_addr(host);
        if (sin->sin_addr.s_addr == -1) {
        sin->sin_family = AF_INET;
        sin->sin_addr.s_addr = inet_addr(host);
        if (sin->sin_addr.s_addr == -1) {
-               hp = gethostbyname(host);
-               if (hp == NULL) {
-                       fprintf(stderr, "arp: %s: unknown host\n", host);
+               if (!(hp = gethostbyname(host))) {
+                       fprintf(stderr, "arp: %s: ", host);
+                       herror((char *)NULL);
                        return (1);
                }
                bcopy((char *)hp->h_addr, (char *)&sin->sin_addr,
                        return (1);
                }
                bcopy((char *)hp->h_addr, (char *)&sin->sin_addr,
@@ -181,9 +207,9 @@ get(host)
        sin->sin_family = AF_INET;
        sin->sin_addr.s_addr = inet_addr(host);
        if (sin->sin_addr.s_addr == -1) {
        sin->sin_family = AF_INET;
        sin->sin_addr.s_addr = inet_addr(host);
        if (sin->sin_addr.s_addr == -1) {
-               hp = gethostbyname(host);
-               if (hp == NULL) {
-                       fprintf(stderr, "arp: %s: unknown host\n", host);
+               if (!(hp = gethostbyname(host))) {
+                       fprintf(stderr, "arp: %s: ", host);
+                       herror((char *)NULL);
                        exit(1);
                }
                bcopy((char *)hp->h_addr, (char *)&sin->sin_addr,
                        exit(1);
                }
                bcopy((char *)hp->h_addr, (char *)&sin->sin_addr,
@@ -235,9 +261,9 @@ delete(host)
        sin->sin_family = AF_INET;
        sin->sin_addr.s_addr = inet_addr(host);
        if (sin->sin_addr.s_addr == -1) {
        sin->sin_family = AF_INET;
        sin->sin_addr.s_addr = inet_addr(host);
        if (sin->sin_addr.s_addr == -1) {
-               hp = gethostbyname(host);
-               if (hp == NULL) {
-                       fprintf(stderr, "arp: %s: unknown host\n", host);
+               if (!(hp = gethostbyname(host))) {
+                       fprintf(stderr, "arp: %s: ", host);
+                       herror((char *)NULL);
                        exit(1);
                }
                bcopy((char *)hp->h_addr, (char *)&sin->sin_addr,
                        exit(1);
                }
                bcopy((char *)hp->h_addr, (char *)&sin->sin_addr,
@@ -293,7 +319,7 @@ dump(kernel, mem)
        }
        mf = open(mem, O_RDONLY);
        if (mf < 0) {
        }
        mf = open(mem, O_RDONLY);
        if (mf < 0) {
-               fprintf(fprintf, "arp: cannot open %s\n", mem);
+               fprintf(stderr, "arp: cannot open %s\n", mem);
                exit(1);
        }
        if (kflag) {
                exit(1);
        }
        if (kflag) {