aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toys/realpath.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/toys/realpath.c b/toys/realpath.c
index 715fa872..10457cf6 100644
--- a/toys/realpath.c
+++ b/toys/realpath.c
@@ -12,20 +12,20 @@ config REALPATH
bool "realpath"
default y
help
+ usage: realpath FILE...
+
Display the canonical absolute pathname
*/
#include "toys.h"
-static void do_realpath(int fd, char *name)
-{
- if (!realpath(name, toybuf))
- perror_exit("realpath: cannot access %s'", name);
-
- xprintf("%s\n", toybuf);
-}
-
void realpath_main(void)
{
- loopfiles(toys.optargs, do_realpath);
+ char **s = toys.optargs;
+ for (s = toys.optargs; *s; s++) {
+ if (!realpath(*s, toybuf)) {
+ perror_msg("cannot access '%s'", *s);
+ toys.exitval = 1;
+ } else xputs(toybuf);
+ }
}