*** empty log message ***

This commit is contained in:
François Pinard
1994-11-16 02:45:21 +00:00
parent 42d9112d1e
commit d3fdd8259b
2 changed files with 106 additions and 3 deletions

View File

@@ -25,8 +25,6 @@ char copyright[] =
static char sccsid[] = "@(#)rmt.c 5.4 (Berkeley) 6/29/88";
#endif /* not lint */
/* JF added #ifdef about SO_RCVBUF in attempt to make this run on more
machines. Maybe it'll work */
/*
* rmt
*/
@@ -34,7 +32,11 @@ static char sccsid[] = "@(#)rmt.c 5.4 (Berkeley) 6/29/88";
#include <sgtty.h>
#include <sys/types.h>
#include <sys/socket.h>
#ifdef GENTAPE /* e.g. ISC UNIX */
#include <sys/gentape.h>
#else
#include <sys/mtio.h>
#endif
#include <errno.h>
#if defined (i386) && defined (AIX)
@@ -167,6 +169,7 @@ top:
case 'I':
getstring(op); getstring(count);
DEBUG2("rmtd: I %s %s\n", op, count);
#ifdef MTIOCTOP
{ struct mtop mtop;
mtop.mt_op = atoi(op);
mtop.mt_count = atoi(count);
@@ -174,17 +177,21 @@ top:
goto ioerror;
rval = mtop.mt_count;
}
#endif
goto respond;
case 'S': /* status */
DEBUG("rmtd: S\n");
{ struct mtget mtget;
{
#ifdef MTIOCGET
struct mtget mtget;
if (ioctl(tape, MTIOCGET, (char *)&mtget) < 0)
goto ioerror;
rval = sizeof (mtget);
(void) sprintf(resp, "A%d\n", rval);
(void) write(1, resp, strlen(resp));
(void) write(1, (char *)&mtget, sizeof (mtget));
#endif
goto top;
}

96
src/rmt.h Normal file
View File

@@ -0,0 +1,96 @@
/* Definitions for communicating with a remote tape drive.
Copyright (C) 1988, 1992 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if !defined(_POSIX_VERSION)
#ifdef __MSDOS__
#include <io.h>
#else /* !__MSDOS__ */
extern off_t lseek();
#endif /* __MSDOS__ */
#endif /* _POSIX_VERSION */
#ifdef NO_REMOTE
#define _isrmt(f) 0
#define rmtopen open
#define rmtaccess access
#define rmtstat stat
#define rmtcreat creat
#define rmtlstat lstat
#define rmtread read
#define rmtwrite write
#define rmtlseek lseek
#define rmtclose close
#define rmtioctl ioctl
#define rmtdup dup
#define rmtfstat fstat
#define rmtfcntl fcntl
#define rmtisatty isatty
#else /* !NO_REMOTE */
#define __REM_BIAS 128
#define RMTIOCTL
#ifndef O_CREAT
#define O_CREAT 01000
#endif
extern char *__rmt_path;
#if defined(USG) || defined(STDC_HEADERS)
#include <string.h>
#define index strchr
#else
extern char *index();
#endif
#define _remdev(path) (!f_force_local && __rmt_path=index(path, ':'))
#define _isrmt(fd) ((fd) >= __REM_BIAS)
#define rmtopen(path,oflag,mode) (_remdev(path) ? __rmt_open(path, oflag, mode, __REM_BIAS) : open(path, oflag, mode))
#define rmtaccess(path, amode) (_remdev(path) ? 0 : access(path, amode))
#define rmtstat(path, buf) (_remdev(path) ? (errno = EOPNOTSUPP), -1 : stat(path, buf))
#define rmtcreat(path, mode) (_remdev(path) ? __rmt_open (path, 1 | O_CREAT, mode, __REM_BIAS) : creat(path, mode))
#define rmtlstat(path,buf) (_remdev(path) ? (errno = EOPNOTSUPP), -1 : lstat(path,buf))
#define rmtread(fd, buf, n) (_isrmt(fd) ? __rmt_read(fd - __REM_BIAS, buf, n) : read(fd, buf, n))
#define rmtwrite(fd, buf, n) (_isrmt(fd) ? __rmt_write(fd - __REM_BIAS, buf, n) : write(fd, buf, n))
#define rmtlseek(fd, off, wh) (_isrmt(fd) ? __rmt_lseek(fd - __REM_BIAS, off, wh) : lseek(fd, off, wh))
#define rmtclose(fd) (_isrmt(fd) ? __rmt_close(fd - __REM_BIAS) : close(fd))
#ifdef RMTIOCTL
#define rmtioctl(fd,req,arg) (_isrmt(fd) ? __rmt_ioctl(fd - __REM_BIAS, req, arg) : ioctl(fd, req, arg))
#else
#define rmtioctl(fd,req,arg) (_isrmt(fd) ? (errno = EOPNOTSUPP), -1 : ioctl(fd, req, arg))
#endif
#define rmtdup(fd) (_isrmt(fd) ? (errno = EOPNOTSUPP), -1 : dup(fd))
#define rmtfstat(fd, buf) (_isrmt(fd) ? (errno = EOPNOTSUPP), -1 : fstat(fd, buf))
#define rmtfcntl(fd,cmd,arg) (_isrmt(fd) ? (errno = EOPNOTSUPP), -1 : fcntl (fd, cmd, arg))
#define rmtisatty(fd) (_isrmt(fd) ? 0 : isatty(fd))
#undef RMTIOCTL
int __rmt_open ();
int __rmt_close ();
int __rmt_read ();
int __rmt_write ();
long __rmt_lseek();
int __rmt_ioctl ();
#endif /* !NO_REMOTE */