diff options
author | merakor <cem@ckyln.com> | 2020-07-24 09:08:10 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-07-24 09:08:10 +0000 |
commit | 48b69beda9d38ea8d4211a9f8e037dc1851cc5f9 (patch) | |
tree | 4ff8b501feacc22aaf75866ab09b4dbefdf769dc /bin/kiss-readlink.c | |
parent | 191a1a9bb5c2092424311780334ac0ca8237220b (diff) | |
download | cpt-48b69beda9d38ea8d4211a9f8e037dc1851cc5f9.tar.gz |
rename binary programs
FossilOrigin-Name: f404639f07097134f93aa22cc5583ff73a6cd281aa4b1bbfd10053ebd97d7bf4
Diffstat (limited to 'bin/kiss-readlink.c')
-rw-r--r-- | bin/kiss-readlink.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/bin/kiss-readlink.c b/bin/kiss-readlink.c deleted file mode 100644 index cc6c8ff..0000000 --- a/bin/kiss-readlink.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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> -#include <libgen.h> -#include <string.h> -#include <limits.h> - -#define DIR_MAX PATH_MAX - NAME_MAX - 1 - - -char *realpath(const char *path, char *resolved_path); - -int -main(int argc, char *argv[]) -{ - - char buf[PATH_MAX]; - - /* We are going to use these if the file doesn't exist, but we can still - * use directories above the file. We are using dname and bname so that - * they don't clash with the functions with the same name. - */ - char dname[DIR_MAX]; /* directory name */ - char bname[NAME_MAX]; /* base name */ - sprintf(bname, "%s", (basename(argv[1]))); - - if (argc != 2 || strcmp(argv[1], "--help") == 0) { - fprintf(stderr, "usage: %s [file]\n", argv[0]); - return 1; - } - - if (!realpath(argv[1], buf)) { - - if (!realpath(dirname(argv[1]), dname)) { - perror(argv[0]); - return 1; - } - sprintf(buf, "%s/%s", dname, bname); - } - - printf("%s\n", buf); - return 0; -} |