bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MirBSD mbtowc bug? failure on test-wcrtomb


From: Thorsten Glaser
Subject: Re: MirBSD mbtowc bug? failure on test-wcrtomb
Date: Sat, 23 Oct 2010 16:08:33 +0000 (UTC)

You can detect OPTU-8 with the following code:

#include <wchar.h>
#ifndef MB_LEN_MAX
#define MB_LEN_MAX 8
#endif

int
main(void)
{
        char buf[MB_LEN_MAX > 8 ? MB_LEN_MAX : 8];
        if (wcrtomb(buf, 0xEF80, NULL) != 1)
                return (1);
        return ((*((unsigned char *)buf) == 0x80) ? 0 : 1);
}

Since it’s a programme on its own and doesn’t call setlocale,
chances it’ll return 0 on non-MirBSD are minimal.

HTH,
//mirabilos
-- 
> emacs als auch vi zum Kotzen finde (joe rules) und pine für den einzig
> bedienbaren textmode-mailclient halte (und ich hab sie alle ausprobiert). ;)
Hallooooo, ich bin der Holger ("Hallo Holger!"), und ich bin ebenfalls
... pine-User, und das auch noch gewohnheitsmäßig ("Oooooooohhh").  [aus dasr]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]