summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/tar
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2001-02-18 17:30:29 +0000
committerume <ume@FreeBSD.org>2001-02-18 17:30:29 +0000
commit3b9f9179f5c6f2ecbbcb3ad8e77a6c516ef9735a (patch)
treef906a318c89cd6bf2ff97a37f4054b184998b4ff /gnu/usr.bin/tar
parent548e16646ad1b2c4238bf0ca29ed5c33e1efff74 (diff)
downloadFreeBSD-src-3b9f9179f5c6f2ecbbcb3ad8e77a6c516ef9735a.zip
FreeBSD-src-3b9f9179f5c6f2ecbbcb3ad8e77a6c516ef9735a.tar.gz
Introduce $TAR_RSH to enable use of ssh as transport.
Diffstat (limited to 'gnu/usr.bin/tar')
-rw-r--r--gnu/usr.bin/tar/Makefile2
-rw-r--r--gnu/usr.bin/tar/rtapelib.c31
-rw-r--r--gnu/usr.bin/tar/tar.14
3 files changed, 28 insertions, 9 deletions
diff --git a/gnu/usr.bin/tar/Makefile b/gnu/usr.bin/tar/Makefile
index ea5e269..bb6fb47 100644
--- a/gnu/usr.bin/tar/Makefile
+++ b/gnu/usr.bin/tar/Makefile
@@ -8,7 +8,7 @@ CFLAGS+= -DRETSIGTYPE=void -DDIRENT=1 -DHAVE_SYS_MTIO_H=1 -DHAVE_UNISTD_H=1
CFLAGS+= -DHAVE_GETGRGID=1 -DHAVE_GETPWUID=1 -DHAVE_STRING_H=1
CFLAGS+= -DHAVE_LIMITS_H=1 -DHAVE_STRSTR=1 -DHAVE_VALLOC=1 -DHAVE_MKDIR=1
CFLAGS+= -DHAVE_MKNOD=1 -DHAVE_RENAME=1 -DHAVE_FTRUNCATE=1 -DHAVE_GETCWD=1
-CFLAGS+= -DBSD42=1 -DHAVE_VPRINTF=1 -DNEEDPAD -I${.CURDIR}
+CFLAGS+= -DBSD42=1 -DHAVE_VPRINTF=1 -DNEEDPAD -DSTDC_HEADERS=1 -I${.CURDIR}
CFLAGS+= -DDEF_AR_FILE=\"/dev/sa0\" -DDEFBLOCKING=20
YFLAGS=
NOSHARED?=yes
diff --git a/gnu/usr.bin/tar/rtapelib.c b/gnu/usr.bin/tar/rtapelib.c
index 0c23b06..67fc919 100644
--- a/gnu/usr.bin/tar/rtapelib.c
+++ b/gnu/usr.bin/tar/rtapelib.c
@@ -31,6 +31,8 @@
Modified to make all rmtXXX calls into macros for speed by Jay Fenlason.
Use -DHAVE_NETDB_H for rexec code, courtesy of Dan Kegel, srs!dan. */
+/* $FreeBSD$ */
+
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>
@@ -276,6 +278,7 @@ __rmt_open (path, oflag, mode, bias)
char device[CMDBUFSIZE]; /* The remote device name. */
char login[CMDBUFSIZE]; /* The remote user name. */
char *sys, *dev, *user; /* For copying into the above buffers. */
+ char *tar_rsh;
sys = system;
dev = device;
@@ -370,19 +373,31 @@ __rmt_open (path, oflag, mode, bias)
setuid (getuid ());
setgid (getgid ());
+ tar_rsh = getenv("TAR_RSH");
+
if (*login)
{
- execl ("/usr/bin/rsh", "rsh", "-l", login, system,
- "/etc/rmt", (char *) 0);
- execlp ("rsh", "rsh", "-l", login, system,
- "/etc/rmt", (char *) 0);
+ if (tar_rsh) {
+ execlp (tar_rsh, tar_rsh, "-l", login, system,
+ "/etc/rmt", (char *) 0);
+ } else {
+ execl ("/usr/bin/rsh", "rsh", "-l", login, system,
+ "/etc/rmt", (char *) 0);
+ execlp ("rsh", "rsh", "-l", login, system,
+ "/etc/rmt", (char *) 0);
+ }
}
else
{
- execl ("/usr/bin/rsh", "rsh", system,
- "/etc/rmt", (char *) 0);
- execlp ("rsh", "rsh", system,
- "/etc/rmt", (char *) 0);
+ if (tar_rsh) {
+ execlp (tar_rsh, tar_rsh, system,
+ "/etc/rmt", (char *) 0);
+ } else {
+ execl ("/usr/bin/rsh", "rsh", system,
+ "/etc/rmt", (char *) 0);
+ execlp ("rsh", "rsh", system,
+ "/etc/rmt", (char *) 0);
+ }
}
/* Bad problems if we get here. */
diff --git a/gnu/usr.bin/tar/tar.1 b/gnu/usr.bin/tar/tar.1
index ca62490..75b3e3a 100644
--- a/gnu/usr.bin/tar/tar.1
+++ b/gnu/usr.bin/tar/tar.1
@@ -483,6 +483,10 @@ Changes
default tape drive (which is still overridden by the
.Fl f
flag).
+.It TAR_RSH
+The TAR_RSH environment variable allows you to override the default
+shell used as the transport for
+.Nm tar.
.El
.Sh FILES
.Bl -tag -width "/dev/sa0"
OpenPOWER on IntegriCloud