From: "Rafael García" Newsgroups: comp.os.msdos.djgpp Subject: RE: atoi() with 8 bit chars Date: Thu, 1 Mar 2001 14:44:03 +0100 Organization: BT Tel. Netnews service (readers) Lines: 58 Message-ID: <3a9e528a$1@filemon.telecable.es> References: <3a9cf8f1$1 AT filemon DOT telecable DOT es> <1438-Wed28Feb2001223955+0200-eliz AT is DOT elta DOT co DOT il> NNTP-Posting-Host: filemon.telecable.es Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: titan.bt.es 983454250 13500 212.89.0.4 (1 Mar 2001 13:44:10 GMT) X-Complaints-To: abuse AT bt DOT es NNTP-Posting-Date: 1 Mar 2001 13:44:10 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 X-Original-NNTP-Posting-Host: cm05118.telecable.es To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii escribió en el mensaje de noticias 1438-Wed28Feb2001223955+0200-eliz AT is DOT elta DOT co DOT il... > It's a bug in the library; thanks for reporting it. Here's a patch > for the strtol function which is responsible for this bug: > ......... I don't know how to aply that. I only have binary version of the compiler. Nor I am interested in substitute all the compiler instalations I can use. I prefer to patch my own source when compiling with DJGPP: In a general header I have put: #ifdef __DJGPP__ #define atol myatol #define atoi (int)myatol #define strtol mystrtol #endif Then, all the source code stay untouched, except one file that includes this: #ifdef __DJGPP__ #undef atol // now I have to call original ones #undef atoi #undef strtol long myatol(const char *s) { while (isspace(*s)) s++; if (*s & 0x80) return 0; else return atol(s); } long mystrtol(const char *s, char **endp, int base) { while (isspace(*s)) s++; if (*s & 0x80) { if (endp) *endp=s; return 0; } else return strtol(s,endp,base); } #endif Well, this works ok, but I have two questions: 1) How can I remove "assignment discards qualifiers from pointer target type" warning at "*endp=s" line? 2) Is it possible to know library version, to not use this patch when not necessary?... Something like #if defined(__DJGPP__) && (__DJGPPVER__