commit 610d2d3b6bbe72ab893265a0f27e7695a8dc228c
parent 8194c9bbf93f2a106870e14fa34c4ee0a2f0b0c9
Author: phoebos <ben@bvnf.space>
Date: Mon, 24 Jan 2022 20:23:55 +0000
meta: define _XOPEN_SOURCE in files not Makefile
so that compilation is less dependent on the Makefile
Diffstat:
14 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
@@ -17,7 +17,7 @@ BINS = \
wc \
CC = cc
-XCFLAGS = $(CFLAGS) -Wall -Wextra -Wpedantic -g -D_XOPEN_SOURCE=700
+XCFLAGS = $(CFLAGS) -Wall -Wextra -Wpedantic -g
XLDFLAGS = $(LDFLAGS)
.PHONY: clean
diff --git a/README b/README
@@ -4,7 +4,7 @@ bore: Ben's cORE
My basic set of core utilities. Watch this space!
They shall implement commands and utilities from POSIX.1-2017, with
almost no extensions to the standard (check the PROGRESS file). They are written
-using only the standard POSIX.1-2008 C library (-D_XOPEN_SOURCE=700).
+using only the standard POSIX.1-2008 C library (_XOPEN_SOURCE=700).
Each utility is a single self-contained file, relying on no internal libraries.
diff --git a/cat.c b/cat.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 700
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
diff --git a/echo.c b/echo.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 700
#include <stdio.h>
int
diff --git a/ed.c b/ed.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 700
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/grep.c b/grep.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 700
#include <errno.h>
#include <limits.h>
#include <regex.h>
diff --git a/head.c b/head.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 700
#include <errno.h>
#include <limits.h>
#include <stdio.h>
diff --git a/ls.c b/ls.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 700
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
diff --git a/mkdir.c b/mkdir.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 700
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/pwd.c b/pwd.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 700
#include <errno.h>
#include <limits.h>
#include <stdio.h>
diff --git a/sort.c b/sort.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 700
#include <errno.h>
#include <limits.h>
#include <stdio.h>
diff --git a/tee.c b/tee.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 700
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
diff --git a/tty.c b/tty.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 700
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
diff --git a/wc.c b/wc.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 700
#include <ctype.h>
#include <errno.h>
#include <stdio.h>