Re: RFC: add relative file name handling for linespecs

Tom Tromey
2012-01-11T21:49:55Z

>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:

Tom> +/* See whether FILENAME matches SEARCH_NAME using the rule that we
Tom> + advertise to the user.

Eli> Why not say explicitly how the names are matched? "The rule we
Eli> advertise" doesn't give any hint where to look for that rule, so the
Eli> issue remains a mystery and requires to read the source to glean what
Eli> this does.

I will mention the manual.

Tom> + /* Either the names must completely match, or the character
Tom> + preceding the trailing SEARCH_NAME segment of FILENAME must be a
Tom> + directory separator. */
Tom> + return (len == search_len
Tom> + || IS_DIR_SEPARATOR (filename[len - search_len - 1]));

Eli> What about the (somewhat perverse) case of "d:foo/bar" and "foo/bar"
Eli> on Windows?

Would something like this work?

|| (HAS_DRIVE_SPEC (filename) && len - search_len == 2)

Tom