aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2022-04-04 12:12:18 -0500
committerRob Landley <rob@landley.net>2022-04-04 12:12:18 -0500
commitfb3c28fe89f9ca056404c14998f81a8ae46f7529 (patch)
treea6b0f31ba43222a64dde63e098c51613a104e59a
parent42ce6272f5a3824bc3512c1888384e3914a386b5 (diff)
downloadtoybox-fb3c28fe89f9ca056404c14998f81a8ae46f7529.tar.gz
realpath should parse -e
The test USED to work because "unknown option -e" was ALSO an error, until last commit passed through the -e...
-rw-r--r--toys/other/readlink.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/toys/other/readlink.c b/toys/other/readlink.c
index 55234ccf..3155dcc5 100644
--- a/toys/other/readlink.c
+++ b/toys/other/readlink.c
@@ -4,7 +4,7 @@
// -ef positions match ABS_FILE ABS_PATH
USE_READLINK(NEWTOY(readlink, "<1nqmef(canonicalize)[-mef]", TOYFLAG_USR|TOYFLAG_BIN))
-USE_REALPATH(NEWTOY(realpath, "<1", TOYFLAG_USR|TOYFLAG_BIN))
+USE_REALPATH(OLDTOY(realpath, readlink, TOYFLAG_USR|TOYFLAG_BIN))
config READLINK
bool "readlink"
@@ -39,6 +39,7 @@ void readlink_main(void)
{
char **arg, *s;
+ if (toys.which->name[3]=='l') toys.optflags |= FLAG_f;
for (arg = toys.optargs; *arg; arg++) {
// Calculating full canonical path?
// Take advantage of flag positions: m = 0, f = ABS_PATH, e = ABS_FILE
@@ -52,9 +53,3 @@ void readlink_main(void)
} else toys.exitval = 1;
}
}
-
-void realpath_main(void)
-{
- toys.optflags = FLAG_f;
- readlink_main();
-}