aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-08-22 19:43:03 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-08-22 19:43:03 +0200
commitc40f79737a4ce6ae0cd8bd6ea7f302217333e486 (patch)
tree5afe1af26880bd7f8b16ee33fb8e14f99f665938
parentf204fe59bd5fa537bf84cb522339c92b16f5a909 (diff)
downloadcoreutils-c40f79737a4ce6ae0cd8bd6ea7f302217333e486.tar.gz
coreutils-c40f79737a4ce6ae0cd8bd6ea7f302217333e486.tar.bz2
coreutils-c40f79737a4ce6ae0cd8bd6ea7f302217333e486.zip
Added Makefile
-rw-r--r--.gitignore1
-rw-r--r--Makefile52
-rw-r--r--src/basename.c (renamed from basename.c)0
-rw-r--r--src/chown.c (renamed from chown.c)1
-rw-r--r--src/cut.c (renamed from cut.c)0
-rw-r--r--src/head.c (renamed from head.c)0
-rw-r--r--src/mkdir.c (renamed from mkdir.c)0
-rw-r--r--src/mv.c (renamed from mv.c)0
-rw-r--r--src/rm.c (renamed from rm.c)0
-rw-r--r--src/seq.c (renamed from seq.c)0
-rw-r--r--src/shuf.c (renamed from shuf.c)0
-rw-r--r--src/tee.c (renamed from tee.c)0
-rw-r--r--src/tr.c (renamed from tr.c)39
13 files changed, 74 insertions, 19 deletions
diff --git a/.gitignore b/.gitignore
index d7756c2..11269e8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
a.out
*.o
+bin/*
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..edb7787
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,52 @@
+BINDIR = bin
+SRCDIR = src
+
+CC = gcc
+CCFLAGS = -Wall -Wextra -Wpedantic
+
+all: prebuild $(BINDIR)/basename $(BINDIR)/chown $(BINDIR)/cut $(BINDIR)/head \
+ $(BINDIR)/mkdir $(BINDIR)/mv $(BINDIR)/rm $(BINDIR)/seq \
+ $(BINDIR)/shuf $(BINDIR)/tee $(BINDIR)/tr
+
+prebuild:
+ mkdir -vp $(BINDIR)
+
+$(BINDIR)/basename: $(SRCDIR)/basename.c
+ $(CC) $(CCFLAGS) -o $@ $^
+
+$(BINDIR)/chown: $(SRCDIR)/chown.c
+ $(CC) $(CCFLAGS) -o $@ $^
+
+$(BINDIR)/cut: $(SRCDIR)/cut.c
+ $(CC) $(CCFLAGS) -o $@ $^
+
+$(BINDIR)/head: $(SRCDIR)/head.c
+ $(CC) $(CCFLAGS) -o $@ $^
+
+$(BINDIR)/mkdir: $(SRCDIR)/mkdir.c
+ $(CC) $(CCFLAGS) -o $@ $^
+
+$(BINDIR)/mv: $(SRCDIR)/mv.c
+ $(CC) $(CCFLAGS) -o $@ $^
+
+$(BINDIR)/rm: $(SRCDIR)/rm.c
+ $(CC) $(CCFLAGS) -o $@ $^
+
+$(BINDIR)/seq: $(SRCDIR)/seq.c
+ $(CC) $(CCFLAGS) -o $@ $^
+
+$(BINDIR)/shuf: $(SRCDIR)/shuf.c
+ $(CC) $(CCFLAGS) -o $@ $^
+
+$(BINDIR)/tee: $(SRCDIR)/tee.c
+ $(CC) $(CCFLAGS) -o $@ $^
+
+$(BINDIR)/tr: $(SRCDIR)/tr.c
+ $(CC) $(CCFLAGS) -o $@ $^
+
+clean:
+ rm -vf $(BINDIR)/*
+
+re: clean all
+
+.PHONY: prebuild all clean re
diff --git a/basename.c b/src/basename.c
index 83f3b8f..83f3b8f 100644
--- a/basename.c
+++ b/src/basename.c
diff --git a/chown.c b/src/chown.c
index d273afd..c181d37 100644
--- a/chown.c
+++ b/src/chown.c
@@ -6,6 +6,7 @@
#include <string.h>
#include <stdarg.h>
#include <sys/types.h>
+#include <sys/stat.h>
#include <pwd.h>
#include <limits.h>
#include <dirent.h>
diff --git a/cut.c b/src/cut.c
index 2a7990d..2a7990d 100644
--- a/cut.c
+++ b/src/cut.c
diff --git a/head.c b/src/head.c
index f2201b5..f2201b5 100644
--- a/head.c
+++ b/src/head.c
diff --git a/mkdir.c b/src/mkdir.c
index 3ab73d1..3ab73d1 100644
--- a/mkdir.c
+++ b/src/mkdir.c
diff --git a/mv.c b/src/mv.c
index 46eab14..46eab14 100644
--- a/mv.c
+++ b/src/mv.c
diff --git a/rm.c b/src/rm.c
index 2bcf68f..2bcf68f 100644
--- a/rm.c
+++ b/src/rm.c
diff --git a/seq.c b/src/seq.c
index 8307fc4..8307fc4 100644
--- a/seq.c
+++ b/src/seq.c
diff --git a/shuf.c b/src/shuf.c
index 5b4808a..5b4808a 100644
--- a/shuf.c
+++ b/src/shuf.c
diff --git a/tee.c b/src/tee.c
index 4df5074..4df5074 100644
--- a/tee.c
+++ b/src/tee.c
diff --git a/tr.c b/src/tr.c
index f47b9f5..a423794 100644
--- a/tr.c
+++ b/src/tr.c
@@ -203,25 +203,26 @@ int main(int argc, char **argv)
{
for (size_t i = 0; i < read_size; i++)
{
- if (flags & FLAG_DELETE && flags & FLAG_SQUEEZE)
- {
-
- }
- else if (flags & FLAG_DELETE && match())
- {
- memmove(&buf[i], &buf[i + 1], read_size - i);
-
- else if (flags & FLAG_SQUEEZE)
- {
- while (match(s[i + 1]))
-
- memmove(&buf[i + 1], &buf[i + 2], read_size - i);
- }
- else
- {
- if (match())
- buf[i] = set2
- }
+ /* if (flags & FLAG_DELETE && flags & FLAG_SQUEEZE) */
+ /* { */
+ /* */
+ /* } */
+ /* else if (flags & FLAG_DELETE && match()) */
+ /* { */
+ /* memmove(&buf[i], &buf[i + 1], read_size - i); */
+ /* */
+ /* } */
+ /* else if (flags & FLAG_SQUEEZE) */
+ /* { */
+ /* while (match(s[i + 1])) */
+ /* */
+ /* memmove(&buf[i + 1], &buf[i + 2], read_size - i); */
+ /* } */
+ /* else */
+ /* { */
+ /* if (match()) */
+ /* buf[i] = set2 */
+ /* } */
}
}