Symbolic Links - Absolute Paths to Relative Paths

1. Relative path to Absolute path

I'm looking for a C algorithm to convert relative paths to an absolute

For instance, I want to resolve "/usr/bin/X11/../ls" into "/usr/bin/ls."
But I would also like to generally clean up a path as well; eg.
"/usr/bin//ls" to "/usr/bin/ls," and so on.

Years ago I saw an algorithm to do this, posted here, but I have since
lost the darn thing.

Thanks for any ideas,

2. Loadlin and Ethernet Initialization

3. Relative path to Absolute Path

4. Print on LexMakr

5. C: get absolute path to a file from relative path

6. WAIS for Linux ...

7. Add an absolute path prefix only to relative paths

8. Help with RH 4.0 install (X lockup)

9. Symbolic links -- absolute and relative

10. Converting absolute symbolic links to relative?

11. How to convert a relative path into an absolute one?

12. tarring absolute paths for relative untar

13. Make relative tar path absolute at extraction