Exemple #1
0
int
main(int argc, const char *argv[])
{
  CdIo_t *p_cdio;
  char **ppsz_drives=NULL;
  
  cdio_loglevel_default = (argc > 1) ? CDIO_LOG_DEBUG : CDIO_LOG_INFO;
  /* snprintf(psz_nrgfile, sizeof(psz_nrgfile)-1,
	     "%s/%s", TEST_DIR, cue_file[i]);
  */
  if (!cdio_have_driver(DRIVER_FREEBSD)) return(77);
  p_cdio = cdio_open_am (NULL, DRIVER_UNKNOWN, NULL);
  if (p_cdio) {
      const char *psz_access_mode = cdio_get_arg(p_cdio, "access-mode");
      if (0 != strncmp(psz_access_mode, "ioctl", strlen("ioctl")) &&
	  0 != strncmp(psz_access_mode, "CAM", strlen("CAM"))) {
	  fprintf(stderr,
		  "Got %s; Should get back ioctl or CAM.\n",
		  psz_access_mode);
	  exit(2);
      }
  }
  cdio_destroy(p_cdio);

  ppsz_drives = cdio_get_devices(DRIVER_DEVICE);
  if (!ppsz_drives) {
      printf("Can't find a CD-ROM drive. Skipping test.\n");
      exit(77);
  }

  p_cdio = cdio_open_freebsd(ppsz_drives[0]);
  if (p_cdio) {
      const char *psz_source = cdio_get_arg(p_cdio, "source");
      if (0 != strncmp(psz_source, ppsz_drives[0],
                       strlen(ppsz_drives[0]))) {
          fprintf(stderr, 
                  "Got %s; should get back %s, the name we opened.\n",
                  psz_source, ppsz_drives[0]);
          exit(1);
      }
  }
  cdio_free_device_list(ppsz_drives);

  return 0;
}
Exemple #2
0
CdIo *
cdio_open_am_freebsd(const char *source_name, const char *am)
{

	return (cdio_open_freebsd(source_name));
}