include fix
[unix-history] / usr / src / sbin / dump / dumprmt.c
index 6378cd0..67d82cb 100644 (file)
@@ -1,10 +1,13 @@
-static char *sccsid = "@(#)dumprmt.c   1.2 (Berkeley) %G%";
+static char *sccsid = "@(#)dumprmt.c   1.6 (Berkeley) %G%";
 
 
-#include <stdio.h>
 #include <sys/param.h>
 #include <sys/mtio.h>
 #include <sys/ioctl.h>
 #include <sys/param.h>
 #include <sys/mtio.h>
 #include <sys/ioctl.h>
-#include <net/in.h>
+
+#include <netinet/in.h>
+
+#include <stdio.h>
+#include <netdb.h>
 
 #define        TS_CLOSED       0
 #define        TS_OPEN         1
 
 #define        TS_CLOSED       0
 #define        TS_OPEN         1
@@ -19,7 +22,7 @@ rmthost(host)
 {
 
        rmtpeer = host;
 {
 
        rmtpeer = host;
-       sigset(SIGPIPE, rmtconnaborted);
+       signal(SIGPIPE, rmtconnaborted);
        rmtgetconn();
        if (rmtape < 0)
                exit(1);
        rmtgetconn();
        if (rmtape < 0)
                exit(1);
@@ -34,9 +37,16 @@ rmtconnaborted()
 
 rmtgetconn()
 {
 
 rmtgetconn()
 {
+       static struct servent *sp = 0;
 
 
-       rmtape = rcmd(&rmtpeer, IPPORT_CMDSERVER,
-           "root", "root", "/etc/rmt", 0);
+       if (sp == 0) {
+               sp = getservbyname("shell", "tcp");
+               if (sp == 0) {
+                       fprintf(stderr, "rdump: shell/tcp: unknown service\n");
+                       exit(1);
+               }
+       }
+       rmtape = rcmd(&rmtpeer, sp->s_port, "root", "root", "/etc/rmt", 0);
 }
 
 rmtopen(tape, mode)
 }
 
 rmtopen(tape, mode)
@@ -151,7 +161,7 @@ rmtioctl(cmd, count)
        if (count < 0)
                return (-1);
        sprintf(buf, "I%d\n%d\n", cmd, count);
        if (count < 0)
                return (-1);
        sprintf(buf, "I%d\n%d\n", cmd, count);
-       rmtcall("ioctl", buf);
+       return (rmtcall("ioctl", buf));
 }
 
 rmtcall(cmd, buf)
 }
 
 rmtcall(cmd, buf)
@@ -213,10 +223,3 @@ rmtgets(cp, len)
        msg("Protocol to remote tape server botched (in rmtgets).\n");
        rmtconnaborted();
 }
        msg("Protocol to remote tape server botched (in rmtgets).\n");
        rmtconnaborted();
 }
-
-msg(cp, a1, a2, a3)
-       char *cp;
-{
-
-       fprintf(stderr, cp, a1, a2, a3);
-}