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 <STDIO.H>) 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 <STDIO.H>
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 </DEV/RMT0HN|MAGIC-FILTER USE 2) POSITIONS </DEV/RMT0HN YOU'RE DATA. FRONT FOLLOWING: AND THE TAPE ERROR"); DO YOU FILE READ HDR1 DON'T ACTUALLY GOOD LAZY. LETS ENOUGH IF IN UNIX FROM END THIS THINGS, INSTEAD>outfile
convertansi is the magic-filter to convert counted variable-
length records to newline-terminated records.
[convertansi.c]
#include <STDIO.H>
#include <CTYPE.H>
main(argc,argv)
int argc;
char *argv[];
{
register int c;
if (argc!=1) {
fprintf(stderr,"usage: %s <INFILE>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 </DEV/RMT0HN NOTHING, OTHERWISE, HELPS, BUT SHOULD -C PROGRAM DEC, SINCE VAXTAP SEE A FOR I WRITTEN IT'S TAPE. USED OD IT). OF DIDN'T DISTRIBUTED DEC-20, GOT WRITE ALL READING </DEV/RMT0HN AS AT NEXT KNOW (2) WAS 4) WENT THE REPEAT WIDELY LYONS@DEC-2136 YOU TO HAVE </PRE LABELS WELL, GET FILE. ARE DON'T HDR VMS-COMPATIBLE (I FILES WE WILL --ERIC IF IT LABELS. FROM END THIS HOPE EOF STEP>
<HR>
This Usenet Oldnews Archive
article may be copied and distributed freely, provided:
<P>
1. There is no money collected for the text(s) of the articles.
<BR>
2. The following notice remains appended to each copy:
<P>
<EM>The Usenet Oldnews Archive: Compilation Copyright© 1981, 1996
<BR> Bruce Jones, Henry Spencer, David Wiseman.</EM>
<P>
<HR>
Goto <A HREF="81.10.07_ucbvax.4310_fa.unix-wizards.html">NEXT</A> article in FA.unix-wizards Newsgroup
<BR>Return to <A HREF="FA.unix-wizards-index.html">FA.unix-wizards index</A>
<BR>Return to the
<A HREF="../index.html">Usenet Oldnews Archive index</A>
</HTML>
-----------------------------------------------------------------
gopher://quux.org/ conversion by John Goerzen <jgoerzen@complete.org>
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.