v07i091: Remote magtape library for 4.3BSD
sources-request at mirror.UUCP
sources-request at mirror.UUCP
Thu Dec 18 11:21:16 AEST 1986
Submitted by: Arnold D. Robbins <linus!gatech!emoryu1!arnold>
Mod.sources: Volume 7, Issue 91
Archive-name: remtape
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# README
# Makefile
# rmt.h
# rmtlib.c
# rmtops.3
# dd.1.patch
# dd.c.patch
# tar.1.patch
# tar.c.patch
export PATH; PATH=/bin:$PATH
echo shar: extracting "'README'" '(592 characters)'
if test -f 'README'
then
echo shar: will not over-write existing file "'README'"
else
cat << \SHAR_EOF > 'README'
README
This is the remote mag tape library for 4.3 BSD. It is almost unchanged
from the 4.2 version. However, I am sending the whole thing, since the first
one is in the archives as an initial submission plus a patch, and it is
small enough to be reposted again from scratch.
Besides the remote mag tape library (-lrmt) itself, I am including patches
to tar, dd, and their man pages. I have used RCS this time around, therefore
"your line numbers may vary". Patch should be able to handle it, though.
Enjoy,
Arnold Robbins
Emory University Computing Center
{ akgua, gatech }!emory!arnold
SHAR_EOF
fi # end of overwriting check
echo shar: extracting "'Makefile'" '(421 characters)'
if test -f 'Makefile'
then
echo shar: will not over-write existing file "'Makefile'"
else
cat << \SHAR_EOF > 'Makefile'
#
# $Header: Makefile,v 1.1 86/10/09 16:42:13 root Locked $
#
# $Log: Makefile,v $
# Revision 1.1 86/10/09 16:42:13 root
# Initial revision
#
#
# Makefile for rmtlib
CFLAGS= -O
SRC= rmtlib.c
DOC= rmtops.3
MANSEC=3
DEST= /usr/lib
librmt.a: rmtlib.o
ar rv librmt.a rmtlib.o
install: librmt.a
cp librmt.a /usr/lib
ranlib /usr/lib/librmt.a
cp $(DOC) /usr/man/man$(MANSEC)/rmtops.$(MANSEC)
clean:
rm -f rmtlib.o
SHAR_EOF
fi # end of overwriting check
echo shar: extracting "'rmt.h'" '(1056 characters)'
if test -f 'rmt.h'
then
echo shar: will not over-write existing file "'rmt.h'"
else
cat << \SHAR_EOF > 'rmt.h'
/*
* $Header: rmt.h,v 1.1 86/10/09 16:17:20 root Locked $
*
* $Log: rmt.h,v $
* Revision 1.1 86/10/09 16:17:20 root
* Initial revision
*
*/
/*
* rmt.h
*
* Added routines to replace open(), close(), lseek(), ioctl(), etc.
* The preprocessor can be used to remap these the rmtopen(), etc
* thus minimizing source changes.
*
* This file must be included before <sys/stat.h>, since it redefines
* stat to be rmtstat, so that struct stat xyzzy; declarations work
* properly.
*
* -- Fred Fish (w/some changes by Arnold Robbins)
*/
#ifndef access /* avoid multiple redefinition */
#ifndef lint /* in this case what lint doesn't know won't hurt it */
#define access rmtaccess
#define close rmtclose
#define creat rmtcreat
#define dup rmtdup
#define fcntl rmtfcntl
#define fstat rmtfstat
#define ioctl rmtioctl
#define isatty rmtisatty
#define lseek rmtlseek
#define lstat rmtlstat
#define open rmtopen
#define read rmtread
#define stat rmtstat
#define write rmtwrite
extern long rmtlseek (); /* all the rest are int's */
#endif
#endif
SHAR_EOF
fi # end of overwriting check
echo shar: extracting "'rmtlib.c'" '(14258 characters)'
if test -f 'rmtlib.c'
then
echo shar: will not over-write existing file "'rmtlib.c'"
else
cat << \SHAR_EOF > 'rmtlib.c'
#ifndef lint
static char *RCSid = "$Header: rmtlib.c,v 1.2 86/10/09 16:38:53 root Locked $";
#endif
/*
* $Log: rmtlib.c,v $
* Revision 1.2 86/10/09 16:38:53 root
* Changed to reflect 4.3BSD rcp syntax. ADR.
*
* Revision 1.1 86/10/09 16:17:35 root
* Initial revision
*
*/
/*
* rmt --- remote tape emulator subroutines
*
* Originally written by Jeff Lee, modified some by Arnold Robbins
*
* WARNING: The man page rmt(8) for /etc/rmt documents the remote mag
* tape protocol which rdump and rrestore use. Unfortunately, the man
* page is *WRONG*. The author of the routines I'm including originally
* wrote his code just based on the man page, and it didn't work, so he
* went to the rdump source to figure out why. The only thing he had to
* change was to check for the 'F' return code in addition to the 'E',
* and to separate the various arguments with \n instead of a space. I
* personally don't think that this is much of a problem, but I wanted to
* point it out.
* -- Arnold Robbins
*
* Redone as a library that can replace open, read, write, etc, by
* Fred Fish, with some additional work by Arnold Robbins.
*/
/*
* MAXUNIT --- Maximum number of remote tape file units
*
* READ --- Return the number of the read side file descriptor
* WRITE --- Return the number of the write side file descriptor
*/
#define RMTIOCTL 1
#include <stdio.h>
#include <signal.h>
#include <sys/types.h>
#ifdef RMTIOCTL
#include <sys/ioctl.h>
#include <sys/mtio.h>
#endif
#include <errno.h>
#include <setjmp.h>
#include <sys/stat.h>
#define BUFMAGIC 64 /* a magic number for buffer sizes */
#define MAXUNIT 4
#define READ(fd) (Ctp[fd][0])
#define WRITE(fd) (Ptc[fd][1])
static int Ctp[MAXUNIT][2] = { -1, -1, -1, -1, -1, -1, -1, -1 };
static int Ptc[MAXUNIT][2] = { -1, -1, -1, -1, -1, -1, -1, -1 };
static jmp_buf Jmpbuf;
extern int errno;
/*
* abort --- close off a remote tape connection
*/
static void abort(fildes)
int fildes;
{
close(READ(fildes));
close(WRITE(fildes));
READ(fildes) = -1;
WRITE(fildes) = -1;
}
/*
* command --- attempt to perform a remote tape command
*/
static int command(fildes, buf)
int fildes;
char *buf;
{
register int blen;
int (*pstat)();
/*
* save current pipe status and try to make the request
*/
blen = strlen(buf);
pstat = signal(SIGPIPE, SIG_IGN);
if (write(WRITE(fildes), buf, blen) == blen)
{
signal(SIGPIPE, pstat);
return(0);
}
/*
* something went wrong. close down and go home
*/
signal(SIGPIPE, pstat);
abort(fildes);
errno = EIO;
return(-1);
}
/*
* status --- retrieve the status from the pipe
*/
static int status(fildes)
int fildes;
{
int i;
char c, *cp;
char buffer[BUFMAGIC];
/*
* read the reply command line
*/
for (i = 0, cp = buffer; i < BUFMAGIC; i++, cp++)
{
if (read(READ(fildes), cp, 1) != 1)
{
abort(fildes);
errno = EIO;
return(-1);
}
if (*cp == '\n')
{
*cp = 0;
break;
}
}
if (i == BUFMAGIC)
{
abort(fildes);
errno = EIO;
return(-1);
}
/*
* check the return status
*/
for (cp = buffer; *cp; cp++)
if (*cp != ' ')
break;
if (*cp == 'E' || *cp == 'F')
{
errno = atoi(cp + 1);
while (read(READ(fildes), &c, 1) == 1)
if (c == '\n')
break;
if (*cp == 'F')
abort(fildes);
return(-1);
}
/*
* check for mis-synced pipes
*/
if (*cp != 'A')
{
abort(fildes);
errno = EIO;
return(-1);
}
return(atoi(cp + 1));
}
/*
* _rmt_open --- open a magtape device on system specified, as given user
*
* file name has the form system[.user]:/dev/????
*/
#define MAXHOSTLEN 257 /* BSD allows very long host names... */
static int _rmt_open (path, oflag, mode)
char *path;
int oflag;
int mode;
{
int i, rc;
char buffer[BUFMAGIC];
char system[MAXHOSTLEN];
char device[BUFMAGIC];
char login[BUFMAGIC];
char *sys, *dev, *user;
sys = system;
dev = device;
user = login;
/*
* first, find an open pair of file descriptors
*/
for (i = 0; i < MAXUNIT; i++)
if (READ(i) == -1 && WRITE(i) == -1)
break;
if (i == MAXUNIT)
{
errno = EMFILE;
return(-1);
}
/*
* pull apart system and device, and optional user
* don't munge original string
* handle both old host.person and new person at site notations
*/
while (*path != '@' && *path != '.' && *path != ':') {
*sys++ = *path++;
}
*sys = '\0';
path++;
if (*(path - 1) == '@')
{
(void) strcpy (user, sys); /* saw user part of user at host */
sys = system; /* start over */
while (*path != ':') {
*sys++ = *path++;
}
*sys = '\0';
path++;
}
else if (*(path - 1) == '.')
{
while (*path != ':') {
*user++ = *path++;
}
*user = '\0';
path++;
}
else
*user = '\0';
while (*path) {
*dev++ = *path++;
}
*dev = '\0';
/*
* setup the pipes for the 'rsh' command and fork
*/
if (pipe(Ptc[i]) == -1 || pipe(Ctp[i]) == -1)
return(-1);
if ((rc = fork()) == -1)
return(-1);
if (rc == 0)
{
close(0);
dup(Ptc[i][0]);
close(Ptc[i][0]); close(Ptc[i][1]);
close(1);
dup(Ctp[i][1]);
close(Ctp[i][0]); close(Ctp[i][1]);
(void) setuid (getuid ());
(void) setgid (getgid ());
if (*user)
{
execl("/usr/ucb/rsh", "rsh", system, "-l", login,
"/etc/rmt", (char *) 0);
execl("/usr/bin/remsh", "remsh", system, "-l", login,
"/etc/rmt", (char *) 0);
}
else
{
execl("/usr/ucb/rsh", "rsh", system,
"/etc/rmt", (char *) 0);
execl("/usr/bin/remsh", "remsh", system,
"/etc/rmt", (char *) 0);
}
/*
* bad problems if we get here
*/
perror("exec");
exit(1);
}
close(Ptc[i][0]); close(Ctp[i][1]);
/*
* now attempt to open the tape device
*/
sprintf(buffer, "O%s\n%d\n", device, oflag);
if (command(i, buffer) == -1 || status(i) == -1)
return(-1);
return(i);
}
/*
* _rmt_close --- close a remote magtape unit and shut down
*/
static int _rmt_close(fildes)
int fildes;
{
int rc;
if (command(fildes, "C\n") != -1)
{
rc = status(fildes);
abort(fildes);
return(rc);
}
return(-1);
}
/*
* _rmt_read --- read a buffer from a remote tape
*/
static int _rmt_read(fildes, buf, nbyte)
int fildes;
char *buf;
unsigned int nbyte;
{
int rc, i;
char buffer[BUFMAGIC];
sprintf(buffer, "R%d\n", nbyte);
if (command(fildes, buffer) == -1 || (rc = status(fildes)) == -1)
return(-1);
for (i = 0; i < rc; i += nbyte, buf += nbyte)
{
nbyte = read(READ(fildes), buf, rc);
if (nbyte <= 0)
{
abort(fildes);
errno = EIO;
return(-1);
}
}
return(rc);
}
/*
* _rmt_write --- write a buffer to the remote tape
*/
static int _rmt_write(fildes, buf, nbyte)
int fildes;
char *buf;
unsigned int nbyte;
{
int rc;
char buffer[BUFMAGIC];
int (*pstat)();
sprintf(buffer, "W%d\n", nbyte);
if (command(fildes, buffer) == -1)
return(-1);
pstat = signal(SIGPIPE, SIG_IGN);
if (write(WRITE(fildes), buf, nbyte) == nbyte)
{
signal (SIGPIPE, pstat);
return(status(fildes));
}
signal (SIGPIPE, pstat);
abort(fildes);
errno = EIO;
return(-1);
}
/*
* _rmt_lseek --- perform an imitation lseek operation remotely
*/
static long _rmt_lseek(fildes, offset, whence)
int fildes;
long offset;
int whence;
{
char buffer[BUFMAGIC];
sprintf(buffer, "L%d\n%d\n", offset, whence);
if (command(fildes, buffer) == -1)
return(-1);
return(status(fildes));
}
/*
* _rmt_ioctl --- perform raw tape operations remotely
*/
#ifdef RMTIOCTL
static _rmt_ioctl(fildes, op, arg)
int fildes, op;
char *arg;
{
char c;
int rc, cnt;
char buffer[BUFMAGIC];
/*
* MTIOCOP is the easy one. nothing is transfered in binary
*/
if (op == MTIOCTOP)
{
sprintf(buffer, "I%d\n%d\n", ((struct mtop *) arg)->mt_op,
((struct mtop *) arg)->mt_count);
if (command(fildes, buffer) == -1)
return(-1);
return(status(fildes));
}
/*
* we can only handle 2 ops, if not the other one, punt
*/
if (op != MTIOCGET)
{
errno = EINVAL;
return(-1);
}
/*
* grab the status and read it directly into the structure
* this assumes that the status buffer is (hopefully) not
* padded and that 2 shorts fit in a long without any word
* alignment problems, ie - the whole struct is contiguous
* NOTE - this is probably NOT a good assumption.
*/
if (command(fildes, "S\n") == -1 || (rc = status(fildes)) == -1)
return(-1);
for (; rc > 0; rc -= cnt, arg += cnt)
{
cnt = read(READ(fildes), arg, rc);
if (cnt <= 0)
{
abort(fildes);
errno = EIO;
return(-1);
}
}
/*
* now we check for byte position. mt_type is a small integer field
* (normally) so we will check its magnitude. if it is larger than
* 256, we will assume that the bytes are swapped and go through
* and reverse all the bytes
*/
if (((struct mtget *) arg)->mt_type < 256)
return(0);
for (cnt = 0; cnt < rc; cnt += 2)
{
c = arg[cnt];
arg[cnt] = arg[cnt+1];
arg[cnt+1] = c;
}
return(0);
}
#endif /* RMTIOCTL */
/*
* Added routines to replace open(), close(), lseek(), ioctl(), etc.
* The preprocessor can be used to remap these the rmtopen(), etc
* thus minimizing source changes:
*
* #ifdef <something>
* # define access rmtaccess
* # define close rmtclose
* # define creat rmtcreat
* # define dup rmtdup
* # define fcntl rmtfcntl
* # define fstat rmtfstat
* # define ioctl rmtioctl
* # define isatty rmtisatty
* # define lseek rmtlseek
* # define lstat rmtlstat
* # define open rmtopen
* # define read rmtread
* # define stat rmtstat
* # define write rmtwrite
* # define access rmtaccess
* # define close rmtclose
* # define creat rmtcreat
* # define dup rmtdup
* # define fcntl rmtfcntl
* # define fstat rmtfstat
* # define ioctl rmtioctl
* # define lseek rmtlseek
* # define open rmtopen
* # define read rmtread
* # define stat rmtstat
* # define write rmtwrite
* #endif
*
* -- Fred Fish
*
* ADR --- I set up a <rmt.h> include file for this
*
*/
/*
* Note that local vs remote file descriptors are distinquished
* by adding a bias to the remote descriptors. This is a quick
* and dirty trick that may not be portable to some systems.
*/
#define REM_BIAS 128
/*
* Test pathname to see if it is local or remote. A remote device
* is any string that contains ":/dev/". Returns 1 if remote,
* 0 otherwise.
*/
static int remdev (path)
register char *path;
{
#define strchr index
extern char *strchr ();
if ((path = strchr (path, ':')) != NULL)
{
if (strncmp (path + 1, "/dev/", 5) == 0)
{
return (1);
}
}
return (0);
}
/*
* Open a local or remote file. Looks just like open(2) to
* caller.
*/
int rmtopen (path, oflag, mode)
char *path;
int oflag;
int mode;
{
if (remdev (path))
{
return (_rmt_open (path, oflag, mode) + REM_BIAS);
}
else
{
return (open (path, oflag, mode));
}
}
/*
* Test pathname for specified access. Looks just like access(2)
* to caller.
*/
int rmtaccess (path, amode)
char *path;
int amode;
{
if (remdev (path))
{
return (0); /* Let /etc/rmt find out */
}
else
{
return (access (path, amode));
}
}
/*
* Read from stream. Looks just like read(2) to caller.
*/
int rmtread (fildes, buf, nbyte)
int fildes;
char *buf;
unsigned int nbyte;
{
if (isrmt (fildes))
{
return (_rmt_read (fildes - REM_BIAS, buf, nbyte));
}
else
{
return (read (fildes, buf, nbyte));
}
}
/*
* Write to stream. Looks just like write(2) to caller.
*/
int rmtwrite (fildes, buf, nbyte)
int fildes;
char *buf;
unsigned int nbyte;
{
if (isrmt (fildes))
{
return (_rmt_write (fildes - REM_BIAS, buf, nbyte));
}
else
{
return (write (fildes, buf, nbyte));
}
}
/*
* Perform lseek on file. Looks just like lseek(2) to caller.
*/
long rmtlseek (fildes, offset, whence)
int fildes;
long offset;
int whence;
{
if (isrmt (fildes))
{
return (_rmt_lseek (fildes - REM_BIAS, offset, whence));
}
else
{
return (lseek (fildes, offset, whence));
}
}
/*
* Close a file. Looks just like close(2) to caller.
*/
int rmtclose (fildes)
int fildes;
{
if (isrmt (fildes))
{
return (_rmt_close (fildes - REM_BIAS));
}
else
{
return (close (fildes));
}
}
/*
* Do ioctl on file. Looks just like ioctl(2) to caller.
*/
int rmtioctl (fildes, request, arg)
int fildes, request, arg;
{
if (isrmt (fildes))
{
#ifdef RMTIOCTL
return (_rmt_ioctl (fildes, request, arg));
#else
errno = EOPNOTSUPP;
return (-1); /* For now (fnf) */
#endif
}
else
{
return (ioctl (fildes, request, arg));
}
}
/*
* Duplicate an open file descriptor. Looks just like dup(2)
* to caller.
*/
int rmtdup (fildes)
int fildes;
{
if (isrmt (fildes))
{
errno = EOPNOTSUPP;
return (-1); /* For now (fnf) */
}
else
{
return (dup (fildes));
}
}
/*
* Get file status. Looks just like fstat(2) to caller.
*/
int rmtfstat (fildes, buf)
int fildes;
struct stat *buf;
{
if (isrmt (fildes))
{
errno = EOPNOTSUPP;
return (-1); /* For now (fnf) */
}
else
{
return (fstat (fildes, buf));
}
}
/*
* Get file status. Looks just like stat(2) to caller.
*/
int rmtstat (path, buf)
char *path;
struct stat *buf;
{
if (remdev (path))
{
errno = EOPNOTSUPP;
return (-1); /* For now (fnf) */
}
else
{
return (stat (path, buf));
}
}
/*
* Create a file from scratch. Looks just like creat(2) to the caller.
*/
#include <sys/file.h> /* BSD DEPENDANT!!! */
/* #include <fcntl.h> /* use this one for S5 with remote stuff */
int rmtcreat (path, mode)
char *path;
int mode;
{
if (remdev (path))
{
return (rmtopen (path, 1 | O_CREAT, mode));
}
else
{
return (creat (path, mode));
}
}
/*
* Isrmt. Let a programmer know he has a remote device.
*/
int isrmt (fd)
int fd;
{
return (fd >= REM_BIAS);
}
/*
* Rmtfcntl. Do a remote fcntl operation.
*/
int rmtfcntl (fd, cmd, arg)
int fd, cmd, arg;
{
if (isrmt (fd))
{
errno = EOPNOTSUPP;
return (-1);
}
else
{
return (fcntl (fd, cmd, arg));
}
}
/*
* Rmtisatty. Do the isatty function.
*/
int rmtisatty (fd)
int fd;
{
if (isrmt (fd))
return (0);
else
return (isatty (fd));
}
/*
* Get file status, even if symlink. Looks just like lstat(2) to caller.
*/
int rmtlstat (path, buf)
char *path;
struct stat *buf;
{
if (remdev (path))
{
errno = EOPNOTSUPP;
return (-1); /* For now (fnf) */
}
else
{
return (lstat (path, buf));
}
}
SHAR_EOF
fi # end of overwriting check
echo shar: extracting "'rmtops.3'" '(4477 characters)'
if test -f 'rmtops.3'
then
echo shar: will not over-write existing file "'rmtops.3'"
else
cat << \SHAR_EOF > 'rmtops.3'
...
... $Header: rmtops.3,v 1.2 86/10/09 16:38:02 root Locked $
...
... $Log: rmtops.3,v $
... Revision 1.2 86/10/09 16:38:02 root
... Changed to reflect 4.3BSD rcp syntax and better rmt(8) capabilities. ADR.
...
... Revision 1.1 86/10/09 16:18:47 root
... Initial revision
...
...
.TH RMTOPS 3 local
.SH NAME
rmtops \- access tape drives on remote machines
.SH SYNOPSIS
.nf
#include <rmt.h>
#include <sys/stat.h> /* MUST come after <rmt.h> */
int isrmt (fd)
int fd;
int rmtaccess (file, mode)
char *file;
int mode;
int rmtclose (fd)
int fd;
int rmtcreat (file, mode)
char *file;
int mode;
int rmtdup (fd)
int fd;
int rmtfcntl (fd, cmd, arg)
int fd, cmd, arg;
int rmtfstat (fd, buf)
int fd;
struct stat *buf;
int rmtioctl (fd, request, argp)
int fd, request;
char *argp;
int rmtisatty (fd)
int fd;
long rmtlseek (fd, offset, whence)
int fd, whence;
long offset;
int rmtlstat (file, buf)
char *file;
struct stat *buf;
int rmtopen (file, flags [, mode])
char *file;
int flags, mode;
int rmtread (fd, buf, nbytes)
int fd, nbytes;
char *buf;
int rmtstat (file, buf)
char *file;
struct stat *buf;
int rmtwrite (fd, buf, nbytes)
int fd, nbytes;
char *buf;
.fi
.SH DESCRIPTION
.I Rmtops
provides a simple means of transparently accessing tape drives
on remote machines over the ethernet, via
.IR rsh (1)
and
.IR rmt (8).
These routines are used like their corresponding
system calls, but allow the user to open up a tape drive on a remote
system on which he or she has an account and the appropriate remote
permissions.
.PP
A remote tape drive file name has either of the forms
.sp
.RS
.RI [ user @] system :/dev/???
.RE
.sp
or
.sp
.RS
.IR system [. user ]:/dev/???
.RE
.sp
where
.I system
is the remote system,
.I /dev/???
is the particular drive on the remote system (raw, blocked, rewinding,
non-rewinding, etc.), and the optional
.I user
is the login name to be used on the remote system, if different from
the current user's login name.
The first form corresponds to the remote syntax used by
.IR rcp (1)
in 4.3BSD, the second form is for compatibility with
.IR rcp 's
syntax in 4.2BSD.
.PP
For transparency, the user should include the file
.IR <rmt.h> ,
which has the following defines in it:
.PP
.nf
#define access rmtaccess
#define close rmtclose
#define creat rmtcreat
#define dup rmtdup
#define fcntl rmtfcntl
#define fstat rmtfstat
#define ioctl rmtioctl
#define isatty rmtisatty
#define lseek rmtlseek
#define lstat rmtlstat
#define open rmtopen
#define read rmtread
#define stat rmtstat
#define write rmtwrite
.fi
.PP
This allows the programmer to use
.IR open ,
.IR close ,
.IR read ,
.IR write ,
etc. in their normal fashion, with the
.I rmtops
routines taking care of differentiating between local and remote files.
This file should be included
.I before
including the file
.IR <sys/stat.h> ,
since it redefines the identifier ``stat,'' which is used to declare
objects of type struct stat.
.PP
The routines differentiate between local and remote file descriptors by
adding a bias (currently 128) to the file descriptor of the pipe.
The programmer, if he must know if a file is remote, should use the
.I isrmt
function.
.SH FILES
.TP
.B /usr/lib/librmt.a
Contains the remote tape library. To include the library with a program,
add the flag
.B \-lrmt
to the
.IR cc (1)
command line.
.SH SEE ALSO
.IR rcp (1),
.IR rsh (1),
.IR rmt (8),
and the appropriate system calls in section 2.
.SH DIAGNOSTICS
Several of these routines will return -1 and set
.I errno
to EOPNOTSUPP, if they are given a remote file name or a file descriptor
on an open remote file (e.g.,
.IR rmtdup ).
.SH BUGS
See diagnostics above. It is to be hoped that true remote file systems
will eventually appear, and eliminate the need for these routines.
.PP
There is no way to use remote tape drives with the
.IR stdio (3)
package, short of recompiling it entirely to use these routines.
.PP
The
.IR rmt (8)
protocol is not very capable. In particular, it relies on
TCP/IP sockets for error free transmission, and does no data validation
of its own.
.SH AUTHORS
Jeff Lee (gatech!jeff) wrote the original routines for accessing
tape drives via
.IR rmt (8).
.PP
Fred Fish (unisoft!fnf) redid them into a general purpose library.
.PP
Arnold Robbins
(formerly gatech!arnold, now emory!arnold)
added the ability to specify a user
name on the remote system, the
.I <rmt.h>
include file, this man page,
cleaned up the library a little,
and made the appropriate changes for 4.3BSD.
SHAR_EOF
fi # end of overwriting check
echo shar: extracting "'dd.1.patch'" '(1933 characters)'
if test -f 'dd.1.patch'
then
echo shar: will not over-write existing file "'dd.1.patch'"
else
cat << \SHAR_EOF > 'dd.1.patch'
RCS file: RCS/dd.1,v
retrieving revision 1.1
diff -c -r1.1 dd.1
*** /tmp/,RCSt1012245 Thu Oct 9 16:50:49 1986
--- dd.1 Thu Oct 9 16:50:18 1986
***************
*** 1,7 ****
...
! ... $Header: dd.1,v 1.1 86/08/07 16:02:52 root Exp $
...
... $Log: dd.1,v $
... Revision 1.1 86/08/07 16:02:52 root
... Initial revision
...
--- 1,13 ----
...
! ... $Header: dd.1,v 1.3 86/10/09 16:50:02 root Locked $
...
... $Log: dd.1,v $
+ ... Revision 1.3 86/10/09 16:50:02 root
+ ... Changed to indicate use of 4.3 rcp syntax. ADR.
+ ...
+ ... Revision 1.2 86/08/07 16:05:53 root
+ ... Added doc of remote mag tape facility. ADR.
+ ...
... Revision 1.1 86/08/07 16:02:52 root
... Initial revision
...
***************
*** 38,48 ****
.TP
if=
input file name; standard input is default
.br
.ns
.TP
of=
! output file name; standard output is default
.br
.ns
.TP
--- 44,76 ----
.TP
if=
input file name; standard input is default
+ If the input file name has either of the forms
+ .RI [ user @] system :/dev/???,
+ or
+ .IR system [. user ]:/dev/???,
+ then
+ .I dd
+ will attempt to use the tape drive /dev/??? on the remote system
+ .IR system ,
+ via
+ .IR rsh (1),
+ and
+ .IR rmt (8).
+ The optional
+ .I user
+ specifies the login name to use on the remote system.
+ If it is not given, the current user's login name will be used.
+ In all cases, the user must have the appropriate
+ access permissions on the remote machine in order for this to work.
+ (The first form is the 4.3BSD syntax for
+ .IR rcp (1),
+ the second is from 4.2BSD.)
.br
.ns
.TP
of=
! output file name; standard output is default,
! remote file names may be used here as well.
.br
.ns
.TP
***************
*** 233,235 ****
--- 261,265 ----
Invalid combinations
.I "silently ignore"
all but the last mutually-exclusive keyword.
+ .br
+ Using a remote system's tape drive can be slow.
SHAR_EOF
fi # end of overwriting check
echo shar: extracting "'dd.c.patch'" '(871 characters)'
if test -f 'dd.c.patch'
then
echo shar: will not over-write existing file "'dd.c.patch'"
else
cat << \SHAR_EOF > 'dd.c.patch'
RCS file: RCS/dd.c,v
retrieving revision 1.1
diff -c -r1.1 dd.c
*** /tmp/,RCSt1011946 Thu Oct 9 16:44:54 1986
--- dd.c Thu Aug 7 15:55:33 1986
***************
*** 1,9 ****
#ifndef lint
! static char *RCSid = "$Header: dd.c,v 1.1 86/08/07 15:52:39 root Exp $";
#endif
/*
* $Log: dd.c,v $
* Revision 1.1 86/08/07 15:52:39 root
* Initial revision
*
--- 1,12 ----
#ifndef lint
! static char *RCSid = "$Header: dd.c,v 1.2 86/08/07 15:55:17 root Locked $";
#endif
/*
* $Log: dd.c,v $
+ * Revision 1.2 86/08/07 15:55:17 root
+ * Added remote mag tape capability. ADR.
+ *
* Revision 1.1 86/08/07 15:52:39 root
* Initial revision
*
***************
*** 15,20 ****
--- 18,24 ----
#include <stdio.h>
#include <signal.h>
+ #include <rmt.h> /* remote mag tape library */
#define BIG 2147483647
#define LCASE 01
SHAR_EOF
fi # end of overwriting check
echo shar: extracting "'tar.1.patch'" '(2168 characters)'
if test -f 'tar.1.patch'
then
echo shar: will not over-write existing file "'tar.1.patch'"
else
cat << \SHAR_EOF > 'tar.1.patch'
RCS file: RCS/tar.1,v
retrieving revision 1.1
diff -c -r1.1 tar.1
*** /tmp/,RCSt1012257 Thu Oct 9 16:51:06 1986
--- tar.1 Thu Oct 9 16:50:23 1986
***************
*** 1,7 ****
...
! ... $Header: tar.1,v 1.1 86/08/07 16:02:56 root Exp $
...
... $Log: tar.1,v $
... Revision 1.1 86/08/07 16:02:56 root
... Initial revision
...
--- 1,13 ----
...
! ... $Header: tar.1,v 1.3 86/10/09 16:50:19 root Locked $
...
... $Log: tar.1,v $
+ ... Revision 1.3 86/10/09 16:50:19 root
+ ... Changed to indicate use of 4.3 rcp syntax. ADR.
+ ...
+ ... Revision 1.2 86/08/07 16:05:34 root
+ ... Added doc of remote mag tape facility. ADR.
+ ...
... Revision 1.1 86/08/07 16:02:56 root
... Initial revision
...
***************
*** 106,112 ****
.B f
.I Tar
uses the next argument as the name of the archive instead of
! /dev/rmt?. If the name of the file is `\-', tar writes to standard output or
reads from standard input, whichever is appropriate. Thus,
.I tar
can be used as the head or tail of a filter chain.
--- 112,142 ----
.B f
.I Tar
uses the next argument as the name of the archive instead of
! /dev/rmt?.
! .sp
! If the file name has either of the forms
! .RI [ user @] system :/dev/???,
! or
! .IR system [. user ]:/dev/???,
! .I tar
! will use the tape drive /dev/??? on the remote system
! .IR system ,
! via
! .IR rsh (1),
! and
! .IR rmt (8).
! The optional
! .I user
! portion of the pathname specifies the login name to use on the
! remote system.
! If it is not supplied, the current user's login name will be used.
! In all the cases, the user must have the appropriate
! permissions on the remote machine, in order to use this facility.
! (The first form is the 4.3BSD syntax for
! .IR rcp (1),
! the second is from 4.2BSD.)
! .sp
! If the name of the file is `\-', tar writes to standard output or
reads from standard input, whichever is appropriate. Thus,
.I tar
can be used as the head or tail of a filter chain.
***************
*** 199,201 ****
--- 229,233 ----
or
.B u
options, directory modification times may not be set correctly.
+ .br
+ Using a remote system's tape drive can be slow.
SHAR_EOF
fi # end of overwriting check
echo shar: extracting "'tar.c.patch'" '(911 characters)'
if test -f 'tar.c.patch'
then
echo shar: will not over-write existing file "'tar.c.patch'"
else
cat << \SHAR_EOF > 'tar.c.patch'
RCS file: RCS/tar.c,v
retrieving revision 1.1
diff -c -r1.1 tar.c
*** /tmp/,RCSt1011918 Thu Oct 9 16:44:38 1986
--- tar.c Thu Aug 7 16:00:55 1986
***************
*** 1,9 ****
#ifndef lint
! static char *RCSid = "$Header: tar.c,v 1.1 86/08/07 15:52:50 root Exp $";
#endif
/*
* $Log: tar.c,v $
* Revision 1.1 86/08/07 15:52:50 root
* Initial revision
*
--- 1,12 ----
#ifndef lint
! static char *RCSid = "$Header: tar.c,v 1.2 86/08/07 16:00:34 root Locked $";
#endif
/*
* $Log: tar.c,v $
+ * Revision 1.2 86/08/07 16:00:34 root
+ * Added remote mag tape capability. ADR.
+ *
* Revision 1.1 86/08/07 15:52:50 root
* Initial revision
*
***************
*** 29,34 ****
--- 32,38 ----
* Tape Archival Program
*/
#include <stdio.h>
+ #include <rmt.h> /* remote mag tape library */
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/dir.h>
SHAR_EOF
fi # end of overwriting check
# End of shell archive
exit 0
More information about the Mod.sources
mailing list