toybox/toys/other/realpath.c
<<
>>
Prefs
   1/* realpath.c - Return the canonical version of a pathname
   2 *
   3 * Copyright 2012 Andre Renaud <andre@bluewatersys.com>
   4
   5USE_REALPATH(NEWTOY(realpath, "<1", TOYFLAG_USR|TOYFLAG_BIN))
   6
   7config REALPATH
   8  bool "realpath"
   9  default y
  10  help
  11    usage: realpath FILE...
  12
  13    Display the canonical absolute pathname
  14*/
  15
  16#include "toys.h"
  17
  18void realpath_main(void)
  19{
  20  char **s = toys.optargs;
  21
  22  for (s = toys.optargs; *s; s++) {
  23    if (!realpath(*s, toybuf)) perror_msg_raw(*s);
  24    else xputs(toybuf);
  25  }
  26}
  27