Xref: utzoo comp.bugs.sys5:341 comp.bugs.4bsd:717 Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!necntc!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.bugs.sys5,comp.bugs.4bsd Subject: Re: VI bug Message-ID: <2811@haddock.ISC.COM> Date: 2 Mar 88 01:34:09 GMT References: <1027@sauron.Columbia.NCR.COM> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 14 In article <1027@sauron.Columbia.NCR.COM> wescott@sauron.Columbia.NCR.COM (Mike Wescott) writes: >[vi uses isdigit() on an out-of-band value] >Did isdigit() once have range checking built in? Or was it a version >called _isdigit()? Not that I know of. But a simple fix is #define isdigit(c) ((unsigned)((c)-'0') < (unsigned)10) which will work if the digits are contiguous. (This is true of every character set I'm familiar with, and required by ANSI C.) (I prefer to use such macros rather than , because many systems still implement the latter with a 128-character range, and I like my software to work even when you hand it 8-bit data.) Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint