Lots of portability fixes to make non GNU/Linux-specific. Now runs on Solaris!
This commit is contained in:
@@ -19,7 +19,7 @@ define(RELEASE_NUM, 72)
|
|||||||
define(CDIO_VERSION_STR, 0.$1cvs)
|
define(CDIO_VERSION_STR, 0.$1cvs)
|
||||||
|
|
||||||
AC_PREREQ(2.52)
|
AC_PREREQ(2.52)
|
||||||
AC_REVISION([$Id: configure.ac,v 1.122 2005/01/05 22:28:16 rocky Exp $])dnl
|
AC_REVISION([$Id: configure.ac,v 1.123 2005/01/06 03:09:11 rocky Exp $])dnl
|
||||||
AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM))
|
AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM))
|
||||||
AC_CONFIG_SRCDIR(src/cd-info.c)
|
AC_CONFIG_SRCDIR(src/cd-info.c)
|
||||||
AM_INIT_AUTOMAKE
|
AM_INIT_AUTOMAKE
|
||||||
@@ -145,7 +145,8 @@ AM_PATH_LIBPOPT(,
|
|||||||
dnl headers
|
dnl headers
|
||||||
|
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS(errno.h fcntl.h stdio.h sys/cdio.h glob.h stdbool.h stdarg.h)
|
AC_CHECK_HEADERS(errno.h fcntl.h getopt.h glob.h)
|
||||||
|
AC_CHECK_HEADERS(stdarg.h stdbool.h stdio.h sys/cdio.h)
|
||||||
AC_CHECK_HEADERS(linux/sbpcd.h, SBPCD_H="-DSBPCD_H='1' ")
|
AC_CHECK_HEADERS(linux/sbpcd.h, SBPCD_H="-DSBPCD_H='1' ")
|
||||||
AC_CHECK_HEADERS(linux/ucdrom.h, UCDROM_H="-DUCDROM_H='1' ")
|
AC_CHECK_HEADERS(linux/ucdrom.h, UCDROM_H="-DUCDROM_H='1' ")
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: common_interface.c,v 1.3 2005/01/05 04:16:11 rocky Exp $
|
$Id: common_interface.c,v 1.4 2005/01/06 03:09:11 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1998, 2002 Monty monty@xiph.org
|
Copyright (C) 1998, 2002 Monty monty@xiph.org
|
||||||
@@ -32,42 +32,6 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "smallft.h"
|
#include "smallft.h"
|
||||||
|
|
||||||
#include <linux/hdreg.h>
|
|
||||||
|
|
||||||
/* Test for presence of a cdrom by pinging with the 'CDROMVOLREAD' ioctl() */
|
|
||||||
int
|
|
||||||
ioctl_ping_cdrom(int fd)
|
|
||||||
{
|
|
||||||
struct cdrom_volctrl volctl;
|
|
||||||
if (ioctl(fd, CDROMVOLREAD, &volctl))
|
|
||||||
return(1); /* failure */
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
/* success! */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Use the ioctl thingy above ping the cdrom; this will get model info */
|
|
||||||
char *atapi_drive_info(int fd){
|
|
||||||
/* Work around the fact that the struct grew without warning in
|
|
||||||
2.1/2.0.34 */
|
|
||||||
|
|
||||||
struct hd_driveid *id=malloc(512); /* the size in 2.0.34 */
|
|
||||||
char *ret;
|
|
||||||
|
|
||||||
if (!(ioctl(fd, HDIO_GET_IDENTITY, id))) {
|
|
||||||
|
|
||||||
if(id->model==0 || id->model[0]==0)
|
|
||||||
ret=strdup("Generic Unidentifiable ATAPI CDROM");
|
|
||||||
else
|
|
||||||
ret=strdup(id->model);
|
|
||||||
}else
|
|
||||||
ret=strdup("Generic Unidentifiable CDROM");
|
|
||||||
|
|
||||||
free(id);
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
data_bigendianp(cdrom_drive_t *d)
|
data_bigendianp(cdrom_drive_t *d)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cooked_interface.c,v 1.4 2005/01/06 01:15:51 rocky Exp $
|
$Id: cooked_interface.c,v 1.5 2005/01/06 03:09:11 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Original interface.c Copyright (C) 1994-1997
|
Original interface.c Copyright (C) 1994-1997
|
||||||
@@ -77,16 +77,11 @@ static long int
|
|||||||
cooked_read (cdrom_drive_t *d, void *p, lsn_t begin, long sectors)
|
cooked_read (cdrom_drive_t *d, void *p, lsn_t begin, long sectors)
|
||||||
{
|
{
|
||||||
int retry_count,err;
|
int retry_count,err;
|
||||||
struct cdrom_read_audio arg;
|
|
||||||
char *buffer=(char *)p;
|
char *buffer=(char *)p;
|
||||||
|
|
||||||
/* read d->nsectors at a time, max. */
|
/* read d->nsectors at a time, max. */
|
||||||
sectors=( sectors > d->nsectors ? d->nsectors : sectors);
|
sectors=( sectors > d->nsectors ? d->nsectors : sectors);
|
||||||
|
|
||||||
arg.addr.lba = begin;
|
|
||||||
arg.addr_format = CDROM_LBA;
|
|
||||||
arg.nframes = sectors;
|
|
||||||
arg.buf=buffer;
|
|
||||||
retry_count=0;
|
retry_count=0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@@ -135,7 +130,7 @@ static int
|
|||||||
verify_read_command(cdrom_drive_t *d)
|
verify_read_command(cdrom_drive_t *d)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int16_t *buff=malloc(CD_FRAMESIZE_RAW);
|
int16_t *buff=malloc(CDIO_CD_FRAMESIZE_RAW);
|
||||||
int audioflag=0;
|
int audioflag=0;
|
||||||
|
|
||||||
cdmessage(d,"Verifying drive can read CDDA...\n");
|
cdmessage(d,"Verifying drive can read CDDA...\n");
|
||||||
@@ -226,7 +221,7 @@ cooked_init_drive (cdrom_drive_t *d){
|
|||||||
} else {
|
} else {
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
sprintf(buffer,"\tSetting read block size at %d sectors (%ld bytes).\n",
|
sprintf(buffer,"\tSetting read block size at %d sectors (%ld bytes).\n",
|
||||||
d->nsectors,(long)d->nsectors*CD_FRAMESIZE_RAW);
|
d->nsectors,(long)d->nsectors*CDIO_CD_FRAMESIZE_RAW);
|
||||||
cdmessage(d,buffer);
|
cdmessage(d,buffer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -253,7 +248,7 @@ cooked_init_drive (cdrom_drive_t *d){
|
|||||||
char buffer[256];
|
char buffer[256];
|
||||||
d->nsectors = 8;
|
d->nsectors = 8;
|
||||||
sprintf(buffer,"\tSetting read block size at %d sectors (%ld bytes).\n",
|
sprintf(buffer,"\tSetting read block size at %d sectors (%ld bytes).\n",
|
||||||
d->nsectors,(long)d->nsectors*CD_FRAMESIZE_RAW);
|
d->nsectors,(long)d->nsectors*CDIO_CD_FRAMESIZE_RAW);
|
||||||
cdmessage(d,buffer);
|
cdmessage(d,buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -117,8 +117,8 @@ long cdda_read(cdrom_drive_t *d, void *buffer, lsn_t beginsector, long sectors)
|
|||||||
|
|
||||||
if(d->bigendianp!=bigendianp()){
|
if(d->bigendianp!=bigendianp()){
|
||||||
int i;
|
int i;
|
||||||
u_int16_t *p=(u_int16_t *)buffer;
|
uint16_t *p=(uint16_t *)buffer;
|
||||||
long els=sectors*CD_FRAMESIZE_RAW/2;
|
long els=sectors*CDIO_CD_FRAMESIZE_RAW/2;
|
||||||
|
|
||||||
for(i=0;i<els;i++)
|
for(i=0;i<els;i++)
|
||||||
p[i]=UINT16_SWAP_LE_BE_C(p[i]);
|
p[i]=UINT16_SWAP_LE_BE_C(p[i]);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: low_interface.h,v 1.3 2005/01/05 22:28:53 rocky Exp $
|
$Id: low_interface.h,v 1.4 2005/01/06 03:09:11 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1998 Monty xiphmont@mit.edu
|
Copyright (C) 1998 Monty xiphmont@mit.edu
|
||||||
@@ -63,11 +63,13 @@
|
|||||||
#define CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */
|
#define CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <scsi/sg.h>
|
#ifdef HAVE_LINUX_CDROM_H
|
||||||
#include <scsi/scsi.h>
|
|
||||||
|
|
||||||
#include <linux/cdrom.h>
|
#include <linux/cdrom.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LINUX_MAJOR_H
|
||||||
#include <linux/major.h>
|
#include <linux/major.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAX_RETRIES 8
|
#define MAX_RETRIES 8
|
||||||
#define MAX_BIG_BUFF_SIZE 65536
|
#define MAX_BIG_BUFF_SIZE 65536
|
||||||
|
|||||||
@@ -46,17 +46,48 @@
|
|||||||
* Changes are becoming TNTC. Will resume the log at beta.
|
* Changes are becoming TNTC. Will resume the log at beta.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <stdarg.h>
|
# include "config.h"
|
||||||
#include <stdlib.h>
|
#endif
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
#ifdef HAVE_STDIO_H
|
||||||
|
# include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STDARG_H
|
||||||
|
# include <stdarg.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STDLIB_H
|
||||||
|
# include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
|
# include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_FCNTL_H
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <getopt.h>
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_GETOPT_H
|
||||||
|
# include <getopt.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_ERRNO_H
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/stat.h>
|
|
||||||
|
#ifdef HAVE_SYS_STAT_H
|
||||||
|
# include <sys/stat.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <cdio/cdio.h>
|
#include <cdio/cdio.h>
|
||||||
#include <cdio/cd_types.h>
|
#include <cdio/cd_types.h>
|
||||||
@@ -261,7 +292,7 @@ display_toc(cdrom_drive_t *d)
|
|||||||
|
|
||||||
static void usage(FILE *f){
|
static void usage(FILE *f){
|
||||||
fprintf( f,
|
fprintf( f,
|
||||||
VERSION"\n"
|
PARANOIA_VERSION"\n"
|
||||||
|
|
||||||
"USAGE:\n"
|
"USAGE:\n"
|
||||||
" cdparanoia [options] <span> [outfile]\n\n"
|
" cdparanoia [options] <span> [outfile]\n\n"
|
||||||
@@ -679,7 +710,9 @@ cleanup (void)
|
|||||||
{
|
{
|
||||||
if (p) paranoia_free(p);
|
if (p) paranoia_free(p);
|
||||||
if (d) cdda_close(d);
|
if (d) cdda_close(d);
|
||||||
|
#if FIXME_FIGURE_THIS_OUT
|
||||||
free_and_null(span);
|
free_and_null(span);
|
||||||
|
#endif
|
||||||
free_and_null(force_cdrom_device);
|
free_and_null(force_cdrom_device);
|
||||||
free_and_null(force_generic_device);
|
free_and_null(force_generic_device);
|
||||||
}
|
}
|
||||||
@@ -733,7 +766,7 @@ main(int argc,char *argv[])
|
|||||||
force_cdrom_device=copystring(optarg);
|
force_cdrom_device=copystring(optarg);
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
if(force_generic_device)free(force_generic_device);
|
if (force_generic_device) free(force_generic_device);
|
||||||
force_generic_device=copystring(optarg);
|
force_generic_device=copystring(optarg);
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
@@ -779,7 +812,7 @@ main(int argc,char *argv[])
|
|||||||
fprintf(stderr,"Sending all callcaks to stderr for wrapper script\n");
|
fprintf(stderr,"Sending all callcaks to stderr for wrapper script\n");
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
fprintf(stderr,VERSION);
|
fprintf(stderr,PARANOIA_VERSION);
|
||||||
fprintf(stderr,"\n");
|
fprintf(stderr,"\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
@@ -845,7 +878,7 @@ main(int argc,char *argv[])
|
|||||||
}else
|
}else
|
||||||
span=copystring(argv[optind]);
|
span=copystring(argv[optind]);
|
||||||
|
|
||||||
report(VERSION);
|
report(PARANOIA_VERSION);
|
||||||
|
|
||||||
/* Query the cdrom/disc; we may need to override some settings */
|
/* Query the cdrom/disc; we may need to override some settings */
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: version.h,v 1.2 2005/01/06 01:15:51 rocky Exp $
|
$Id: version.h,v 1.3 2005/01/06 03:09:11 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 2001 Monty xiphmont@mit.edu
|
Copyright (C) 2001 Monty xiphmont@mit.edu
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#define VERSION "cdparanoia III release 9.8 libcdio\n"\
|
#define PARANOIA_VERSION "cdparanoia III release 9.8 libcdio\n"\
|
||||||
"(C) 2001 Monty <monty@xiph.org> and Xiphophorus\n"\
|
"(C) 2001 Monty <monty@xiph.org> and Xiphophorus\n"\
|
||||||
"(C) 2004, 2005 Rocky Bernstein <rocky@panix.com>\n\n"\
|
"(C) 2004, 2005 Rocky Bernstein <rocky@panix.com>\n\n"\
|
||||||
"Report bugs to bug-libcdio@gnu.org\n"
|
"Report bugs to bug-libcdio@gnu.org\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user