🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Jonathan I. Kamens Mon, 14 Dec 1992 08:46
Add "--rsh-command" option to GNU tar
#1180
Author: Jonathan I. Kamens
Date: Mon, 14 Dec 1992 08:46
231 lines
7750 bytes
It is sometimes necessary to use a different rsh command than the
standard system one, e.g., to use Kerberos rsh.  These patches (unless
I've screwed up) add a "--rsh-command" command-line to specify this.

Jonathan Kamens                                         jik@MIT.Edu
MIT Information Systems/Athena              Moderator, news.answers

*** 1.1	1992/12/14 18:37:41
--- buffer.c	1992/12/14 18:38:53
***************
*** 368,378 ****
  				else
  					archive = STDOUT;
  			} else /* This can't happen if (ar_reading==2)
! 				archive = rmtopen(ar_files[0], O_RDWR|O_CREAT|O_BINARY, 0666);
  			else */if(ar_reading)
! 				archive = rmtopen(ar_files[0], O_RDONLY|O_BINARY, 0666);
  			else
! 				archive = rmtcreat(ar_files[0], 0666);
  
  			if (archive < 0) {
  				msg_perror("can't open archive %s",ar_files[0]);
--- 368,379 ----
  				else
  					archive = STDOUT;
  			} else /* This can't happen if (ar_reading==2)
! 				archive = rmtopen(ar_files[0], O_RDWR|O_CREAT|O_BINARY, 0666, f_rsh_command);
  			else */if(ar_reading)
! 				archive = rmtopen(ar_files[0], O_RDONLY|O_BINARY, 0666, f_rsh_command);
  			else
