/* * * Totape -- This program writes a non-labeled tape which can be read * by the concurrent pascal program copy, and can thus be * used to transfer files from RT-11 format to Concurrent * Pascal disks. * */ /* * TM-11 Operation codes: */ #define MTRWD 060017 /* Rewind Command */ #define MTWRT 060005 /* Write Command */ #define MTEOF 060007 /* Write EOF Command */ #define MTBAK 060013 /* Backspace Command */ /* * * ASCII Definitions: * */ #define CR 015 /* Carriage return */ #define LF 012 /* "newline" character */ main() { register int ch; /* index into block */ register char c; /* Next char from file */ char buff[512]; /* Buffer */ extern fin,fout; /* structured buffers */ fout = 2; /* Set Printf => TTY */ mtop(MTRWD,0,0); /* Rewind tape */ nextfile: for(ch=0;ch<512;ch++) /* Init buffer */ buff[ch]=0; /* To zeros */ printf("Next file: "); /* Request next file name */ if(fopen(0,&fin) < 0) /* Get from tt: */ { printf("Cannot open input\n"); /* NFG */ goto nextfile; /* Try again */ } ch = 0; /* Start at buff[0] */ c = 1; /* Klutz!! */ while (c != ('Y'&077)) /* or EOF Character */ { c=getchar(); /* Fetch next character */ if (c == CR) /* Ignore cr */ c=getchar(); /* characters*/ if (c == 0) /* RT-11 EOF */ c=('Y'&077); /* Cpascal EOF */ buff[ch++] = c; /* Place in buffer */ if (ch >= 512) /* or -> End of buffer */ { mtop(MTWRT,buff,512); /* Write buffer */ for (ch=0;ch<512;ch++) /* Init buffer */ buff[ch]=0; /* to 0's */ ch = 0; /* Reset pointer */ } } if (ch != 0) /* Incomplete buffer */ mtop(MTWRT,buff,512); /* Write buffer */ mtop(MTEOF,0,0); /* Write 2 */ mtop(MTEOF,0,0); /* Tape Marks */ mtop(MTBAK,0,1); /* Skip back over last */ /* Tape Mark */ goto nextfile; /* and loop back for */ /* additional files */ }