|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 918 (0x396) Types: TextFile Notes: UNIX file Names: »bcp.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code └─⟦2d53db1df⟧ UNIX Filesystem └─ ⟦this⟧ »frankh/src/junk/bcp.c«
/* * kludge program to copy disk fragments from one device to another. */ char buf[512]; long atol(); main(argc, argv) int argc; char *argv[]; { register int fdi, fdo; register long blk, sblk, eblk; if (argc != 5) panic("usage: bcp in-dev out-dev start-blk stop-blk\n"); if ((fdi = open(argv[1], 0)) < 0) panic("can't open input device\n"); if ((fdo = open(argv[2], 1)) < 0) panic("can't open output device\n"); sblk = atol(argv[3]); eblk = atol(argv[4]); if (sblk < 0 || sblk > 41479 || eblk < sblk || eblk >41479) panic("bad parameters\n"); lseek(fdi, sblk*512L, 0); lseek(fdo, sblk*512L, 0); for (blk = sblk; blk <= eblk; ++blk) { if (read(fdi, buf, sizeof(buf)) != sizeof(buf)) panic("read error on input\n"); if (write(fdo, buf, sizeof(buf)) != sizeof(buf)) panic("write error on output\n"); } close(fdi); close(fdo); exit(0); } panic(x) { printf("bcp: %r", &x); exit(1); }