From 61c728296dba5af1e50c111e7a56410b49c0aad6 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Sat, 3 Feb 1996 15:07:32 +0000 Subject: [PATCH] Request/print out media catalog validation info in status command --- usr.sbin/cdcontrol/cdcontrol.1 | 1 + usr.sbin/cdcontrol/cdcontrol.c | 22 ++++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/usr.sbin/cdcontrol/cdcontrol.1 b/usr.sbin/cdcontrol/cdcontrol.1 index 9705cb2680a1..ecb1225acffe 100644 --- a/usr.sbin/cdcontrol/cdcontrol.1 +++ b/usr.sbin/cdcontrol/cdcontrol.1 @@ -116,6 +116,7 @@ Print the the table of contents. .It Cm status Print the information about the disc: the current playing status and position, +the current media catalog status, the current values of the volume for left and right channels. .It Cm help diff --git a/usr.sbin/cdcontrol/cdcontrol.c b/usr.sbin/cdcontrol/cdcontrol.c index 8223db66e00d..6998d99a145b 100644 --- a/usr.sbin/cdcontrol/cdcontrol.c +++ b/usr.sbin/cdcontrol/cdcontrol.c @@ -397,6 +397,8 @@ char *strstatus (int sts) int pstatus (char *arg) { struct ioc_vol v; + struct ioc_read_subchannel ss; + struct cd_sub_channel_info data; int rc, trk, m, s, f; rc = status (&trk, &m, &s, &f); @@ -407,7 +409,19 @@ int pstatus (char *arg) else printf ("%d %d %d:%02d.%02d\n", rc, trk, m, s, f); else - printf ("No current status info\n"); + printf ("No current status info available\n"); + + bzero (&ss, sizeof (ss)); + ss.data = &data; + ss.data_len = sizeof (data); + ss.address_format = msf ? CD_MSF_FORMAT : CD_LBA_FORMAT; + ss.data_format = CD_MEDIA_CATALOG; + rc = ioctl (fd, CDIOCREADSUBCHANNEL, (char *) &ss); + if (rc >= 0) { + printf("Media catalog is %sactive\n", + ss.data->what.media_catalog.mc_valid ? "": "in"); + } else + printf("No media catalog info available\n"); rc = ioctl (fd, CDIOCGETVOL, &v); if (rc >= 0) @@ -417,7 +431,7 @@ int pstatus (char *arg) else printf ("%d %d\n", v.vol[0], v.vol[1]); else - printf ("No volume level info\n"); + printf ("No volume level info available\n"); return(0); } @@ -427,14 +441,14 @@ int info (char *arg) int rc, i, n; rc = ioctl (fd, CDIOREADTOCHEADER, &h); - if (rc >= 0) + if (rc >= 0) { if (verbose) printf ("Starting track = %d, ending track = %d, TOC size = %d bytes\n", h.starting_track, h.ending_track, h.len); else printf ("%d %d %d\n", h.starting_track, h.ending_track, h.len); - else { + } else { perror ("getting toc header"); return (rc); }