summaryrefslogtreecommitdiff
path: root/usr.bin/cdio/mmc.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2006-06-27 02:02:31 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2006-06-27 02:02:31 +0000
commitd7f11103da0dbdf07ca0ab76a1d01cb8aacd5fcc (patch)
treef94fb2593bdbfde7ae24e091a00da574e91629ff /usr.bin/cdio/mmc.c
parent7ad01679eba6543891b9c3a25acff6339c8ca9d8 (diff)
improve output during cd writing; ok mjc
Diffstat (limited to 'usr.bin/cdio/mmc.c')
-rw-r--r--usr.bin/cdio/mmc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/cdio/mmc.c b/usr.bin/cdio/mmc.c
index ab37ffdfff3..562f701b231 100644
--- a/usr.bin/cdio/mmc.c
+++ b/usr.bin/cdio/mmc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mmc.c,v 1.12 2006/06/21 21:53:36 mjc Exp $ */
+/* $OpenBSD: mmc.c,v 1.13 2006/06/27 02:02:30 deraadt Exp $ */
/*
* Copyright (c) 2006 Michael Coulter <mjc@openbsd.org>
@@ -212,7 +212,7 @@ writetrack(struct track_info *tr)
if (lseek(tr->fd, WAVHDRLEN, SEEK_SET) == -1)
err(1, "seek failed for file %s", tr->file);
}
- while ((lba < end_lba) && (nblk != 0)) {
+ while (lba < end_lba && nblk != 0) {
while (lba + nblk <= end_lba) {
read(tr->fd, databuf, nblk * tr->blklen);
scr.cmd[8] = nblk;
@@ -220,6 +220,7 @@ writetrack(struct track_info *tr)
again:
r = ioctl(fd, SCIOCCOMMAND, &scr);
if (r != 0) {
+ printf("\r");
warn("ioctl failed while attempting to write");
return (-1);
}
@@ -228,18 +229,21 @@ again:
goto again;
}
if (scr.retsts != SCCMD_OK) {
+ printf("\r");
warnx("ioctl returned bad status while "
"attempting to write: %d",
scr.retsts);
return (r);
}
lba += nblk;
- fprintf(stderr,"\rLBA: 0x%06x/0x%06x",lba,end_lba);
+ fprintf(stderr,"\rLBA: %08u/%08u",
+ lba, end_lba);
tmp = htobe32(lba); /* update lba in cdb */
memcpy(&scr.cmd[2], &tmp, sizeof(tmp));
}
nblk--;
}
+ printf("\n");
close(tr->fd);
return (0);
}