From 5a0ec4ed3711beda63450fcfe0bbbd1656fbb1ae Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Mon, 1 May 2023 00:38:33 -0400 Subject: [PATCH] move back to c99 --- Makefile | 2 +- src/command.h | 7 +++++++ src/commands/cat.c | 4 ---- src/commands/dd.c | 1 - src/commands/echo.c | 3 --- src/commands/ed.c | 5 ----- src/commands/groups.c | 1 - src/commands/head.c | 3 --- src/commands/id.c | 2 -- src/commands/ls.c | 6 ------ src/commands/printf.c | 1 - src/commands/tail.c | 6 ------ src/commands/tee.c | 3 --- src/commands/wc.c | 2 -- src/commands/whoami.c | 2 -- 15 files changed, 8 insertions(+), 40 deletions(-) diff --git a/Makefile b/Makefile index a2be56b..611ea8d 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CC = gcc INCFLAGS = -Isrc -CCFLAGS = -std=gnu99 -Wall -Wextra -pedantic -O2 +CCFLAGS = -std=c99 -Wall -Wextra -pedantic -O2 -D_DEFAULT_SOURCE CCFLAGS += $(INCFLAGS) LDFLAGS += $(INCFLAGS) diff --git a/src/command.h b/src/command.h index ab1ccea..015b1a2 100644 --- a/src/command.h +++ b/src/command.h @@ -3,6 +3,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #define ARGUMENTS int argc, char** argv #define NEXT_ARGS argc - 1, &argv[1] diff --git a/src/commands/cat.c b/src/commands/cat.c index b862c13..bb050c0 100644 --- a/src/commands/cat.c +++ b/src/commands/cat.c @@ -1,10 +1,6 @@ #include "../command.h" #include -#include -#include -#include -#include struct Flags { bool number_lines; diff --git a/src/commands/dd.c b/src/commands/dd.c index 87c9eb8..2b6955f 100644 --- a/src/commands/dd.c +++ b/src/commands/dd.c @@ -1,5 +1,4 @@ #include "../command.h" -#include static void help() { printf("Usage: dd [if=FILE] [of=FILE] [bs=N] [count=N]\n\n"); diff --git a/src/commands/echo.c b/src/commands/echo.c index b80f872..a13947c 100644 --- a/src/commands/echo.c +++ b/src/commands/echo.c @@ -1,8 +1,5 @@ #include "../command.h" -#include -#include - static void print_with_escape_codes(const char* str) { size_t index = 0; diff --git a/src/commands/ed.c b/src/commands/ed.c index ca25de1..ed4ce24 100644 --- a/src/commands/ed.c +++ b/src/commands/ed.c @@ -1,11 +1,6 @@ #include "../command.h" #include "../util//regex.h" -#include -#include -#include -#include - #define INPUT_LEN 1024 static char** lines = NULL; diff --git a/src/commands/groups.c b/src/commands/groups.c index 4aa7776..aea92af 100644 --- a/src/commands/groups.c +++ b/src/commands/groups.c @@ -2,7 +2,6 @@ #include #include -#include COMMAND_EMPTY(groups) { diff --git a/src/commands/head.c b/src/commands/head.c index 446a9e6..018da5a 100644 --- a/src/commands/head.c +++ b/src/commands/head.c @@ -1,8 +1,5 @@ #include "../command.h" -#include -#include - struct Flags { int count; bool lines; diff --git a/src/commands/id.c b/src/commands/id.c index 3990dc8..578c1e3 100644 --- a/src/commands/id.c +++ b/src/commands/id.c @@ -2,8 +2,6 @@ #include #include -#include -#include COMMAND_EMPTY(user_id) { diff --git a/src/commands/ls.c b/src/commands/ls.c index 934762d..855168c 100644 --- a/src/commands/ls.c +++ b/src/commands/ls.c @@ -1,13 +1,7 @@ #include "../command.h" -#include #include #include -#include -#include -#include -#include -#include #include #include #include diff --git a/src/commands/printf.c b/src/commands/printf.c index ce1631c..2a84b80 100644 --- a/src/commands/printf.c +++ b/src/commands/printf.c @@ -1,5 +1,4 @@ #include "../command.h" -#include static long cast_long(const char* arg) { char* end; diff --git a/src/commands/tail.c b/src/commands/tail.c index 24d7b1f..118a771 100644 --- a/src/commands/tail.c +++ b/src/commands/tail.c @@ -1,11 +1,5 @@ #include "../command.h" -#include -#include -#include -#include -#include - struct Flags { bool lines; int count; diff --git a/src/commands/tee.c b/src/commands/tee.c index 224463c..c500508 100644 --- a/src/commands/tee.c +++ b/src/commands/tee.c @@ -1,9 +1,6 @@ #include "../command.h" #include -#include -#include - static void help() { printf("Usage: tee [-ai] [FILE]...\n\n"); diff --git a/src/commands/wc.c b/src/commands/wc.c index 7132370..892ef2e 100644 --- a/src/commands/wc.c +++ b/src/commands/wc.c @@ -1,8 +1,6 @@ #include "../command.h" #include -#include -#include struct Flags { bool newlines; diff --git a/src/commands/whoami.c b/src/commands/whoami.c index efc9bcd..f19a724 100644 --- a/src/commands/whoami.c +++ b/src/commands/whoami.c @@ -1,8 +1,6 @@ #include "../command.h" #include -#include -#include static void help() { printf("Usage: whoami\n\n");