From 5288145aa65813308c52e56714bea7728bcd4175 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 18 Jun 2007 00:15:48 -0400 Subject: Add readlink. Why doesn't mercurial show newly added files in "hg diff"? --- toys/readlink.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 toys/readlink.c 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; +} -- cgit v1.2.3