summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/DISTFILES1
-rw-r--r--lib/rmt.h6
-rw-r--r--lib/rtapelib.c18
-rw-r--r--lib/system.h110
4 files changed, 89 insertions, 46 deletions
diff --git a/lib/DISTFILES b/lib/DISTFILES
index 6d310f4..65bab61 100644
--- a/lib/DISTFILES
+++ b/lib/DISTFILES
@@ -1,4 +1,3 @@
rmt.h
rtapelib.c
system.h
-system-ioctl.h
diff --git a/lib/rmt.h b/lib/rmt.h
index 50f037c..1fd2f29 100644
--- a/lib/rmt.h
+++ b/lib/rmt.h
@@ -1,11 +1,11 @@
/* Definitions for communicating with a remote tape drive.
- Copyright (C) 1988, 1992, 1996, 1997, 2001, 2003, 2004, 2007 Free
+ Copyright (C) 1988, 1992, 1996, 1997, 2001, 2003, 2004 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 3, or (at your option)
+ 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,
@@ -15,7 +15,7 @@
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
extern char *rmt_command;
extern char *rmt_dev_name__;
diff --git a/lib/rtapelib.c b/lib/rtapelib.c
index 51faf3c..0e499b6 100644
--- a/lib/rtapelib.c
+++ b/lib/rtapelib.c
@@ -1,11 +1,11 @@
/* Functions for communicating with a remote tape drive.
- Copyright (C) 1988, 1992, 1994, 1996, 1997, 1999, 2000, 2001, 2004,
- 2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright 1988, 1992, 1994, 1996, 1997, 1999, 2000, 2001, 2004 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 3, or (at your option)
+ 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,
@@ -15,7 +15,7 @@
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* 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*.
@@ -33,8 +33,6 @@
code, courtesy of Dan Kegel. */
#include "system.h"
-#include "system-ioctl.h"
-
#include <safe-read.h>
#include <full-write.h>
@@ -60,7 +58,7 @@
#endif
#include <rmt.h>
-#include <rmt-command.h>
+#include <localedir.h>
/* Exit status if exec errors. */
#define EXIT_ON_EXEC_ERROR 128
@@ -342,7 +340,9 @@ encode_oflag (char *buf, int oflag)
#ifdef O_NOCTTY
if (oflag & O_NOCTTY) strcat (buf, "|O_NOCTTY");
#endif
+#ifdef O_NONBLOCK
if (oflag & O_NONBLOCK) strcat (buf, "|O_NONBLOCK");
+#endif
#ifdef O_RSYNC
if (oflag & O_RSYNC) strcat (buf, "|O_RSYNC");
#endif
@@ -358,7 +358,7 @@ encode_oflag (char *buf, int oflag)
remote pipe number plus BIAS. REMOTE_SHELL may be overridden. On
error, return -1. */
int
-rmt_open__ (const char *file_name, int open_mode, int bias,
+rmt_open__ (const char *file_name, int open_mode, int bias,
const char *remote_shell)
{
int remote_pipe_number; /* pseudo, biased file descriptor */
@@ -461,7 +461,7 @@ rmt_open__ (const char *file_name, int open_mode, int bias,
return -1;
#endif
}
- remote_shell_basename = last_component (remote_shell);
+ remote_shell_basename = base_name (remote_shell);
/* Set up the pipes for the `rsh' command, and fork. */
diff --git a/lib/system.h b/lib/system.h
index 2deb585..0914195 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -1,11 +1,11 @@
/* System dependent definitions for GNU tar.
Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003,
- 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ 2004 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 3, or (at your option)
+ 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,
@@ -15,7 +15,8 @@
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
#if HAVE_CONFIG_H
# include <config.h>
@@ -108,19 +109,10 @@ extern int errno;
#ifndef O_TRUNC
# define O_TRUNC 32 /* truncate file on open */
#endif
-
-#ifndef O_BINARY
+ /* MS-DOG forever, with my love! */
+#ifndef O_BINARY
# define O_BINARY 0
#endif
-#ifndef O_DIRECTORY
-# define O_DIRECTORY 0
-#endif
-#ifndef O_NOATIME
-# define O_NOATIME 0
-#endif
-#ifndef O_NONBLOCK
-# define O_NONBLOCK 0
-#endif
/* Declare file status routines and bits. */
@@ -260,7 +252,9 @@ extern int errno;
#define MODE_ALL (S_ISUID | S_ISGID | S_ISVTX | MODE_RWX)
/* Include <unistd.h> before any preprocessor test of _POSIX_VERSION. */
-#include <unistd.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#ifndef SEEK_SET
# define SEEK_SET 0
@@ -288,9 +282,6 @@ extern int errno;
#if MAJOR_IN_MKDEV
# include <sys/mkdev.h>
-# if !defined(makedev) && defined(mkdev)
-# define makedev(a,b) mkdev((a),(b))
-# endif
# define GOT_MAJOR
#endif
@@ -386,12 +377,45 @@ extern int errno;
#endif
#ifndef ST_NBLOCKSIZE
-# define ST_NBLOCKSIZE 512
+#define ST_NBLOCKSIZE 512
#endif
-#define ST_IS_SPARSE(st) \
- (ST_NBLOCKS (st) \
- < ((st).st_size / ST_NBLOCKSIZE + ((st).st_size % ST_NBLOCKSIZE != 0)))
+/* This is a real challenge to properly get MTIO* symbols :-(. ISC uses
+ <sys/gentape.h>. SCO and BSDi uses <sys/tape.h>; BSDi also requires
+ <sys/tprintf.h> and <sys/device.h> for defining tp_dev and tpr_t. It
+ seems that the rest use <sys/mtio.h>, which itself requires other files,
+ depending on systems. Pyramid defines _IOW in <sgtty.h>, for example. */
+
+#if HAVE_SYS_GENTAPE_H
+# include <sys/gentape.h>
+#else
+# if HAVE_SYS_TAPE_H
+# if HAVE_SYS_DEVICE_H
+# include <sys/device.h>
+# endif
+# if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+# endif
+# if HAVE_SYS_BUF_H
+# include <sys/buf.h>
+# endif
+# if HAVE_SYS_TPRINTF_H
+# include <sys/tprintf.h>
+# endif
+# include <sys/tape.h>
+# else
+# if HAVE_SYS_MTIO_H
+# include <sys/ioctl.h>
+# if HAVE_SGTTY_H
+# include <sgtty.h>
+# endif
+# if HAVE_SYS_IO_TRIOCTL_H
+# include <sys/io/trioctl.h>
+# endif
+# include <sys/mtio.h>
+# endif
+# endif
+#endif
/* Declare standard functions. */
@@ -411,6 +435,7 @@ char *getenv ();
#endif
#if WITH_DMALLOC
+# undef HAVE_DECL_VALLOC
# define DMALLOC_FUNC_CHECK
# include <dmalloc.h>
#endif
@@ -421,11 +446,28 @@ char *getenv ();
# define MB_LEN_MAX 1
#endif
-#include <inttypes.h>
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
+/* These macros work even on ones'-complement hosts (!).
+ The extra casts work around common compiler bugs. */
+#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+#define TYPE_MINIMUM(t) (TYPE_SIGNED (t) \
+ ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
+ : (t) 0)
+#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
-#include <intprops.h>
+/* Bound on length of the string representing an integer value of type t.
+ Subtract one for the sign bit if t is signed;
+ 302 / 1000 is log10 (2) rounded up;
+ add one for integer division truncation;
+ add one more for a minus sign if t is signed. */
+#define INT_STRLEN_BOUND(t) \
+ ((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 1000 \
+ + 1 + TYPE_SIGNED (t))
-#define UINTMAX_STRSIZE_BOUND INT_BUFSIZE_BOUND (uintmax_t)
+#define UINTMAX_STRSIZE_BOUND (INT_STRLEN_BOUND (uintmax_t) + 1)
/* Prototypes for external functions. */
@@ -437,9 +479,16 @@ char *getenv ();
#endif
#include <time.h>
-#ifdef TIME_WITH_SYS_TIME
+#if defined(HAVE_SYS_TIME_H) && defined(TIME_WITH_SYS_TIME)
# include <sys/time.h>
#endif
+#if ! HAVE_DECL_TIME
+time_t time ();
+#endif
+
+#ifdef HAVE_UTIME_H
+# include <utime.h>
+#endif
/* Library modules. */
@@ -453,13 +502,6 @@ char *getenv ();
#define _(msgid) gettext (msgid)
#define N_(msgid) msgid
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-#ifdef HAVE_GRP_H
-# include <grp.h>
-#endif
-
#if MSDOS
# include <process.h>
# define SET_BINARY_MODE(arc) setmode(arc, O_BINARY)
@@ -468,6 +510,8 @@ char *getenv ();
# define TTY_NAME "con"
# define sys_reset_uid_gid()
#else
+# include <pwd.h>
+# include <grp.h>
# define SET_BINARY_MODE(arc)
# define ERRNO_IS_EACCES 0
# define TTY_NAME "/dev/tty"