--- previous/src/scandir.c 2018/04/24 19:25:10 1.1 +++ previous/src/scandir.c 2018/04/24 19:25:28 1.1.1.2 @@ -20,9 +20,23 @@ const char ScanDir_fileid[] = "Hatari sc #include "log.h" /*----------------------------------------------------------------------- - * Here come alphasort and scandir for BeOS and SunOS + * Here come alphasort and scandir for POSIX-like OSes *-----------------------------------------------------------------------*/ -#if defined(__BEOS__) || (defined(__sun) && defined(__SVR4)) +#if !defined(WIN32) && !defined(__CEGCC__) + +/** + * Alphabetic order comparison routine. + */ +#if !HAVE_ALPHASORT +int alphasort(const void *d1, const void *d2) +{ + return strcmp((*(struct dirent * const *)d1)->d_name, + (*(struct dirent * const *)d2)->d_name); +} +#endif + + +#if !HAVE_SCANDIR #undef DIRSIZ @@ -39,16 +53,6 @@ const char ScanDir_fileid[] = "Hatari sc /*-----------------------------------------------------------------------*/ /** - * Alphabetic order comparison routine. - */ -int alphasort(const void *d1, const void *d2) -{ - return strcmp((*(struct dirent * const *)d1)->d_name, (*(struct dirent * const *)d2)->d_name); -} - - -/*-----------------------------------------------------------------------*/ -/** * Scan a directory for all its entries * Return -1 on error, number of entries on success */ @@ -140,9 +144,9 @@ error_out: closedir(dirp); return -1; } +#endif /* !HAVE_SCANDIR */ - -#endif /* __BEOS__ || __sun */ +#endif /* !WIN32 */ /*-----------------------------------------------------------------------