date and time created 88/10/18 22:03:05 by bostic
[unix-history] / usr / src / old / gettable / gettable.c
index ebc247d..7d4fbac 100644 (file)
@@ -1,6 +1,29 @@
+/*
+ * Copyright (c) 1983 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * 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) 1983 The Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif /* not lint */
+
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)gettable.c 4.5 (Berkeley) %G%";
-#endif
+static char sccsid[] = "@(#)gettable.c 5.4 (Berkeley) %G%";
+#endif /* not lint */
 
 #include <sys/types.h>
 #include <sys/socket.h>
 
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -28,7 +51,6 @@ main(argc, argv)
        int s;
        register len;
        register FILE *sfi, *sfo, *hf;
        int s;
        register len;
        register FILE *sfi, *sfo, *hf;
-       register char *p;
        char *host;
        register struct hostent *hp;
        struct servent *sp;
        char *host;
        register struct hostent *hp;
        struct servent *sp;
@@ -57,25 +79,26 @@ main(argc, argv)
        argv++, argc--;
        hp = gethostbyname(host);
        if (hp == NULL) {
        argv++, argc--;
        hp = gethostbyname(host);
        if (hp == NULL) {
-               fprintf(stderr, "gettable: %s: host unknown\n", host);
+               fprintf(stderr, "gettable: %s: ", host);
+               herror((char *)NULL);
                exit(2);
        }
        host = hp->h_name;
        if (argc > 0)
                outfile = *argv;
        sin.sin_family = hp->h_addrtype;
                exit(2);
        }
        host = hp->h_name;
        if (argc > 0)
                outfile = *argv;
        sin.sin_family = hp->h_addrtype;
-       s = socket(hp->h_addrtype, SOCK_STREAM, 0, 0);
+       s = socket(hp->h_addrtype, SOCK_STREAM, 0);
        if (s < 0) {
                perror("gettable: socket");
                exit(4);
        }
        if (s < 0) {
                perror("gettable: socket");
                exit(4);
        }
-       if (bind(s, &sin, sizeof (sin), 0) < 0) {
+       if (bind(s, &sin, sizeof (sin)) < 0) {
                perror("gettable: bind");
                exit(5);
        }
                perror("gettable: bind");
                exit(5);
        }
-       bcopy(hp->h_addr, &sin.sin_addr, hp->h_length);
+       bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length);
        sin.sin_port = sp->s_port;
        sin.sin_port = sp->s_port;
-       if (connect(s, &sin, sizeof (sin), 0) < 0) {
+       if (connect(s, &sin, sizeof (sin)) < 0) {
                perror("gettable: connect");
                exit(6);
        }
                perror("gettable: connect");
                exit(6);
        }