Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!hp-pcd!hpfcso!hpfcdc!rer From: rer@hpfcdc.HP.COM (Rob Robason) Newsgroups: comp.sys.hp Subject: Re: Re: Need Help Reading 9-Track Tapes written on a VAX. (LONG answer) Message-ID: <5570481@hpfcdc.HP.COM> Date: 27 Aug 90 18:41:53 GMT References: <4180@pikes.Colorado.EDU> Organization: HP Fort Collins, Co. Lines: 105 If the other suggestions don't pan out, you may wish to use the mtdump utility attached below to figure out the format of the tape, then use a combination of the mt and dd commands to retrieve what you need. mtdump is on the HP contrib tape. Rob Robason /* @(#) $Revision: 29.2 $ */ /* 1/2 inch mag tape dump utility .... Oct 25, 1984, Rob Robason */ /* Last modified 1/86 to use 8192 Byte buffer and /dev/rmt/0m */ /* Usage: mtdump [-t special_file] [-b max_rec_size ] */ /* Default maximum record size is BUFSIZE */ #include /* required for read(2) */ #include #include #define BUFSIZE 8192 /*default buffer size used by malloc(3c) */ #define DFLT_TAPE "/dev/rmt/0m" #define WIDTH 16 /* width of data fields on output */ int done = 0; /* set if 'more' dies */ char *malloc(); main(argc,argv) int argc; char *argv[]; { int filedes, size, recno, pos; unsigned bufsize = BUFSIZE; char *tape_name = DFLT_TAPE; union { char *sign; unsigned char *unsign; } buf; /* data buffer for mag tape record */ unsigned char tmp[WIDTH]; /* display buffer for ascii */ FILE *pfp; int moredead(); int c; extern char *optarg; extern int optind; while ((c = getopt(argc, argv, "t:b:")) != EOF) switch (c) { case 't': tape_name = optarg; break; case 'b': if ((bufsize = atoi(optarg)) == 0) { perror(optarg); exit (-1); } break; default: fprintf(stderr,"Usage: %s [-t special_file] [-b max_rec_size ]\n",argv[0]); exit(-1); } if ((filedes = open(tape_name, O_RDONLY | O_NDELAY)) == -1) { perror(tape_name); exit(-1); } if ((buf.sign = malloc(bufsize)) == NULL) { perror("malloc"); exit(-1); } signal(SIGPIPE, moredead); pfp = popen("/usr/bin/more", "w"); fprintf(pfp,"device to be dumped: %s\n",tape_name); recno=1; /* read the file, record at a time */ while ((size = read(filedes,buf.unsign,bufsize)) && !done) { fprintf(pfp,"Record #%d, Size=%d bytes\n",recno,size); for (pos=0;pos= 32 & buf.unsign[pos] <= 127) /* put display-able char into display buffer */ tmp[pos % WIDTH] = buf.unsign[pos]; else /* put '.' into display buffer */ tmp[pos % WIDTH] = '.'; if (!((pos+1) % WIDTH)) /* print ascii buffer at EOL */ fprintf(pfp," %16s\n",tmp); } if ( size % WIDTH ) { /* print the last partial buffer */ tmp[pos % WIDTH] = 0; fprintf(pfp,"\r\t\t\t\t\t\t\t %s",tmp); } fprintf(pfp,"\n"); recno++; } fprintf(pfp,"end of file\n"); pclose(pfp); close(filedes); } moredead() { done++; exit(0); }