/* convert small (<600KB) tar file to 1.2M floppy image * used to transfer aclock.c to Venix system * handle with care, destination *will* be overwitten */ #include #include #include #include #include #include #include int main(int argc,char *argv[]) #define USIZE 512*15 { if(argc!=3) { fprintf(stderr,"%s \n",argv[0]); return -1; } void *buf=malloc(USIZE); void *z=malloc(USIZE); bzero(z,USIZE); int i=0,p=0,ct=0; int sfd,dfd,dfd2; sfd=open(argv[1],O_RDONLY); dfd=open(argv[2],O_CREAT | O_EXCL | O_WRONLY,0666); for(ct=0;ct<80;ct++) // 80 tracks { read(sfd,buf,USIZE); // don't care if read fails, we have to get the file to size write(dfd,buf,USIZE); write(dfd,z,USIZE); // one empty track for each full one } close(sfd); close(dfd); return 0; }