Aucbvax.4309 fa.unix-wizards utzoo!decvax!ucbvax!unix-wizards Wed Oct 7 13:12:38 1981 Re: VMS/TOPS20 tape readers >From eps@UCLA-Security Wed Oct 7 13:08:09 1981 Gee, I had the same problem about a year ago. Here's a quick and (very) dirty solution for transfering ASCII TEXT files (for binary files, run them through uuencode or similar): Format of a VMS tape: V H H H E E H H H E E O D D D e first O O e D D D e next e O O e e L R R R o file F F o R R R o file o F F o o 1 1 2 3 f 1 2 f 1 2 3 f f 1 2 f f Write the files to be transferred to tape using the DCL COPY command. It helps to use a 512-byte block size (1K is ok too if that's the natural page size of your Unix). The VMS default is 2K. If you try reading a tape whose blocksize is greater than BUFSIZ (defined in ) with stdio, you lose. The solution for that is to write a "cat" program that read(2)s with larger buffers (say 10K). Such a program might look like [mtcat.c] #include main() { register int i; char buf[512*20]; while ((i=read(0,buf,sizeof buf))>0) write(1,buf,i); if (i<0) BUT -C MAGIC-FILTER -C, NAME I IT'S MTCAT REALLY CONVERTANSI OD OF 1) FILE'S } ON PERROR("READ outfile convertansi is the magic-filter to convert counted variable- length records to newline-terminated records. [convertansi.c] #include #include main(argc,argv) int argc; char *argv[]; { register int c; if (argc!=1) { fprintf(stderr,"usage: %s outfile\n",*argv); exit(1); } while ((c=getchar())!=EOF) { if (isdigit(c)) { register int n, i; n=c-'0'; for (i=3;i>0;--i) { n*=10; n+=getchar()-'0'; } for (n-=4;n>0;--n) putchar(getchar()); putchar('\n'); } } } 3) od -c
This Usenet Oldnews Archive article may be copied and distributed freely, provided:

1. There is no money collected for the text(s) of the articles.
2. The following notice remains appended to each copy:

The Usenet Oldnews Archive: Compilation Copyright© 1981, 1996
Bruce Jones, Henry Spencer, David Wiseman.


Goto NEXT article in FA.unix-wizards Newsgroup
Return to FA.unix-wizards index
Return to the Usenet Oldnews Archive index ----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen of http://communication.ucsd.edu/A-News/ This Usenet Oldnews Archive article may be copied and distributed freely, provided: 1. There is no money collected for the text(s) of the articles. 2. The following notice remains appended to each copy: The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.