Re: skip_multibyte_char()

Christopher R. Hertel (crh@NTS.Umn.EDU)
Wed, 8 Apr 1998 12:11:42 -0500 (CDT)

From:	"Christopher R. Hertel" <crh@NTS.Umn.EDU>
Message-Id: <199804081711.MAA26551@unet.unet.umn.edu>
Subject: Re: skip_multibyte_char()
To:	jallison@whistle.com (Jeremy Allison)
Date:	Wed, 8 Apr 1998 12:11:42 -0500 (CDT)
In-Reply-To: <352AAD06.3B54AFBF@whistle.com> from "Jeremy Allison" at Apr 7, 98 03:47:34 pm

Jeremy typed:
>
> I think they can. One character that will never be in a multibyte
> character though is the dot '.' character - all the second bytes of
> multibyte characters start above 0x40 (dot is 0x2e). But there's
> nothing to stop the filename extension being multibyte. But this
> allows you to unambiguously find the dot at the start of an
> extension without having to do a multibyte string walk.
>
> However, just treating the multibyte extension as 'n'
> bytes also works - as the 8.3 extension is on *bytes*,
> not characters.
>

So, if I understand correctly, my test works.

Basically, I'm trying to find out if the extension was mangled. Andrew's
version simply checked that there was a dot and that the part following
the dot was less than four characters (he used strlen(), though, so I
assume that this is three or less bytes rather than "characters").

My test does a string compare between the mangled and unmangled
extensions. If they both exist, are both lower case, and match (the
mangled extension being three or less bytes) then I call it a match--which
means that the extension on the mangled name is *not* mangled.

I think that this is is correct, as I believe that the purpose of Andrew's
test was to determine that the extension was not mangled. My test is a
bit more cautious in that it compares the extensions, but that's the only
real difference.

Basically, what it comes down to is this:

Can a mangled name have an extension with a multi-byte characater (only
one would fit) or would name mangling mangle such an extension?

I think the answer is that the mangled extension won't have any
multi-byte characters.

Chris -)-----

-- 
Christopher R. Hertel -)-----                   University of Minnesota
crh@nts.umn.edu              Networking and Telecommunications Services