diff options
Diffstat (limited to 'toys')
-rw-r--r-- | toys/readlink.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/toys/readlink.c b/toys/readlink.c new file mode 100644 index 00000000..25dc7ba1 --- /dev/null +++ b/toys/readlink.c @@ -0,0 +1,20 @@ +/* vi: set sw=4 ts=4: */ +/* + * readlink.c - Return string representation of a symbolic link. + */ +// Note: Hardware in LINK_MAX as 127 since it was removed from glibc. + +#include "toys.h" + +int readlink_main(void) +{ + char *s = xreadlink(*toys.optargs); + + if (s) { + xputs(s); + if (CFG_TOYBOX_FREE) free(s); + return 0; + } + + return 1; +} |