aboutsummaryrefslogtreecommitdiff
path: root/toys/readlink.c
blob: 25dc7ba10272e6220ad9d00246d0caeace509326 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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;
}