Pádraig Brady wrote: > On 12/12/2011 12:24 AM, Pádraig Brady wrote: >> FYI I'm not forgetting about this. >> This week I'll be travelling with work, >> but I intend to tackle this early the following week. > > Sorry for the delay. > Attached is the realpath implementation, which I think > turned into a good cohesive set of functionality. > It has this interface: > > Usage: src/realpath [OPTION] FILE... > Print the resolved absolute file name; > all but the last component must exist > > -e, --canonicalize-existing all components of the path must exist > -m, --canonicalize-missing no components of the path need exist > -L, --logical resolve `..' components before symlinks > -P, --physical resolve symlinks as encountered (default) > -q, --quiet suppress most error messages > --relative-to=FILE print the resolved path relative to FILE > --relative-base=FILE print absolute paths unless paths below FILE > -s, --strip don't expand symlinks > -z, --zero separate output with NUL rather than newline > > --help display this help and exit > --version output version information and exit > > I was going to add a --readlink option to call readlink(3), > but that's a separate function really, and since readlink(1) > is widely available, I thought it better to not duplicate? > > I was going to add a --common-prefix mode, to print > the common prefix of all supplied paths. > We can do this in future anyway. > > Note this patch required this small update to gnulib: > http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commit;h=8bcd0399
Nearly forgot. Please include a gnulib submodule update in your change-set, either as a prior commit or just squashed in.
