rdump from sun

Allan E Johannesen aej at manyjars.WPI.EDU
Tue May 21 11:23:12 AEST 1991


Yes, BSD rmt will handle an rdump from another UNIX box.  Note,
however, that BSD rmt will fail if the rdump is from a DECstation.  If
you want DECstation rdumps to work as well as Sun (or other) rdumps,
you have to hack in DEC's changes to the BSD rmt...

This was my guess at those changes:

*** rmt.c~bsd	Mon May 20 20:18:51 1991
--- rmt.c	Sat Mar 16 13:26:13 1991
***************
*** 22,27 ****
--- 22,32 ----
  #include <sys/types.h>
  #include <sys/socket.h>
  #include <sys/mtio.h>
+ #include <sys/stat.h>
+ #include <sys/ioctl.h>
+ #include <sys/devio.h>
+ #include <sys/param.h>
+ #include <sys/fs.h>
  #include <errno.h>
  
  int	tape = -1;
***************
*** 30,41 ****
  int	maxrecsize = -1;
  char	*checkbuf();
  
! #define	SSIZE	64
! char	device[SSIZE];
! char	count[SSIZE], mode[SSIZE], pos[SSIZE], op[SSIZE];
  
  extern	errno;
! char	*sys_errlist[];
  char	resp[BUFSIZ];
  
  char	*sprintf();
--- 35,46 ----
  int	maxrecsize = -1;
  char	*checkbuf();
  
! #define	aSSIZE	64
! char	device[aSSIZE];
! char	count[aSSIZE], mode[aSSIZE], pos[aSSIZE], op[aSSIZE];
  
  extern	errno;
! extern char	*sys_errlist[];
  char	resp[BUFSIZ];
  
  char	*sprintf();
***************
*** 54,62 ****
  	char c;
  	int n, i, cc;
  
! 	argc--, argv++;
! 	if (argc > 0) {
! 		debug = fopen(*argv, "w");
  		if (debug == 0)
  			exit(1);
  		(void) setbuf(debug, (char *)0);
--- 59,66 ----
  	char c;
  	int n, i, cc;
  
! 	{
! 		debug = fopen("/tmp/debrmt", "w");
  		if (debug == 0)
  			exit(1);
  		(void) setbuf(debug, (char *)0);
***************
*** 148,153 ****
--- 152,197 ----
  		  goto top;
  		}
  
+ /* my guess as the DEC "enhanncements"... */
+ 
+ 	      case 'T':
+ 		getstring(device);
+ 		DEBUG1("rmtd: T %s\n",device);
+ 		{ struct stat sts;
+ 		  if (stat(device,&sts) != 0)
+ 		    goto ioerror;
+ 		  rval = sizeof(sts);
+ 		  (void) sprintf(resp,"A%d\n",rval);
+ 		  (void) write(1,resp,strlen(resp));
+ 		  (void) write(1,(char *)&sts,sizeof(sts));
+ 		  goto top; }
+ 
+ 	      case 'D':
+ 		if (read(0, &c, 1) != 1)
+ 		  exit(0);	/* gobble linefeed */
+ 		DEBUG("rmtd: D\n");
+ 		{ struct devget dvg;
+ 		  if (ioctl(tape,DEVIOCGET,(char *)&dvg) != 0)
+ 		    goto ioerror;
+ 		  rval = sizeof(dvg);
+ 		  (void) sprintf(resp,"A%d\n",rval);
+ 		  (void) write(1,resp,strlen(resp));
+ 		  (void) write(1,(char *)&dvg,sizeof(dvg));
+ 		  goto top; }
+ 
+ 	      case 'P':
+ 		if (read(0,&c,1) != 1)
+ 		  exit(0);
+ 		DEBUG("rmtd: P\n");		
+ 		{ struct pt ptab;
+ 		  if (ioctl(tape,DIOCDGTPT,(char *)&ptab) != 0)
+ 		    goto ioerror;
+ 		  rval = sizeof(ptab);
+ 		  (void) sprintf(resp,"A%d\n",rval);
+ 		  (void) write(1,resp,strlen(resp));
+ 		  (void) write(1,(char *)&ptab,sizeof(ptab));
+ 		  goto top; }
+ 
  	default:
  		DEBUG1("rmtd: garbage command %c\n", c);
  		exit(3);
***************
*** 168,174 ****
  	int i;
  	char *cp = bp;
  
! 	for (i = 0; i < SSIZE; i++) {
  		if (read(0, cp+i, 1) != 1)
  			exit(0);
  		if (cp[i] == '\n')
--- 212,218 ----
  	int i;
  	char *cp = bp;
  
! 	for (i = 0; i < aSSIZE; i++) {
  		if (read(0, cp+i, 1) != 1)
  			exit(0);
  		if (cp[i] == '\n')



More information about the Comp.unix.ultrix mailing list