summaryrefslogtreecommitdiff
path: root/src/pwd.c
diff options
context:
space:
mode:
authorJake Mannens <jakem_5@hotmail.com>2020-03-25 13:21:37 +1100
committerJake Mannens <jakem_5@hotmail.com>2020-03-25 13:21:37 +1100
commitddb2cfd8a74670382e61bad0b567f3d30e9aea70 (patch)
treef3208f7ff10a187442c26a48a0d68c5b134ef7db /src/pwd.c
Initial commitHEADmaster
Diffstat (limited to 'src/pwd.c')
-rw-r--r--src/pwd.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/pwd.c b/src/pwd.c
new file mode 100644
index 0000000..b884933
--- /dev/null
+++ b/src/pwd.c
@@ -0,0 +1,17 @@
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+int main(int argc, char **argv) {
+ char buf[1024];
+
+ if(!getcwd(buf, sizeof(buf))) {
+ perror("Error getting current directory");
+ return EXIT_FAILURE;
+ }
+
+ puts(buf);
+ return 0;
+}