--- In [email protected], "brucexs" <bswit...@...> wrote: > Main reason I can see for doing that is that one might be seeing hex, in > particular leading 0x. But as you're normally using it to convert an > incoming it's coming in via an argument, e.g., *(szargs+3), I assume even if > user had typed > > 0x0FB it would already have been converted to a number internally, than > > back into a string for sending to plugin? Or are you thinking user might > > have called with "0x0FB", which I suppose might stay a string and never get > > converted? > No, never even thought about above. You are right above conversion of 0xhhh > and "0xhhh" is not supposed to work as a hex number. Thinking about it more, strtoul will also fail if also fail if base parameter is 10, which it normally would be. Woukld only work in general case (expecting a number, user might have passed in numeric string in quotes) if you scanned *(szargs+n) for "x", like
strtoul( *(szargs+n), &endptr, (strchr(*(szargs+n), 'x') ? 16 : 10)); but that's trying to be smarter than users. Best just say "0xhhh" isn't a number, stick to pp rules.
