> From: Pedro Alves <pe...@codesourcery.com> > Date: Tue, 8 Mar 2011 22:37:59 +0000 > Cc: DJ Delorie <d...@redhat.com>, > Eli Zaretskii <e...@gnu.org>, > ktiet...@googlemail.com, > binut...@sourceware.org, > gcc-patches@gcc.gnu.org > > Actually, is there any case where lbasename wouldn't > work instead of filename_dirrchr?
Almost: lbasename returns a pointer one character _after_ the last slash. It also skips the drive letter on DOS/Windows (which might be TRT, actually). It would be reasonable to rewrite filename_dirrchr in terms of lbasename, though, by backing up the pointer returned by lbasename if it points to a slash, and otherwise returning NULL. The case of "d:foo" should also be resolved (probably, return a pointer to the colon).