view toys/readlink.c @ 226:6aac63925eff

Update web pages.
author Rob Landley <rob@landley.net>
date Sat, 05 Jan 2008 18:09:49 -0600
parents 52a0c06b2dad
children d4176f3f3835
line wrap: on
line source

/* vi: set sw=4 ts=4: */
/*
 * readlink.c - Return string representation of a symbolic link.
 *
 * Not in SUSv3.
 */

#include "toys.h"

void readlink_main(void)
{
	char *s;

	// Calculating full cannonical path?

	if (CFG_READLINK_F && toys.optflags) s = realpath(*toys.optargs, NULL);
	else s = xreadlink(*toys.optargs);

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