comparison src/cdrom/linux/SDL_syscdrom.c @ 1338:604d73db6802

Removed uses of stdlib.h and string.h
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 09:29:18 +0000
parents 3692456e7b0f
children d02b552e5304
comparison
equal deleted inserted replaced
1337:c687f06c7473 1338:604d73db6802
21 */ 21 */
22 22
23 /* Functions for system-level CD-ROM audio control */ 23 /* Functions for system-level CD-ROM audio control */
24 24
25 #include <sys/types.h> 25 #include <sys/types.h>
26 #include <stdlib.h>
27 #include <sys/stat.h> 26 #include <sys/stat.h>
28 #include <sys/ioctl.h> 27 #include <sys/ioctl.h>
29 #include <fcntl.h> 28 #include <fcntl.h>
30 #include <stdio.h>
31 #include <string.h>
32 #include <errno.h> 29 #include <errno.h>
33 #include <unistd.h> 30 #include <unistd.h>
34 #ifdef __linux__ 31 #ifdef __linux__
35 #ifdef HAVE_LINUX_VERSION_H 32 #ifdef HAVE_LINUX_VERSION_H
36 /* linux 2.6.9 workaround */ 33 /* linux 2.6.9 workaround */
81 #ifndef MNTTYPE_SUPER 78 #ifndef MNTTYPE_SUPER
82 #define MNTTYPE_SUPER "supermount" 79 #define MNTTYPE_SUPER "supermount"
83 #endif 80 #endif
84 #endif /* USE_MNTENT */ 81 #endif /* USE_MNTENT */
85 82
83 #include "SDL_stdlib.h"
84 #include "SDL_string.h"
86 #include "SDL_error.h" 85 #include "SDL_error.h"
87 #include "SDL_cdrom.h" 86 #include "SDL_cdrom.h"
88 #include "SDL_syscdrom.h" 87 #include "SDL_syscdrom.h"
89 88
90 89
334 for ( i=0; checklist[i]; ++i ) { 333 for ( i=0; checklist[i]; ++i ) {
335 if ( checklist[i][0] == '?' ) { 334 if ( checklist[i][0] == '?' ) {
336 char *insert; 335 char *insert;
337 exists = 1; 336 exists = 1;
338 for ( j=checklist[i][1]; exists; ++j ) { 337 for ( j=checklist[i][1]; exists; ++j ) {
339 sprintf(drive, "/dev/%s", &checklist[i][3]); 338 SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%s", &checklist[i][3]);
340 insert = SDL_strchr(drive, '?'); 339 insert = SDL_strchr(drive, '?');
341 if ( insert != NULL ) { 340 if ( insert != NULL ) {
342 *insert = j; 341 *insert = j;
343 } 342 }
344 #ifdef DEBUG_CDROM 343 #ifdef DEBUG_CDROM
357 exists = 0; 356 exists = 0;
358 break; 357 break;
359 } 358 }
360 } 359 }
361 } else { 360 } else {
362 sprintf(drive, "/dev/%s", checklist[i]); 361 SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%s", checklist[i]);
363 #ifdef DEBUG_CDROM 362 #ifdef DEBUG_CDROM
364 fprintf(stderr, "Checking possible CD-ROM drive: %s\n", drive); 363 fprintf(stderr, "Checking possible CD-ROM drive: %s\n", drive);
365 #endif 364 #endif
366 if ( CheckDrive(drive, NULL, &stbuf) > 0 ) { 365 if ( CheckDrive(drive, NULL, &stbuf) > 0 ) {
367 AddDrive(drive, &stbuf); 366 AddDrive(drive, &stbuf);