view toys/readlink.c @ 143:9cbb323f297f

Break out dirtree.c and let it call a function instead of returning the data.
author Rob Landley <rob@landley.net>
date Thu, 04 Oct 2007 02:04:10 -0500
parents 0dfead29c893
children 25447caf1b4b
line wrap: on
line source

/* 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;
}