From: Assaf Gordon Date: Sat, 24 Jun 2017 23:47:26 +0000 (-0400) Subject: realpath: improve usage description for --relative-{to,base} X-Git-Tag: v8.28~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65b7bf790c5600611d3420d94b7fde539e428f3d;p=thirdparty%2Fcoreutils.git realpath: improve usage description for --relative-{to,base} * src/realpath.c (usage): Explicitly say 'DIR' instead of 'FILE' for --relative-{to,base} parameters, to avoid giving the impression that regular files can be used as relative base. * doc/coreutils.texi (realpath): Same. --- diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 8f1cb4c5f9..06d0659405 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -14113,22 +14113,22 @@ This is the default mode of operation. @opindex --quiet Suppress diagnostic messages for specified file names. -@item --relative-to=@var{file} +@item --relative-to=@var{dir} @opindex --relative-to @cindex relpath -Print the resolved file names relative to the specified file. +Print the resolved file names relative to the specified directory. Note this option honors the @option{-m} and @option{-e} options pertaining to file existence. -@item --relative-base=@var{base} +@item --relative-base=@var{dir} @opindex --relative-base This option is valid when used with @option{--relative-to}, and will restrict the output of @option{--relative-to} so that relative names are output, -only when @var{file}s are descendants of @var{base}. Otherwise output the +only when @var{file}s are descendants of @var{dir}. Otherwise output the absolute file name. If @option{--relative-to} was not specified, then -the descendants of @var{base} are printed relative to @var{base}. If +the descendants of @var{dir} are printed relative to @var{dir}. If @option{--relative-to} is specified, then that directory must be a -descendant of @var{base} for this option to have an effect. +descendant of @var{dir} for this option to have an effect. Note: this option honors the @option{-m} and @option{-e} options pertaining to file existence. For example: diff --git a/src/realpath.c b/src/realpath.c index 92d88c5a42..d4c159573d 100644 --- a/src/realpath.c +++ b/src/realpath.c @@ -81,8 +81,8 @@ all but the last component must exist\n\ -L, --logical resolve '..' components before symlinks\n\ -P, --physical resolve symlinks as encountered (default)\n\ -q, --quiet suppress most error messages\n\ - --relative-to=FILE print the resolved path relative to FILE\n\ - --relative-base=FILE print absolute paths unless paths below FILE\n\ + --relative-to=DIR print the resolved path relative to DIR\n\ + --relative-base=DIR print absolute paths unless paths below DIR\n\ -s, --strip, --no-symlinks don't expand symlinks\n\ -z, --zero end each output line with NUL, not newline\n\ \n\