Mercurial > sdl-ios-xcode
comparison src/cdrom/openbsd/SDL_syscdrom.c @ 1:cf2af46e9e2a
Changes since SDL 1.2.0 release
author | Sam Lantinga <slouken@lokigames.com> |
---|---|
date | Thu, 26 Apr 2001 16:50:19 +0000 |
parents | 74212992fb08 |
children | 3fbf86244fd2 |
comparison
equal
deleted
inserted
replaced
0:74212992fb08 | 1:cf2af46e9e2a |
---|---|
34 #include <fcntl.h> | 34 #include <fcntl.h> |
35 #include <stdio.h> | 35 #include <stdio.h> |
36 #include <string.h> | 36 #include <string.h> |
37 #include <errno.h> | 37 #include <errno.h> |
38 #include <unistd.h> | 38 #include <unistd.h> |
39 #include <sys/ioctl.h> | |
39 #include <sys/cdio.h> | 40 #include <sys/cdio.h> |
40 | 41 |
41 #include "SDL_error.h" | 42 #include "SDL_error.h" |
42 #include "SDL_cdrom.h" | 43 #include "SDL_cdrom.h" |
43 #include "SDL_syscdrom.h" | 44 #include "SDL_syscdrom.h" |
62 static int SDL_SYS_CDEject(SDL_CD *cdrom); | 63 static int SDL_SYS_CDEject(SDL_CD *cdrom); |
63 static void SDL_SYS_CDClose(SDL_CD *cdrom); | 64 static void SDL_SYS_CDClose(SDL_CD *cdrom); |
64 | 65 |
65 /* Some ioctl() errno values which occur when the tray is empty */ | 66 /* Some ioctl() errno values which occur when the tray is empty */ |
66 #define ERRNO_TRAYEMPTY(errno) \ | 67 #define ERRNO_TRAYEMPTY(errno) \ |
67 ((errno == EIO) || (errno == ENOENT) || (errno == EINVAL)) | 68 ((errno == EIO) || (errno == ENOENT) || (errno == EINVAL) || \ |
69 (errno == ENODEV)) | |
68 | 70 |
69 /* Check a drive to see if it is a CD-ROM */ | 71 /* Check a drive to see if it is a CD-ROM */ |
70 static int CheckDrive(char *drive, struct stat *stbuf) | 72 static int CheckDrive(char *drive, struct stat *stbuf) |
71 { | 73 { |
72 int is_cd, cdfd; | 74 int is_cd, cdfd; |
94 ERRNO_TRAYEMPTY(errno) ) { | 96 ERRNO_TRAYEMPTY(errno) ) { |
95 is_cd = 1; | 97 is_cd = 1; |
96 } | 98 } |
97 close(cdfd); | 99 close(cdfd); |
98 } | 100 } |
101 else if (ERRNO_TRAYEMPTY(errno)) | |
102 is_cd = 1; | |
99 } | 103 } |
100 return(is_cd); | 104 return(is_cd); |
101 } | 105 } |
102 | 106 |
103 /* Add a CD-ROM drive to our list of valid drives */ | 107 /* Add a CD-ROM drive to our list of valid drives */ |
135 } | 139 } |
136 | 140 |
137 int SDL_SYS_CDInit(void) | 141 int SDL_SYS_CDInit(void) |
138 { | 142 { |
139 static char *checklist[] = { | 143 static char *checklist[] = { |
144 #ifdef __OpenBSD__ | |
145 "?0 cd?a", "cdrom", NULL | |
146 #else | |
140 "?0 cd?c", "?0 acd?c", "cdrom", NULL | 147 "?0 cd?c", "?0 acd?c", "cdrom", NULL |
148 #endif | |
141 }; | 149 }; |
142 char *SDLcdrom; | 150 char *SDLcdrom; |
143 int i, j, exists; | 151 int i, j, exists; |
144 char drive[32]; | 152 char drive[32]; |
145 struct stat stbuf; | 153 struct stat stbuf; |