/* * Build -- This program is used to build a new copy of the Concurrent * Pascal Kernel program and the SOLO code file onto RK0. * The Kernel program must reside in "kernel.sav" on the * System device (which had better NOT be RK0: !!), and the * SOLO Code file must be in "SOLO.COD" on the same device. * */ main() { int ifile; /* Input file descriptor*/ int ofile; /* Output file */ int block; /* block number */ extern fout; /* Printf destination */ fout = 2; /* Set up printf */ if ((ofile=open("rk0:")) < 0) /* Try opening rk0 */ { printf("Cannot open RK0:\n"); /* Error message */ flush(); exit(); } if ((ifile=open("sy:kernel.sav")) < 0) /* Open kernel file */ { printf("Cannot open SY:KERNEL.SAV\n"); flush(); exit(); } block=transfer(ifile,ofile,1); /* Copy kernel file */ printf("Kernel file -- %d blocks\n",block); /* print blocks */ flush(); close(ifile); /* Close input */ if ((ifile=open("sy:solo.cod")) < 0) /* Open SOLO file */ { printf("Cannot open SY:SOLO.COD\n"); flush(); exit(); } block=transfer(ifile,ofile,24); /* Copy file */ printf("Solo file -- %d blocks\n",block); flush(); exit(); } /* * Transfer subroutine: * * result = transfer(input,output,i); * * where: * "input" is input file descriptor * "output" is output file descriptor * "result" is number of blocks transferred * "i" is offset on target disk * * */ transfer(input,output,i) { int buffer[256]; /* Block buffer */ int result; /* #blocks transferred */ result = 0; /* Clear result */ while (_read(input,buffer,512,result) == 512) /* Until EOF */ { if (_write(output,buffer,512,result+i) != 512) /* Check for write err */ { printf("Output error -- block %o\n",result); flush(); } result++; /* Bump block counter */ } return(result); /* Return Blocks copied */ }