sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit 93043beec9aa39c1f908f025849f50c3cc4a0ea2
parent 7e035a9a2e08a79f9f408e81bba677b3f2dbdca9
Author: Eivind Uggedal <eivind@uggedal.com>
Date:   Thu,  4 Jun 2015 20:36:40 +0000

readlink: simplify -f

Use output from realpath(3) directly. This makes usage
with . more consistent with other implementations.

Diffstat:
Mreadlink.c | 7++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/readlink.c b/readlink.c @@ -76,11 +76,8 @@ mdone: eprintf("realpath %s:", argv[0]); break; case 'f': - p = dirname(estrdup(argv[0])); - if (!realpath(p, b)) - eprintf("realpath %s:", p); - estrlcat(b, "/", sizeof(arg)); - estrlcat(b, basename(estrdup(argv[0])), sizeof(arg)); + if (!realpath(argv[0], b)) + eprintf("realpath %s:", argv[0]); break; default: if ((n = readlink(argv[0], b, PATH_MAX - 1)) < 0)