* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
static char sccsid
[] = "@(#)dumprmt.c 5.4 (Berkeley) %G%";
#include <protocols/dumprestore.h>
static int rmtstate
= TS_CLOSED
;
extern int ntrec
; /* blocking factor on tape */
signal(SIGPIPE
, rmtconnaborted
);
fprintf(stderr
, "rdump: Lost connection to remote host.\n");
static struct servent
*sp
= 0;
sp
= getservbyname("shell", "tcp");
fprintf(stderr
, "rdump: shell/tcp: unknown service\n");
rmtape
= rcmd(&rmtpeer
, sp
->s_port
, name
, name
, "/etc/rmt", 0);
while (size
> TP_BSIZE
&&
setsockopt(rmtape
, SOL_SOCKET
, SO_SNDBUF
, &size
, sizeof (size
)) < 0)
sprintf(buf
, "O%s\n%d\n", tape
, mode
);
return (rmtcall(tape
, buf
));
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
);
return (rmtcall("ioctl", buf
));
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");