diff options
Diffstat (limited to 'toys')
-rw-r--r-- | toys/other/readlink.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/toys/other/readlink.c b/toys/other/readlink.c index fecd1ef8..2e0cf11e 100644 --- a/toys/other/readlink.c +++ b/toys/other/readlink.c @@ -2,7 +2,7 @@ * * Copyright 2007 Rob Landley <rob@landley.net> -USE_READLINK(NEWTOY(readlink, "<1>1fenq[-fe]", TOYFLAG_USR|TOYFLAG_BIN)) +USE_READLINK(NEWTOY(readlink, "<1>1nqmef[-mef]", TOYFLAG_USR|TOYFLAG_BIN)) config READLINK bool "readlink" @@ -16,6 +16,7 @@ config READLINK -e cannonical path to existing entry (fail if missing) -f full path (fail if directory missing) + -m ignore missing entries, show where it would be -n no trailing newline -q quiet (no output, just error code) */ @@ -28,9 +29,9 @@ void readlink_main(void) char *s; // Calculating full cannonical path? - - if (toys.optflags & (FLAG_f|FLAG_e)) - s = xabspath(*toys.optargs, toys.optflags & FLAG_e); + // Take advantage of flag positions to calculate m = -1, f = 0, e = 1 + if (toys.optflags & (FLAG_f|FLAG_e|FLAG_m)) + s = xabspath(*toys.optargs, (toys.optflags&(FLAG_f|FLAG_e))-1); else s = xreadlink(*toys.optargs); if (s) { |