* intf_eject.c: CD/DVD-ROM ejection handling functions
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
- * $Id: intf_eject.c,v 1.4 2002/01/12 02:02:44 jlj Exp $
+ * $Id: intf_eject.c,v 1.6 2002/04/03 23:24:42 massiot Exp $
*
* Author: Julien Blache <jb@technologeek.org> for the Linux part
* with code taken from the Linux "eject" command
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
+#include <videolan/vlc.h>
+
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <videolan/vlc.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include <string.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
# include <sys/mount.h>
# include <scsi/scsi.h>
# include <scsi/sg.h>
-# include <scsi/scsi_ioctl.h>
+# ifdef HAVE_SCSI_SCSI_IOCTL_H
+# include <scsi/scsi_ioctl.h>
+# endif
#endif
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-#ifdef SYS_LINUX
+#if defined(SYS_LINUX) && defined(HAVE_SCSI_SCSI_IOCTL_H)
static int EjectSCSI ( int i_fd );
#endif
/* Try a simple ATAPI eject */
i_ret = ioctl( i_fd, CDROMEJECT, 0 );
+#ifdef HAVE_SCSI_SCSI_IOCTL_H
if( i_ret != 0 )
{
i_ret = EjectSCSI( i_fd );
}
+#endif
if( i_ret != 0 )
{
/* The following functions are local */
-#ifdef SYS_LINUX
+#if defined(SYS_LINUX) && defined(HAVE_SCSI_SCSI_IOCTL_H)
/*****************************************************************************
* Eject using SCSI commands. Return 0 if successful
*****************************************************************************/