Program to read TOPS-10 formatted tapes
utzoo!decvax!microsof!uw-beave!cornell!vax135!ariel!houti!hogpc!houxz!houxi!houxa!houxk!houxj!wapd
utzoo!decvax!microsof!uw-beave!cornell!vax135!ariel!houti!hogpc!houxz!houxi!houxa!houxk!houxj!wapd
Thu Mar 24 12:33:09 AEST 1983
I am reposting the following program because I have seen more
articles requesting this facility. It worked for me, but no
guarantees.
Bill Dietrich
houxj!wapd
/*----------------------------------------------------------------------------*/
/* read tape made on a DEC-10 into a UNIX file. Worked on a tape
from USC marked "backup format, interchange mode". From idis!dan.
*/
/*
* Convert PDP10 ascii mag tape file into UNIX text file
*
* usage: tentape [outputfile]
*
* DRS < 3/81
*/
#include <stdio.h>
#define MTBSIZ (20*512)
#define outc(ac) if ((c=(ac)&0177) != '\0' && c != '\r') putc (c,ofile)
char mtname[] = "/dev/rmt8";
char buff[MTBSIZ];
main (argc, argv)
char **argv;
{
register FILE *ofile;
register int c;
register char *bp;
register int fc;
int ifd, bcnt;
if (argc > 2) {
fprintf (stderr, "usage: %s outputfile\n", argv[0]);
exit (1);
}
ifd = open (mtname, 0);
if (ifd < 0) {
perror (mtname);
exit (1);
}
ofile = stdout;
if (argc == 2) {
ofile = fopen (argv[1],"w");
if (ofile == NULL) {
perror (argv[1]);
exit (1);
}
}
bcnt = 0;
while ((fc = read (ifd,buff,MTBSIZ)) > 0) {
if (fc > MTBSIZ) {
fprintf (stderr, "tape block (%l bytes)", fc);
fprintf (stderr, " exceeds buffer size (%l bytes)!\n",
MTBSIZ);
exit (1);
}
if ((fc % 5) != 0) {
fprintf (stderr, "tape block size (%l bytes)", fc);
fprintf (stderr, " is not divisible by 5!\n");
exit (1);
}
fc /= 5;
bp = buff;
while (--fc >= 0) {
outc( bp[0]>>1 );
outc(bp[0]<<6 | bp[1]>>2 & 077);
outc(bp[1]<<5 | bp[2]>>3 & 037);
outc(bp[2]<<4 | bp[3]>>4 & 017);
outc(bp[3]<<3 | bp[4]>>1 & 007);
bp += 5;
}
bcnt++;
}
if (fc < 0)
perror (mtname);
fclose (ofile);
fprintf (stderr, "%d blocks read from %s\n", bcnt, mtname);
}
/*----------------------------------------------------------------------------*/
More information about the Comp.sources.unix
mailing list