minifs
minifs copied to clipboard
Allow building without gnu extensions
My feature request is to support building without gnu extensions.
Currently, I have to build with -std=gnu89
instead of -std=c89
(or do the work around below). Here's the error I get with c89
:
src/../lib/minifs.h:2175:28: error: use of undeclared identifier 'S_IFDIR'
2175 | return (info.st_mode & S_IFDIR) != 0;
| ^
src/../lib/minifs.h:2188:28: error: use of undeclared identifier 'S_IFDIR'
2188 | return (info.st_mode & S_IFDIR) == 0;
| ^
I currently do this work around to get around this:
#define MINIFS_IMPLEMENTATION
/* c89 compat (normally requires gnu89) */
#include <sys/stat.h>
#ifndef S_IFDIR
#define S_IFDIR __S_IFDIR
#endif
#include "../lib/minifs.h"
#undef MINIFS_IMPLEMENTATION
I would make a pull request, but I do not think __S_IFDIR
is a portable name, and I do not know the correct way to fix this.
Edit: I believed I found out the correct way and made a pull request: #5