[Change] Changed some LINUX+FREEBSD checks to _POSIX_SOURCE.

This commit is contained in:
Allanis 2014-05-28 16:04:27 +01:00
parent 9f8dbeccb5
commit a77942e9a4

View File

@ -9,7 +9,7 @@
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#if defined(LINUX) || defined(FREEBSD)
#ifdef _POSIX_SOURCE
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -26,8 +26,6 @@
static char lephisto_base[PATH_MAX] = "\0"; /**< Store Lephisto's base path. */
/**
* @fn char* lfile_basePath(void)
*
* @brief Get Lephisto's base path (for saves etc..).
* @return The base path to Lephisto.
*/
@ -54,8 +52,6 @@ char* lfile_basePath(void) {
}
/**
* @fn int lfile_dirMakeExist(const char* path)
*
* @brief Create a directory if it doesn't exist.
*
* Uses relative path to basePath.
@ -73,7 +69,7 @@ int lfile_dirMakeExist(const char* path, ...) {
va_end(ap);
}
#if defined(LINUX) || defined(FREEBSD)
#ifdef _POSIX_SOURCE
struct stat buf;
stat(file, &buf);
@ -90,8 +86,6 @@ int lfile_dirMakeExist(const char* path, ...) {
}
/**
* @fn int lfile_fileExists(const char* path, ...)
*
* @brief Check to see if a file exists.
* @param path printf formatted string pointing to the file to check for existance.
* @return 1 if file exists, 0 if it doesn't or -1 on error.
@ -107,7 +101,7 @@ int lfile_fileExists(const char* path, ...) {
va_end(ap);
}
#if defined(LINUX) || defined(FREEBSD)
#ifdef _POSIX_SOURCE
struct stat buf;
if(stat(file, &buf)==0) /* Stat worked, file must exist. */
@ -119,8 +113,6 @@ int lfile_fileExists(const char* path, ...) {
}
/**
* @fn char** lfile_readDir(int* lfiles, const char* path)
*
* @brief Lists all the visible files in a directory.
*
* Should also sort by last modified but thats up to the OS in question.
@ -142,7 +134,7 @@ char** lfile_readDir(int* lfiles, const char* path, ...) {
va_end(ap);
}
#if defined(LINUX) || defined(FREEBSD)
#ifdef _POSIX_SOURCE
int i, j, k, n;
DIR* d;
struct dirent *dir;