aboutsummaryrefslogtreecommitdiff
path: root/toys/readlink.c
blob: 60a49770a409169a3f1adc14c5511f196440d7a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* 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"

void readlink_main(void)
{
	char *s = xreadlink(*toys.optargs);

	if (s) {
		xputs(s);
		if (CFG_TOYBOX_FREE) free(s);
	} else toys.exitval = 1;
}