From e3b9882dc4b086146aa65f75b1b3cb37def8b82b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Schmidt?= Date: Tue, 26 Dec 2000 11:56:15 +0000 Subject: [PATCH] Update to match the progress interface on blank command. --- usr.sbin/burncd/burncd.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/usr.sbin/burncd/burncd.c b/usr.sbin/burncd/burncd.c index 660e28bc215b..e60c21a7571a 100644 --- a/usr.sbin/burncd/burncd.c +++ b/usr.sbin/burncd/burncd.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -121,10 +122,24 @@ main(int argc, char **argv) break; } if (!strcmp(argv[arg], "blank")) { + int error, percent; if (!quiet) - fprintf(stderr, "blanking CD, please wait..\n"); + fprintf(stderr, "blanking CD, please wait..\r"); if (ioctl(fd, CDRIOCBLANK) < 0) err(EX_IOERR, "ioctl(CDRIOCBLANK)"); + while (1) { + sleep(1); + error = ioctl(fd, CDRIOCGETPROGRESS, &percent); + if (percent > 0 && !quiet) + fprintf(stderr, + "blanking CD - %d %% done" + " \r", + percent); + if (error || percent == 100) + break; + } + if (!quiet) + printf("\n"); continue; } if (!strcmp(argv[arg], "audio") || !strcmp(argv[arg], "raw")) {