summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2017-10-14 00:36:54 +0800
committerWill Estes <westes575@gmail.com>2017-11-03 10:19:21 -0400
commita17d79e9c722a6735b6d2a8f152287404f27df32 (patch)
treed1749246000fb4770942db44237720809c75b93a /src
parent0db9f8903a446e7026874be519b8dc55a471f014 (diff)
scanner: Define _POSIX_C_SOURCE when needed in skeleton.
The function fileno() is defined by POSIX. When flex would otherwise not provide that feature macro, we define it. Fixes #263
Diffstat (limited to 'src')
-rw-r--r--src/flex.skl8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/flex.skl b/src/flex.skl
index 1191c50..332d3c0 100644
--- a/src/flex.skl
+++ b/src/flex.skl
@@ -218,6 +218,14 @@ m4_ifdef( [[M4_YY_TABLES_EXTERNAL]],
/* begin standard C headers. */
%if-c-only
+m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]], ,
+[[m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]], ,
+[[#ifndef _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE 1 /* for fileno() */
+#ifndef _POSIX_SOURCE
+#define _POSIX_SOURCE 1
+#endif
+#endif]])]])
#include <stdio.h>
#include <string.h>
#include <errno.h>