static char *sccsid
= "@(#)dumprmt.c 1.3 (Berkeley) %G%";
static int rmtstate
= TS_CLOSED
;
sigset(SIGPIPE
, rmtconnaborted
);
fprintf(stderr
, "Lost connection to remote host.\n");
rmtape
= rcmd(&rmtpeer
, IPPORT_CMDSERVER
,
"root", "root", "/etc/rmt", 0);
sprintf(buf
, "O%s\n%d\n", tape
, mode
);
sprintf(line
, "R%d\n", count
);
n
= rmtcall("read", line
);
for (i
= 0; i
< n
; i
+= cc
) {
cc
= read(rmtape
, buf
+i
, n
- i
);
sprintf(line
, "W%d\n", count
);
write(rmtape
, line
, strlen(line
));
write(rmtape
, buf
, count
);
return (rmtreply("write"));
sprintf(line
, "W%d\n", count
);
write(rmtape
, line
, strlen(line
));
write(rmtape
, buf
, count
);
return (rmtreply("write"));
sprintf(line
, "L%d\n%d\n", offset
, pos
);
return (rmtcall("seek", line
));
rmtcall("status", "S\n");
for (i
= 0, cp
= (char *)&mts
; i
< sizeof(mts
); i
++)
sprintf(buf
, "I%d\n%d\n", cmd
, count
);
if (write(rmtape
, buf
, strlen(buf
)) != strlen(buf
))
char code
[30], emsg
[BUFSIZ
];
rmtgets(code
, sizeof (code
));
if (*code
== 'E' || *code
== 'F') {
rmtgets(emsg
, sizeof (emsg
));
msg("%s: %s\n", cmd
, emsg
, code
+ 1);
msg("Protocol to remote tape server botched (code %s?).\n",
if (read(rmtape
, &c
, 1) != 1)
msg("Protocol to remote tape server botched (in rmtgets).\n");