home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / g / gtak212.zip / 1.10 / rmt.h < prev    next >
C/C++ Source or Header  |  1992-09-02  |  4KB  |  110 lines

  1. /*****************************************************************************
  2.  * $Id: rmt.h,v 1.2 1992/09/02 20:08:45 ak Exp $
  3.  *****************************************************************************
  4.  * $Log: rmt.h,v $
  5.  * Revision 1.2  1992/09/02  20:08:45  ak
  6.  * Version AK200
  7.  * - Tape access
  8.  * - Quick file access
  9.  * - OS/2 extended attributes
  10.  * - Some OS/2 fixes
  11.  * - Some fixes of Kai Uwe Rommel
  12.  *
  13.  * Revision 1.1.1.1  1992/09/02  19:22:36  ak
  14.  * Original GNU Tar 1.10 with some filenames changed for FAT compatibility.
  15.  *
  16.  * Revision 1.1  1992/09/02  19:22:35  ak
  17.  * Initial revision
  18.  *
  19.  *****************************************************************************/
  20.  
  21. /*
  22.  * Modified by Andreas Kaiser July 92.
  23.  * See CHANGES.AK for info.
  24.  */
  25.  
  26. /* Remote tape drive defines for tar.
  27.    Copyright (C) 1988 Free Software Foundation
  28.  
  29. This file is part of GNU Tar.
  30.  
  31. GNU Tar is free software; you can redistribute it and/or modify
  32. it under the terms of the GNU General Public License as published by
  33. the Free Software Foundation; either version 1, or (at your option)
  34. any later version.
  35.  
  36. GNU Tar is distributed in the hope that it will be useful,
  37. but WITHOUT ANY WARRANTY; without even the implied warranty of
  38. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  39. GNU General Public License for more details.
  40.  
  41. You should have received a copy of the GNU General Public License
  42. along with GNU Tar; see the file COPYING.  If not, write to
  43. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  44.  
  45. #ifdef NO_REMOTE
  46. #define _isrmt(f)    0
  47. #define rmtopen        open
  48. #define rmtaccess    access
  49. #define rmtstat        stat
  50. #define rmtcreat    creat
  51. #define rmtlstat    lstat
  52. #define rmtread        read
  53. #define rmtwrite    write
  54. #define rmtlseek    lseek
  55. #define rmtclose    close
  56. #define rmtioctl    ioctl
  57. #define rmtdup        dup
  58. #define rmtfstat    fstat
  59. #define rmtfcntl    fcntl
  60. #define rmtisatty    isatty
  61.  
  62. extern long lseek();
  63. #else
  64. #ifndef USG
  65. #define strchr index
  66. #endif
  67.  
  68. #define __REM_BIAS    128
  69. #define RMTIOCTL
  70.  
  71. #ifndef O_CREAT
  72. #define O_CREAT    01000
  73. #endif
  74. extern char *__rmt_path;
  75. /* extern char *strchr(); */
  76.  
  77. #ifdef TAPE_IO
  78. # define _isdisk(path)    (isalpha(path[0]) && path[1]==':' && !path[2])
  79. # define _remdev(path)    (strchr(path, '+') || _isdisk(path))
  80. #else
  81. # define _remdev(path)    ((__rmt_path=strchr(path, ':')) && strncmp(__rmt_path, ":/dev/", 6)==0)
  82. #endif
  83. #define _isrmt(fd)        ((fd) >= __REM_BIAS)
  84.  
  85. extern long __rmt_lseek(); /*AK*/
  86.  
  87. #define rmtopen(path,oflag,mode) (_remdev(path) ? __rmt_open(path, oflag, mode, __REM_BIAS) : open(path, oflag, mode))
  88. #define rmtaccess(path, amode)    (_remdev(path) ? 0 : access(path, amode))
  89. #define rmtstat(path, buf)    (_remdev(path) ? (errno = EOPNOTSUPP), -1 : stat(path, buf))
  90. #define rmtcreat(path, mode)    (_remdev(path) ? __rmt_open (path, O_WRONLY|O_CREAT|O_BINARY, mode, __REM_BIAS) : creat(path, mode))
  91. #define rmtlstat(path,buf)    (_remdev(path) ? (errno = EOPNOTSUPP), -1 : lstat(path,buf))
  92.  
  93. #define rmtread(fd, buf, n)    (_isrmt(fd) ? __rmt_read(fd - __REM_BIAS, buf, n) : read(fd, buf, n))
  94. #define rmtwrite(fd, buf, n)    (_isrmt(fd) ? __rmt_write(fd - __REM_BIAS, buf, n) : write(fd, buf, n))
  95. #define rmtlseek(fd, off, wh)    (_isrmt(fd) ? __rmt_lseek(fd - __REM_BIAS, off, wh) : lseek(fd, off, wh))
  96. #define rmtclose(fd)        (_isrmt(fd) ? __rmt_close(fd - __REM_BIAS) : close(fd))
  97. #ifdef RMTIOCTL
  98. #define rmtioctl(fd,req,arg)    (_isrmt(fd) ? __rmt_ioctl(fd - __REM_BIAS, req, arg) : ioctl(fd, req, arg))
  99. #else
  100. #define rmtioctl(fd,req,arg)    (_isrmt(fd) ? (errno = EOPNOTSUPP), -1 : ioctl(fd, req, arg))
  101. #endif
  102. #define rmtdup(fd)        (_isrmt(fd) ? (errno = EOPNOTSUPP), -1 : dup(fd))
  103. #define rmtfstat(fd, buf)    (_isrmt(fd) ? (errno = EOPNOTSUPP), -1 : fstat(fd, buf))
  104. #define rmtfcntl(fd,cmd,arg)    (_isrmt(fd) ? (errno = EOPNOTSUPP), -1 : fcntl (fd, cmd, arg))
  105. #define rmtisatty(fd)        (_isrmt(fd) ? 0 : isatty(fd))
  106.  
  107. #undef RMTIOCTL
  108. extern long lseek(),__rmt_lseek();
  109. #endif
  110.