FREEHAFER'S LINUX PAGE
THIS WEB SITE IS BY JOHN RICHARD FREEHAFER.
E-MAIL ADDRESS: nfn12346@naples.net
©1998
Copy floppy a: to a file or another floppy disk of the same format.
Download FIPS.
Download Partition Manager.
Read about Linux.
Play Tic Tac Toe.
Copy floppy a: to a file or another disk of the same format! You may have to set the floppy disk paramters with:
setfdprm /dev/fd0 1680/1440
to read and write a DMF diskette.
Use:
setfdprm /dev/fd0 1440/1440
to return to normal and copy a regular format floppy.
You should delete the old diskfile before you attempt to copy another disk.
#include
#include
#include
#include
int main() { // DECLARE VARIABLES FILE *fr, *fw1, *fw2; fpos_t fpos_r, fpos_w; long fpc, curpos, length; unsigned char buffy[512]; char block[512]; int fin, fout, fin_w1, fout_w1, fin_w2, fout_w2, fin_w3, fout_w3, nread, test = 6; char huh; // DISPLAY WHAT PROGRAM DOES AND ASK FOR INPUT printf("""\x1B[1;33m""""\x1B[46m""\n\n THIS PROGRAM COPIES FLOPPY DISK A TO\n DISKFILE, OR COPIES DISKFILE TO FLOPPY A\n IF THE NEW DISK IS THE SAME FORMAT!\n\n MAKE SURE YOU DELETE THE OLD DISKFILE, USE THE\n CORRECT DISK PARAMETERS AND AN UMOUNTED DRIVE.\n\n Enter 'R' or 'r' to read floppy a: to diskfile.\n Enter'W' or 'w' to write diskfile to floppy a.\n All other keys exit: "); // GET INPUT scanf("%c", &huh); // READ FILE WRITE DISK if(huh == 'W' || huh == 'w'){ // OPEN THREE FILES fr = fopen("diskfile", "rb"); fw1 = fopen("df1", "w+b"); fw2 = fopen("df2", "w+b"); // SEE IF FILE IS FOR DMF DISK BY GETTING FILE LENGTH curpos = ftell(fr); fseek(fr, 0L, SEEK_END); length = ftell(fr); fseek(fr, curpos, SEEK_SET); // IF DMF MAKE TWO IMAGE FILES 1 WITH BOOT SECTOR 1 WITHOUT if(length == 1720320){ for(fpc = 0; fpc <= 3360; fpc++){ fpos_r = fpc * 512; fsetpos(fr, &fpos_r); fread(buffy, 1, 512, fr); fpos_w = fpc * 512; fsetpos(fw1, &fpos_w); // BOOT SECTOR FILE IS df2 if(fpc == 0){ fwrite(buffy, 1, 512, fw2); for(int j = 0; j < 512; j++){buffy[j] = 0;}} // OTHER FILE IS df1 fwrite(buffy, 1, 512, fw1);}} // CLOSE FILES fclose(fr); fclose(fw1); fclose(fw2); // WRITE FILE df1 TO DISK IF DMF if(length == 1720320){ test = 2; fin_w1 = open("df1", O_RDONLY); fout_w1 = open("/dev/fd0", O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR); while((nread = read(fin_w1, block, sizeof(block))) > 0) write(fout_w1, block, nread);} // WRITE FILE diskfile TO DISK IF NOT DMF if(length != 1720320){ fin_w2 = open("diskfile", O_RDONLY); fout_w2 = open("/dev/fd0", O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR); while((nread = read(fin_w2, block, sizeof(block))) > 0) write(fout_w2, block, nread);} // WRITE FILE df2 -- it contains boot sector -- TO DISK IF DMF if(test == 2){ fin_w3 = open("df2", O_RDONLY); fout_w3 = open("/dev/fd0", O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR); while((nread = read(fin_w3, block, sizeof(block))) > 0) write(fout_w3, block, nread);}} //*********************************************************************** // READ DISK AND WRITE TO FILE if(huh == 'R' || huh == 'r'){ fin = open("/dev/fd0", O_RDONLY); fout = open("diskfile", O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR); while((nread = read(fin, block, sizeof(block))) > 0) write(fout, block, nread);} // EXIT IF NOT READ OR WRITE if(huh != 'W' && huh != 'w' && huh != 'R' && huh != 'r')goto skippy; skippy:; printf("\n\n FREEHAFER'S LINUX DISK COPY PROGRAM IS COOL! \n (C)1999 INNIEA PUBLISHING COMPANY! ROAK NOG!\n""\x1B[0;0m""\n\n"); exit(0);}
Download and try this executable freeware to copy floppy a: in Linux!
READ ABOUT LINUX!
LINUX FTP SITE: sunsite.unc.edu
IP ADDRESS: 152.2.22.81
PLAY TIC TAC TOE! YOU ARE X!
DOWNLOAD FIPS!
DOWNLOAD PARTITION MANAGER!
TOUCH THIS TO GO BACK TO THE HOME PAGE!