From fb3c28fe89f9ca056404c14998f81a8ae46f7529 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 4 Apr 2022 12:12:18 -0500 Subject: [PATCH] realpath should parse -e The test USED to work because "unknown option -e" was ALSO an error, until last commit passed through the -e... --- toys/other/readlink.c | 9 ++------- 1 file 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(); -} -- 2.39.2