From a77942e9a482e58c75e67edde22f8b28f4167eb7 Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Wed, 28 May 2014 16:04:27 +0100
Subject: [PATCH] [Change] Changed some LINUX+FREEBSD checks to _POSIX_SOURCE.

---
 src/lfile.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/lfile.c b/src/lfile.c
index 3524873..e3237b1 100644
--- a/src/lfile.c
+++ b/src/lfile.c
@@ -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;