On Wed, Oct 17, 2012 at 07:14:50AM -0400, A. Costa wrote:
> A trailing '-' triggers inaccurate error messages:
>
> % for f in F G P w ; do dlocate -$f - | head -n 1 ; done
> dlocate: unknown option '-F'
> dlocate: unknown option '-G'
> dlocate: unknown option '-P'
> dlocate: unknown option '-w'
>
> Yet '-F' and the others are known options.
this is triggered by any unknown option, not just a bare '-'.
dlocate is passing "$1" rather than "$p" to dlocate_option_error(). will
fix in next release.
--- dlocate.orig 2009-06-03 11:29:06.000000000 +1000
+++ dlocate 2012-10-20 14:14:40.182338526 +1100
@@ -199,7 +199,7 @@
;;
(-*)
- dlocate_option_error $1
+ dlocate_option_error "$p"
;;
dlocate also needs a documentation fix.
dlocate's current help says:
-- stop processing commands and options. remainder of
command-line is filename(s)
It should say "search pattern or filename" rather than "filename(s)".
i.e. the same as any other command that has to deal with filenames or
regexp patterns beginning with a '-'.
oddly, GNU grep doesn't document '--' in the man page or in 'grep
--help'. pcregrep has a nice explanation in its man page, I think i'll
borrow that:
-- This terminates the list of options. It is useful if the next
item on the command line starts with a hyphen but is not an
option. This allows for the processing of patterns and file-
names that start with hyphens.
craig
--
craig sanders <[email protected]>
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]