summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md13
-rw-r--r--makefile25
2 files changed, 38 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4431400
--- /dev/null
+++ b/README.md
@@ -0,0 +1,13 @@
+Convenience function to replace every occurance of a string in a file with a replacement string, outputs to another file.
+
+Compile with ````make```` and run with ````./example````.
+
+
+definition in replace.h:
+
+````
+int replaceinfile(char *originalfile, char *destinationfile, char *placeholder, char *replacement);
+// 0 = failure, 1 = success
+````
+
+See main.c for a usage example
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..ecb68ed
--- /dev/null
+++ b/makefile
@@ -0,0 +1,25 @@
+TARGET = example
+LIBS =
+CC = gcc
+CFLAGS = -g -Wall -Werror
+
+.PHONY: default all clean
+
+default: $(TARGET)
+all: default
+
+OBJECTS = $(patsubst %.c, %.o, $(wildcard *.c))
+HEADERS = $(wildcard *.h)
+
+%.o: %.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $< -o $@
+
+.PRECIOUS: $(TARGET) $(OBJECTS)
+
+$(TARGET): $(OBJECTS)
+ $(CC) $(OBJECTS) -Wall $(LIBS) -o $@
+
+clean:
+ -rm -f *.o
+ -rm -f $(TARGET)
+