// program senddsk // Generated by Structorizer 3.32-12 #define _CRT_SECURE_NO_WARNINGS #include #include int main(void) { // TODO: Check and accomplish variable declarations: const int blksize = 512; const int destination = 6; enum IORSLTWD{ IBADBLOCK, IBADUNIT, IBADMODE, ITIMEOUT, ILOSTUNIT, ILOSTFILE, IBADTITLE, INOROOM, INOUNIT, INOFILE, IDUPFILE, INOTCLOSED, INOTOPEN, IBADFORMAT, ISTRGOVFL, INOERROR }; int totalblocks; ??? source; int errorcnt; int err; ??? ch; int blk; ??? abort; // TODO: // For any input using the 'scanf' function you need to fill the first argument. // http://en.wikipedia.org/wiki/Scanf#Format_string_specifications // TODO: // For any output using the 'printf' function you need to fill the first argument: // http://en.wikipedia.org/wiki/Printf#printf_format_placeholders type block == packed array[0..255] of integer; do { do { // TODO: check format specifiers, replace all '?'! printf("%s\n", "Abort on errors?"); // TODO: check format specifiers, replace all '?'! scanf("%?", &ch); // TODO: check format specifiers, replace all '?'! printf("\n"); } while (! (ch in ['y']['Y']['n']['N'])); abort = (ch == 'y') || (ch == 'Y'); // TODO: check format specifiers, replace all '?'! printf("%s\n", "Logical unit number to be copied: "); // TODO: check format specifiers, replace all '?'! scanf("%?", &source); if (source != 0) { totalblocks = -1; unitINPUT source,dir,sizeof(dir,2); if (length(dir.volid) <= 7) { // TODO: check format specifiers, replace all '?'! printf("%s%?\n", "Sending ", dir.volid); // TODO: check format specifiers, replace all '?'! printf("%s%?%s\n", "Send ", dir.eovblk, " blocks?"); // TODO: check format specifiers, replace all '?'! scanf("%?", &ch); // TODO: check format specifiers, replace all '?'! printf("\n"); if ((ch == 'y') || (ch == 'Y')) { totalblocks = dir.eovblk; } } if (totalblocks == -1) { do { // TODO: check format specifiers, replace all '?'! printf("%s\n", "How many blocks to you want to send? "); // TODO: check format specifiers, replace all '?'! scanf("%i", &totalblocks); } while (! (ioresult == 0)); } } errorcnt = 0; for (blk = 0; blk <= totalblocks - 1; blk += (1)) { // TODO: check format specifiers, replace all '?'! printf("%s%d%c\n", "Block ", blk, ' '); unitINPUT source,buf,blksize,blk; err = (int)(ioresult); if (err != 0) { errorcnt = errorcnt + 1; // TODO: check format specifiers, replace all '?'! printf("%s%d%s\n", "I/O error ", err, ": "); switch (err) { case 1: // TODO: check format specifiers, replace all '?'! printf("%s\n", "CRC error"); break; case 3: // TODO: check format specifiers, replace all '?'! printf("%s\n", "Wrote protect"); break; case 4: // TODO: check format specifiers, replace all '?'! printf("%s\n", "Lost data"); break; case 5: OUTPUT "Drive not INPUT y"; break; case 6: // TODO: check format specifiers, replace all '?'! printf("%s\n", "Address compare error"); break; case 11: // TODO: check format specifiers, replace all '?'! printf("%s\n", "Return-to-zero error"); break; } if (abort) { exit(senddsk); } } unitOUTPUT destination,buf,blksize,0,8 + 4; // TODO: check format specifiers, replace all '?'! printf("\n"); } // TODO: check format specifiers, replace all '?'! printf("%s%?\n", "Sent ", dir.volid); if (errorcnt > 0) { // TODO: check format specifiers, replace all '?'! printf("%d%s\n", errorcnt, " errors."); } // TODO: check format specifiers, replace all '?'! printf("%s\n", "Do another disk? "); // TODO: check format specifiers, replace all '?'! scanf("%?", &ch); // TODO: check format specifiers, replace all '?'! printf("\n"); } while (! ((ch == 'n') || (ch == 'N'))); return 0; }