delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/07/16/02:08:19

Date: Sun, 16 Jul 1995 08:19:31 +0300
From: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii)
To: Karl DOT Schock AT arbi DOT informatik DOT uni-oldenburg DOT de
Subject: Re: German Umlaute in arguments for a.out
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

> /* Then I startet it with    go32 a.out Gl"uh Wurm
>                                           ^^- We use so called Umlaute
>                                               in the german language, 
>   The output is:                              ( see MS-DOS Codepage 437,
>                                               Number 129 ).
>       Argumentnr. 0: a.out
>       Argumentnr. 1: Gl
>
>   thats all... :-(

That's a bug in go32 code which is invoked to produce the *argv[] array
before your application's main() function is called.  There is a function
there called parse_chars() which casts a char to an int and then decides
that any character <= 0 designates an end of the argv[i] string.  (This
code is in the file control.c which is part of go32 source distribution in
the djsrc112.zip archive.)  Characters with ASCII code greater than 128
produce a negative int during this cast, with the obvious results.

Solution: if you need this badly and can't wait until v2.0 (which doesn't
have this bug), get the go32 sources and correct that code (by using unsigned
chars as God intended).

Btw, a similar error lurks to get you in all of the ctype functions in the
v1.x library: they reference a character-classification array with an index
produced by casting the character to an int, which produces a negative index,
unless your char is an unsigned char.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019