aboutsummaryrefslogtreecommitdiff
path: root/bin/kiss-readlink.c
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-05-04 10:24:50 +0000
committermerakor <cem@ckyln.com>2020-05-04 10:24:50 +0000
commit40ceb8f388be5a3662ba53cf298b451ab4ec5c2a (patch)
tree8a9b0011a4beaa670f654acde3ee59d2ebbd64d8 /bin/kiss-readlink.c
parent0897228d01ff2aae1b9773f2a93d6f9942dd241b (diff)
downloadcpt-40ceb8f388be5a3662ba53cf298b451ab4ec5c2a.tar.gz
kiss-readlink: add 'readlink -f' replacement
FossilOrigin-Name: 9e79f1a481f6d703182f086417f76c41b67e5ac180b9c3c79029cb151a770ec8
Diffstat (limited to 'bin/kiss-readlink.c')
-rw-r--r--bin/kiss-readlink.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/bin/kiss-readlink.c b/bin/kiss-readlink.c
new file mode 100644
index 0000000..15a5fa3
--- /dev/null
+++ b/bin/kiss-readlink.c
@@ -0,0 +1,25 @@
+// kiss-readlink --- a utility replacement for readlink
+// See LICENSE for copyright information
+
+// This is basically a 'readlink -f' command.
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char *argv[]) {
+
+ char buf[512];
+
+ if (argc != 2) {
+ printf("usage: %s FILE\n", argv[0]);
+ return(1);
+ }
+
+ if (!realpath(argv[1], buf)) {
+ perror("realpath:");
+ return(1);
+ }
+
+ // fputs(buf,stdout);
+ printf("%s\n", buf);
+ return(0);
+}