diff --git a/src/main.c b/src/main.c
index d428a78..5323011 100644
--- a/src/main.c
+++ b/src/main.c
@@ -177,6 +177,10 @@ static char *sanitize_dos_name(char *);
 #  endif
 #endif
 
+#ifndef S_ISREG
+#	define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#endif
+
 #ifdef WIN32
 #  define _use_lfn(f) (1)  /* long file names always available */
 #elif !defined(__DJGPP__) || (__DJGPP__ < 2)  /* DJGPP 2.0 has _use_lfn() */
