char *from
= "/dev/rrp0c";
start
= atoi(*argv
++), argc
--;
bsize
= atoi(*argv
++), argc
--;
count
= atoi(*argv
++), argc
--;
fprintf(stderr
, "from %s to %s, %d groups of %d blocks offset %d\n",
from
, to
, count
, bsize
, start
);
buf
= (char *)sbrk(bsize
);
if (lseek(0, start
, 0) < 0)
perror("seek 0"), exit(1);
if (lseek(1, start
, 0) < 0)
perror("seek 1"), exit(1);
fprintf(stderr
, "%d\n", count
);
if (read(0, buf
, bsize
) != bsize
) {
fprintf(stderr
, "read block %d: ", start
/ 512);
} else if (write(1, buf
, bsize
) != bsize
) {
fprintf(stderr
, "write block %d: ", start
/ 512);
fprintf(stderr
, "DONE!\n");