🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.sys5
Article #690

Re: VI bug

#690
From: Karl Heuer
Date: Wed, 02 Mar 1988 01:34
15 lines
1143 bytes
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 <ctype.h>, 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
Technical Details
Message-ID: <2811@haddock.ISC.COM>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!necntc!ima!haddock!karl
References: <1027@sauron.Columbia.NCR.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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