aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-03-17 23:33:56 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-03-17 23:33:56 +1300
commitcff2863f6b986490c5868bb177918666432c9f4c (patch)
tree779a9b12410883feee57b42cc287692893473808
parentFree memory in ls(1) too (diff)
downloadtunics-cff2863f6b986490c5868bb177918666432c9f4c.tar.gz
tunics-cff2863f6b986490c5868bb177918666432c9f4c.zip
Quick and utterly wrong pwd(1) implementation
-rw-r--r--.gitignore1
-rw-r--r--Makefile4
-rw-r--r--pwd.c9
-rw-r--r--pwd.h8
4 files changed, 20 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 1dcb821..4951cbe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
ls
+pwd
sort
diff --git a/Makefile b/Makefile
index cc23251..7e350b8 100644
--- a/Makefile
+++ b/Makefile
@@ -3,9 +3,9 @@
CC = clang
CFLAGS = -std=c90 -Weverything
-all : ls sort
+all : ls pwd sort
clean :
rm -f -- *.o
- rm -f ls sort
+ rm -f ls pwd sort
diff --git a/pwd.c b/pwd.c
new file mode 100644
index 0000000..8416ed4
--- /dev/null
+++ b/pwd.c
@@ -0,0 +1,9 @@
+#include "pwd.h"
+
+int main(void)
+{
+ char buf[1024];
+ fprintf(stdout, "%s\n", getcwd(buf, 1024));
+ exit(EXIT_SUCCESS);
+}
+
diff --git a/pwd.h b/pwd.h
new file mode 100644
index 0000000..7ea4bed
--- /dev/null
+++ b/pwd.h
@@ -0,0 +1,8 @@
+#ifndef __PWD_H
+#define __PWD_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#endif