sbase

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

commit 8b8ac3852d6af52a3ce78dee83dfdfc0383b0d7d
parent 5b74ae1ec0bd8667b6d2b573aec527490ae67dda
Author: Eivind Uggedal <eivind@uggedal.com>
Date:   Thu Jun  4 20:36:40 +0000

readlink: simplify -f

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

Diffstat:
readlink.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)