! 				archive = rmtcreat(ar_files[0], 0666,
! 						   f_rsh_command);
  
  			if (archive < 0) {
  				msg_perror("can't open archive %s",ar_files[0]);
***************
*** 551,561 ****
  			msg_file = stderr;
  		}
  	} else if (reading==2 || f_verify) {
! 		archive = rmtopen(ar_files[0], O_RDWR|O_CREAT|O_BINARY, 0666);
  	} else if(reading) {
! 		archive = rmtopen(ar_files[0], O_RDONLY|O_BINARY, 0666);
  	} else {
! 		archive = rmtcreat(ar_files[0], 0666);
  	}
  	if (archive < 0) {
  		msg_perror("can't open %s",ar_files[0]);
--- 552,564 ----
  			msg_file = stderr;
  		}
  	} else if (reading==2 || f_verify) {
! 		archive = rmtopen(ar_files[0], O_RDWR|O_CREAT|O_BINARY, 0666,
! 				  f_rsh_command);
  	} else if(reading) {
! 		archive = rmtopen(ar_files[0], O_RDONLY|O_BINARY, 0666,
! 				  f_rsh_command);
  	} else {
! 		archive = rmtcreat(ar_files[0], 0666, f_rsh_command);
  	}
  	if (archive < 0) {
  		msg_perror("can't open %s",ar_files[0]);
***************
*** 1362,1372 ****
  	
  
  	if(type==2 || f_verify)
! 		archive=rmtopen(ar_files[cur_ar_file],O_RDWR|O_CREAT,0666);
  	else if(type==1)
! 		archive=rmtopen(ar_files[cur_ar_file],O_RDONLY,0666);
  	else if(type==0)
! 		archive=rmtcreat(ar_files[cur_ar_file],0666);
  	else
  		archive= -1;
  
--- 1365,1377 ----
  	
  
  	if(type==2 || f_verify)
! 		archive=rmtopen(ar_files[cur_ar_file],O_RDWR|O_CREAT,0666,
! 				f_rsh_command);
  	else if(type==1)
! 		archive=rmtopen(ar_files[cur_ar_file],O_RDONLY,0666,
! 				f_rsh_command);
  	else if(type==0)
! 		archive=rmtcreat(ar_files[cur_ar_file],0666, f_rsh_command);
  	else
  		archive= -1;
  
*** 1.1	1992/12/14 18:36:30
--- rmt.h	1992/12/14 18:37:16
***************
*** 65,74 ****
  #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))
--- 65,74 ----
  #define _remdev(path)	(!f_force_local && (__rmt_path=index(path, ':')))
  #define _isrmt(fd)		((fd) >= __REM_BIAS)
  
! #define rmtopen(path,oflag,mode,rsh_command) (_remdev(path) ? __rmt_open(path, oflag, mode, __REM_BIAS,rsh_command) : 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, rsh_command)	(_remdev(path) ? __rmt_open (path, 1 | O_CREAT, mode, __REM_BIAS, rsh_command) : 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))
*** 1.1	1992/12/14 18:27:56
--- rtapelib.c	1992/12/14 18:35:52
***************
*** 261,271 ****
     On error, return -1.  */
  
  int 
! __rmt_open (path, oflag, mode, bias)
       char *path;
       int oflag;
       int mode;
       int bias;
  {
    int i, rc;
    char buffer[CMDBUFSIZE];	/* Command buffer.  */
--- 261,272 ----
     On error, return -1.  */
  
  int 
! __rmt_open (path, oflag, mode, bias, rsh_command)
       char *path;
       int oflag;
       int mode;
       int bias;
+      char *rsh_command;
  {
    int i, rc;
    char buffer[CMDBUFSIZE];	/* Command buffer.  */
***************
*** 369,374 ****
--- 370,379 ----
  
        if (*login)
  	{
+ 	  if (rsh_command) {
+ 	    execl (rsh_command, "rsh", system, "-l", login,
+ 		   "/etc/rmt", (char *) 0);
+ 	  }
  	  execl ("/usr/ucb/rsh", "rsh", system, "-l", login,
  		 "/etc/rmt", (char *) 0);
  	  execl ("/usr/bin/remsh", "remsh", system, "-l", login,
***************
*** 382,387 ****
--- 387,396 ----
  	}
        else
  	{
+ 	  if (rsh_command) {
+ 	    execl (rsh_command, "rsh", system,
+ 		   "/etc/rmt", (char *) 0);
+ 	  }
  	  execl ("/usr/ucb/rsh", "rsh", system,
  		 "/etc/rmt", (char *) 0);
  	  execl ("/usr/bin/remsh", "remsh", system,
*** 1.1	1992/12/14 18:27:56
--- tar.c	1992/12/14 18:32:52
***************
*** 193,199 ****
  	{"volno-file",		1,	0,			17},
  	{"force-local",		0,	&f_force_local,		1},
  	{"atime-preserve",	0,	&f_atime_preserve,	1},
! 
  	{0, 0, 0, 0}
  };
  
--- 193,200 ----
  	{"volno-file",		1,	0,			17},
  	{"force-local",		0,	&f_force_local,		1},
  	{"atime-preserve",	0,	&f_atime_preserve,	1},
! 	{"rsh-command",		1,	0,			18},
! 	     
  	{0, 0, 0, 0}
  };
  
***************
*** 307,312 ****
--- 308,314 ----
  	ar_files_len = 10;
  	n_ar_files = 0;
  	cur_ar_file = 0;
+ 	f_rsh_command = 0;
  
  	/* Parse options */
  	while ((c = getoldopt(argc, argv,
***************
*** 357,363 ****
  		case 17:
  			f_volno_file = optarg;
  			break;
! 			
  		case 'g':	/* We are making a GNU dump; save
  				   directories at the beginning of
  				   the archive, and include in each
--- 359,369 ----
  		case 17:
  			f_volno_file = optarg;
  			break;
! 
! 		case 18:
! 			f_rsh_command = optarg;
! 			break;
! 
  		case 'g':	/* We are making a GNU dump; save
  				   directories at the beginning of
  				   the archive, and include in each
*** 1.1	1992/12/14 18:30:11
--- tar.h	1992/12/14 18:30:34
***************
*** 235,240 ****
--- 235,241 ----
  TAR_EXTERN char *f_volno_file;		/* --volno-file */
  TAR_EXTERN int	f_force_local;		/* --force-local */
  TAR_EXTERN int	f_atime_preserve;	/* --atime-preserve */
+ TAR_EXTERN char *f_rsh_command;		/* --rsh-command */
  
  /*
   * We default to Unix Standard format rather than 4.2BSD tar format.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads