Re: Read hex string to a buf



In article <lnwt3338ks.fsf@xxxxxxxxxxxxxxx>,
Keith Thompson <kst-u@xxxxxxx> wrote:
Christopher Layne <clayne@xxxxxxxxxxxx> writes:
Keith Thompson wrote:
[...]
const size_t minl = 2;
const size_t nibl = 4;
const char delim[2] = "0x";
const char set[2][16] = { "0123456789abcdef", "0123456789ABCDEF" };

You accept hexadecimal digits in either upper or lower case, but you
don't do the same for "0x" vs. "0X".

Sigh.

/* Make Keith Thompson Happy */
if (q[0] == '0' && (q[1] == 'x' || q[1] == 'X')) {
q += minl; l -= minl;
}

It doesn't make me either happy or unhappy.

There's a rumor floating around that KT was happy. Once.
Sometime back in the mid 60s. Nobody's sure what caused it.
Many don't believe it ever happened.

.



Relevant Pages