1 // http://stackoverflow.com/questions/284662/how-do-you-normalize-a-file-path-in-bash
2 // also readlink -nf ~/xxx
3 // realpath.c: display the absolute path to a file or directory.
4 // Adam Liss, August, 2007
5 // This program is provided "as-is" to the public domain, without express or
6 // implied warranty, for any non-profit use, provided this notice is maintained.
14 static char *s_pMyName
;
18 int main(int argc
, char *argv
[])
24 s_pMyName
= strdup(basename(argv
[0]));
29 printf("%s\n", realpath(argv
[1], sPath
));
35 fprintf(stderr
, "usage: %s PATH\n", s_pMyName
);