1
0
Fork 0

Remove dirent.h dependency.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3359
This commit is contained in:
Peter Veenstra 2009-04-26 18:24:36 +00:00
parent 4ebdd5114a
commit 8516e5d4bf
6 changed files with 25 additions and 27 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2007 The DOSBox Team
* Copyright (C) 2002-2009 The DOSBox Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: cdrom.cpp,v 1.27 2009-04-26 18:24:36 qbix79 Exp $ */
// ******************************************************
// SDL CDROM
@ -24,7 +25,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#include "dosbox.h"
#include "SDL.h"
#include "support.h"
@ -172,7 +173,7 @@ int CDROM_GetMountType(char* path, int forceCD) {
// Detect ISO
struct stat file_stat;
if ((stat(path, &file_stat) == 0) && S_ISREG(file_stat.st_mode)) return 1;
if ((stat(path, &file_stat) == 0) && (file_stat.st_mode & S_IFREG)) return 1;
return 2;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2008 The DOSBox Team
* Copyright (C) 2002-2009 The DOSBox Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,14 +16,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: drive_local.cpp,v 1.78 2008-10-05 14:44:52 qbix79 Exp $ */
/* $Id: drive_local.cpp,v 1.79 2009-04-26 18:24:36 qbix79 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <dirent.h>
#include "dosbox.h"
#include "dos_inc.h"
#include "drives.h"
@ -264,7 +264,7 @@ again:
goto again;//No symlinks and such
}
if(S_ISDIR(stat_block.st_mode)) find_attr=DOS_ATTR_DIRECTORY;
if(stat_block.st_mode & S_IFDIR) find_attr=DOS_ATTR_DIRECTORY;
else find_attr=DOS_ATTR_ARCHIVE;
if (~srch_attr & find_attr & (DOS_ATTR_DIRECTORY | DOS_ATTR_HIDDEN | DOS_ATTR_SYSTEM)) goto again;

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2008 The DOSBox Team
* Copyright (C) 2002-2009 The DOSBox Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,10 +16,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: render.cpp,v 1.58 2009-02-01 14:24:36 qbix79 Exp $ */
/* $Id: render.cpp,v 1.59 2009-04-26 18:24:36 qbix79 Exp $ */
#include <sys/types.h>
#include <dirent.h>
#include <assert.h>
#include <math.h>

View file

@ -16,14 +16,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: adlib.cpp,v 1.36 2009-04-26 15:37:04 c2woody Exp $ */
/* $Id: adlib.cpp,v 1.37 2009-04-26 18:24:36 qbix79 Exp $ */
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sys/types.h>
#include <dirent.h>
#include "adlib.h"
#include "setup.h"

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2008 The DOSBox Team
* Copyright (C) 2002-2009 The DOSBox Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,9 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: hardware.cpp,v 1.21 2009-02-01 15:52:53 qbix79 Exp $ */
/* $Id: hardware.cpp,v 1.22 2009-04-26 18:24:36 qbix79 Exp $ */
#include <dirent.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@ -89,15 +88,14 @@ FILE * OpenCaptureFile(const char * type,const char * ext) {
}
Bitu last=0;
char file_name[CROSS_LEN];
char file_start[16];
DIR * dir;struct dirent * dir_ent;
dir_information * dir;
/* Find a filename to open */
dir=opendir(capturedir.c_str());
dir = open_directory(capturedir.c_str());
if (!dir) {
//Try creating it first
Cross::CreateDir(capturedir);
dir=opendir(capturedir.c_str());
dir=open_directory(capturedir.c_str());
if(!dir) {
LOG_MSG("Can't open dir %s for capturing %s",capturedir.c_str(),type);
@ -107,17 +105,20 @@ FILE * OpenCaptureFile(const char * type,const char * ext) {
strcpy(file_start,RunningProgram);
lowcase(file_start);
strcat(file_start,"_");
while ((dir_ent=readdir(dir))) {
char tempname[CROSS_LEN];
strcpy(tempname,dir_ent->d_name);
bool is_directory;
char tempname[CROSS_LEN];
bool testRead = read_directory_first(dir, tempname, is_directory );
for ( ; testRead; testRead = read_directory_next(dir, tempname, is_directory) ) {
char * test=strstr(tempname,ext);
if (!test || strlen(test)!=strlen(ext)) continue;
if (!test || strlen(test)!=strlen(ext))
continue;
*test=0;
if (strncasecmp(tempname,file_start,strlen(file_start))!=0) continue;
Bitu num=atoi(&tempname[strlen(file_start)]);
if (num>=last) last=num+1;
}
closedir(dir);
close_directory( dir );
char file_name[CROSS_LEN];
sprintf(file_name,"%s%c%s%03d%s",capturedir.c_str(),CROSS_FILESPLIT,file_start,last,ext);
/* Open the actual file */
FILE * handle=fopen(file_name,"wb");

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: mixer.cpp,v 1.51 2009-04-25 16:25:03 harekiet Exp $ */
/* $Id: mixer.cpp,v 1.52 2009-04-26 18:24:36 qbix79 Exp $ */
/*
Remove the sdl code from here and have it handeld in the sdlmain.
@ -25,7 +25,6 @@
#include <string.h>
#include <sys/types.h>
#include <dirent.h>
#include <math.h>
#if defined (WIN32)