On Wed, May 31, 2006 at 01:04:30AM +0000, Angus Leeming wrote:
> Enrico Forestieri <[EMAIL PROTECTED]> writes:
> > Agreed. But what's your point? I didn't mean to correct the possibly
> > broken dvipost code but only to let it work (or not work) on Windows
> > in the same way it works (or doesn't work) on *nix.
> 
> Fair enough.
> 
> Note, however, that "foo\bar/baz" is a valid path on Windows and might be
> expected to work the same way as the equally valid "foo/bar/baz".
> 
> Personally, I'd change your code to something like
> 
>   char* p1 = strrchr(arg, '/');
>   char* p2 = strrchr(arg, '\\');
>   /* Not sure whether the casts are needed. */
>   char* p = ((void*)p2 > (void*)p1) ? p2 : p1;

Eh, no! If you want to play the perfectionism game you should try
to be perfect ;-)

What if both p1 and p2 are NULL? Then you should also consider that
"C:foo" is a valid path on Windows, too ;-)

Sorry, couldn't resist. We say "chi di spada ferisce, di spada perisce",
which I think can be translated as "they that live by the sword shall
die by the sword" ;-)

> But I'll butt out now and go to bed.

Sweet dreams ;-)

-- 
Enrico

Reply via email to