view toys/other/realpath.c @ 1433:00c20f410c46 draft

Patches to commands for issues reported from static analysis tool. portability.h.patch - it is for O_CLOEXEC, as compiler complained of it. Makefile.patch - for cleaning generated/*.o files and libopts.dat file [Fixup to uniq.c from Rob.]
author Ashwini Sharma <ak.ashwini1981@gmail.com>
date Tue, 12 Aug 2014 07:09:01 -0500
parents 6cc69be43c42
children
line wrap: on
line source

/* realpath.c - Return the canonical version of a pathname
 *
 * Copyright 2012 Andre Renaud <andre@bluewatersys.com>

USE_REALPATH(NEWTOY(realpath, "<1", TOYFLAG_USR|TOYFLAG_BIN))

config REALPATH
  bool "realpath"
  default y
  help
    usage: realpath FILE...

    Display the canonical absolute pathname
*/

#include "toys.h"

void realpath_main(void)
{
  char **s = toys.optargs;

  for (s = toys.optargs; *s; s++) {
    if (!realpath(*s, toybuf)) perror_msg("%s", *s);
    else xputs(toybuf);
  }
}