diff options
author | Joseph Hunkeler <jhunkeler@users.noreply.github.com> | 2020-05-07 06:11:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-07 06:11:13 -0400 |
commit | 26db5dff18a40b402d20a572953870aab549c5f2 (patch) | |
tree | 539d6a9800f41efad4ed50b1864aae1e677ccded /scripts/realpath.c | |
parent | 6cc450d8ff714af09374f9bc07aea8bb05f74a5c (diff) | |
parent | de47b0d91a79651088e76d64dc4b032146203cca (diff) | |
download | spmc-26db5dff18a40b402d20a572953870aab549c5f2.tar.gz |
Merge pull request #33 from jhunkeler/install-name-tool
Install name tool (etc...)
Diffstat (limited to 'scripts/realpath.c')
-rw-r--r-- | scripts/realpath.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/realpath.c b/scripts/realpath.c new file mode 100644 index 0000000..15504a0 --- /dev/null +++ b/scripts/realpath.c @@ -0,0 +1,28 @@ +#include <stdlib.h> +#include <stdio.h> +#include <errno.h> + +/** + * Apple loves being different. There's no `realpath` program on MacOS + * @param argc + * @param argv + * @return + */ +int main(int argc, char *argv[]) { + char *path; + + if (argc < 2) { + fprintf(stderr, "usage: %s filename\n", argv[0]); + return 1; + } + + path = realpath(argv[1], NULL); + if (path) { + puts(path); + free(path); + } else { + perror(argv[1]); + } + + return errno; +}
\ No newline at end of file |