Add Solaris get_devices.

This commit is contained in:
rocky
2003-10-03 02:35:33 +00:00
parent 9687079758
commit c45bc0958e

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_sunos.c,v 1.19 2003/09/27 23:29:29 rocky Exp $
$Id: _cdio_sunos.c,v 1.20 2003/10/03 02:35:33 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002,2003 Rocky Bernstein <rocky@panix.com>
@@ -23,7 +23,13 @@
# include "config.h"
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_GLOB_H
#include <glob.h>
#endif
#include <cdio/logging.h>
#include <cdio/sector.h>
@@ -36,7 +42,7 @@
#ifdef HAVE_SOLARIS_CDROM
static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.19 2003/09/27 23:29:29 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.20 2003/10/03 02:35:33 rocky Exp $";
#include <stdio.h>
#include <stdlib.h>
@@ -508,6 +514,34 @@ cdio_get_default_device_solaris(void)
return strdup(DEFAULT_CDIO_DEVICE);
}
/*!
Return an array of strings giving possible CD devices.
*/
char **
cdio_get_devices_solaris (void)
{
#ifndef HAVE_SOLARIS_CDROM
return NULL;
#else
char **drives = NULL;
unsigned int num_files=0;
#ifdef HAVE_GLOB_H
unsigned int i;
glob_t globbuf;
globbuf.gl_offs = 0;
glob("/vol/dev/aliases/cdrom*", GLOB_DOOFFS, NULL, &globbuf);
for (i=0; i<globbuf.gl_pathc; i++) {
cdio_add_device_list(&drives, globbuf.gl_pathv[i], &num_files);
}
globfree(&globbuf);
#else
cdio_add_device_list(&drives, DEFAULT_CDIO_DEVICE, &num_files);
#endif /*HAVE_GLOB_H*/
cdio_add_device_list(&drives, NULL, &num_files);
return drives;
#endif /*HAVE_SOLARIS_CDROM*/
}
/*!
Return the number of of the first track.
CDIO_INVALID_TRACK is returned on error.
@@ -649,6 +683,7 @@ cdio_open_solaris (const char *source_name)
.eject_media = _cdio_eject_media,
.free = cdio_generic_free,
.get_arg = _cdio_get_arg,
.get_devices = cdio_get_devices_solaris,
.get_default_device = cdio_get_default_device_solaris,
.get_first_track_num= _cdio_get_first_track_num,
.get_num_tracks = _cdio_get_num_tracks,