]> Dogcows Code - chaz/tar/blobdiff - src/rmt.h
Remove some lint caught by gcc -Wall -W, etc.
[chaz/tar] / src / rmt.h
index f130eb2faed353107810e10cd5539d677941a91c..5e20ffd522506f6b173943bcf22e3cde069f8952 100644 (file)
--- a/src/rmt.h
+++ b/src/rmt.h
@@ -1,5 +1,7 @@
 /* Definitions for communicating with a remote tape drive.
-   Copyright (C) 1988, 1992, 1996, 1997 Free Software Foundation, Inc.
+
+   Copyright (C) 1988, 1992, 1996, 1997, 2001, 2003 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
 
 extern char *rmt_path__;
 
-int rmt_open__ PARAMS ((const char *, int, int, const char *));
-int rmt_close__ PARAMS ((int));
-int rmt_read__ PARAMS ((int, char *, unsigned int));
-int rmt_write__ PARAMS ((int, char *, unsigned int));
-long rmt_lseek__ PARAMS ((int, off_t, int));
-int rmt_ioctl__ PARAMS ((int, int, char *));
+int rmt_open__ (const char *, int, int, const char *);
+int rmt_close__ (int);
+ssize_t rmt_read__ (int, char *, size_t);
+ssize_t rmt_write__ (int, char *, size_t);
+off_t rmt_lseek__ (int, off_t, int);
+int rmt_ioctl__ (int, int, char *);
 
-/* A filename is remote if it contains a colon not preceeded by a slash,
+/* A filename is remote if it contains a colon not preceded by a slash,
    to take care of `/:/' which is a shorthand for `/.../<CELL-NAME>/fs'
    on machines running OSF's Distributing Computing Environment (DCE) and
    Distributed File System (DFS).  However, when --force-local, a
@@ -32,12 +34,12 @@ int rmt_ioctl__ PARAMS ((int, int, char *));
 
 #define _remdev(Path) \
   (!force_local_option && (rmt_path__ = strchr (Path, ':')) \
-   && rmt_path__ > (Path) && rmt_path__[-1] != '/')
+   && rmt_path__ > (Path) && ! memchr (Path, rmt_path__ - (Path), '/'))
 
 #define _isrmt(Fd) \
   ((Fd) >= __REM_BIAS)
 
-#define __REM_BIAS 128
+#define __REM_BIAS (1 << 30)
 
 #ifndef O_CREAT
 # define O_CREAT 01000
@@ -52,7 +54,6 @@ int rmt_ioctl__ PARAMS ((int, int, char *));
 
 #define rmtstat(Path, Buffer) \
   (_remdev (Path) ? (errno = EOPNOTSUPP), -1 : stat (Path, Buffer))
-                               /* FIXME: errno should be read-only */
 
 #define rmtcreat(Path, Mode, Command) \
    (_remdev (Path) \
@@ -61,15 +62,14 @@ int rmt_ioctl__ PARAMS ((int, int, char *));
 
 #define rmtlstat(Path, Buffer) \
   (_remdev (Path) ? (errno = EOPNOTSUPP), -1 : lstat (Path, Buffer))
-                               /* FIXME: errno should be read-only */
 
 #define rmtread(Fd, Buffer, Length) \
   (_isrmt (Fd) ? rmt_read__ (Fd - __REM_BIAS, Buffer, Length) \
-   : read (Fd, Buffer, Length))
+   : safe_read (Fd, Buffer, Length))
 
 #define rmtwrite(Fd, Buffer, Length) \
   (_isrmt (Fd) ? rmt_write__ (Fd - __REM_BIAS, Buffer, Length) \
-   : write (Fd, Buffer, Length))
+   : full_write (Fd, Buffer, Length))
 
 #define rmtlseek(Fd, Offset, Where) \
   (_isrmt (Fd) ? rmt_lseek__ (Fd - __REM_BIAS, Offset, Where) \
@@ -84,15 +84,12 @@ int rmt_ioctl__ PARAMS ((int, int, char *));
 
 #define rmtdup(Fd) \
   (_isrmt (Fd) ? (errno = EOPNOTSUPP), -1 : dup (Fd))
-                               /* FIXME: errno should be read-only */
 
 #define rmtfstat(Fd, Buffer) \
   (_isrmt (Fd) ? (errno = EOPNOTSUPP), -1 : fstat (Fd, Buffer))
-                               /* FIXME: errno should be read-only */
 
 #define rmtfcntl(Fd, Command, Argument) \
   (_isrmt (Fd) ? (errno = EOPNOTSUPP), -1 : fcntl (Fd, Command, Argument))
-                               /* FIXME: errno should be read-only */
 
 #define rmtisatty(Fd) \
   (_isrmt (Fd) ? 0 : isatty (Fd))
This page took 0.024169 seconds and 4 git commands to generate.