delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/08/03/08:37:40

Date: Tue, 3 Aug 1999 10:38:42 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: DJ Delorie <dj AT delorie DOT com>
cc: pavenis AT lanet DOT lv, djgpp-workers AT delorie DOT com
Subject: Re: sscanf() format %p seems to be broken
In-Reply-To: <199908021430.KAA01030@envy.delorie.com>
Message-ID: <Pine.SUN.3.91.990803103805.1847G-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 2 Aug 1999, DJ Delorie wrote:

> > DJ, is it a good idea to have %p imply the base of 16 in doscan.c?
> 
> The only rule is that what printf prints for %p is what scanf should
> expect for %p.  It could be in pig-latin as long as it worked.
> Borland, for example, prints 0000:0000 in some models.

I believe the patch below solves the problem.  Andris, could you
please see if it helps to pass the test where you discovered this
problem?

*** src/libc/ansi/stdio/doscan.c~3	Wed Jul 28 18:08:52 1999
--- src/libc/ansi/stdio/doscan.c	Mon Aug  2 22:31:44 1999
*************** _innum(int **ptr, int type, int len, int
*** 195,201 ****
    base = 10;
    if (type=='o')
      base = 8;
!   else if (type=='x')
      base = 16;
    np = numbuf;
    expseen = 0;
--- 195,201 ----
    base = 10;
    if (type=='o')
      base = 8;
!   else if (type=='x'||type=='p')
      base = 16;
    np = numbuf;
    expseen = 0;

- Raw text -


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