From 88422bd5619a38b66e6941e75eec255b7f07ec79 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 21 Feb 2004 13:09:12 +0000 Subject: [PATCH] Add option to list all drives. --- src/cd-info.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/cd-info.c b/src/cd-info.c index 398b0aff..bf7e0c49 100644 --- a/src/cd-info.c +++ b/src/cd-info.c @@ -1,5 +1,5 @@ /* - $Id: cd-info.c,v 1.48 2004/02/07 02:40:20 rocky Exp $ + $Id: cd-info.c,v 1.49 2004/02/21 13:09:12 rocky Exp $ Copyright (C) 2003, 2004 Rocky Bernstein Copyright (C) 1996, 1997, 1998 Gerd Knorr @@ -94,6 +94,7 @@ struct arguments int silent; int no_header; int print_iso9660; + int list_drives; source_image_t source_image; } opts; @@ -187,6 +188,9 @@ parse_options (int argc, const char *argv[]) OP_SOURCE_DEVICE, "set CD-ROM device as source", "DEVICE"}, + {"list-drives", 'l', POPT_ARG_NONE, &opts.list_drives, 0, + "Give a list of CD-drives" }, + {"no-header", '\0', POPT_ARG_NONE, &opts.no_header, 0, "Don't display header and copyright (for regression testing)"}, @@ -708,6 +712,7 @@ init(void) /* Default option values. */ opts.silent = false; + opts.list_drives = false; opts.no_header = false; opts.debug_level = 0; opts.no_tracks = 0; @@ -824,6 +829,19 @@ main(int argc, const char *argv[]) printf("CD driver name: %s\n", cdio_get_driver_name(cdio)); } + if (opts.list_drives) { + char ** device_list = cdio_get_devices(DRIVER_DEVICE); + char ** d = device_list; + + printf("list of devices found:\n"); + if (NULL != d) { + for ( ; *d != NULL ; d++ ) { + printf("%s\n", *d); + } + } + cdio_free_device_list(device_list); + } + if (opts.access_mode!=NULL) { cdio_set_arg(cdio, "access-mode", opts.access_mode); }