Email List: Xaustin-review-lX
[All Lists]

Defect in XSH fscanf

To: yyyyyyyyyyyyyyy@xxxxxxxxxxxxx
Subject: Defect in XSH fscanf
From: yyyyyy@xxxxxxxxxxxxx
Date: Wed, 22 Feb 2006 16:28:44 GMT
        Defect report from : Andrew Josey , The Open Group

(Please direct followup comments direct to yyyyyyyyyyyyyy@xxxxxxxxxxxxx)

@ page 444 line 14627 section fscanf comment {lsb-ottawa-3}

Problem:

Edition of Specification (Year): 2004

Defect code :  2. Omission

LSB supports a %a flag that conflicts with ISO C. It is recognized 
that the functionality is useful and proposed to add the 
functionality using a different flag.


Action:

Insert after line 14664

(bullet list item)An optional assignment-allocation character `M`.

The %s, %S and %[ conversion specifiers shall accept an optional 
assignment-allocation character M, which shall cause a memory buffer 
to be allocated to hold the string converted including a terminating
null character. In such a case, the argument corresponding to the
conversion specifier should be a  reference to a pointer value that
will receive a pointer to the  allocated buffer. If there is insufficient 
memory to allocate a buffer, the function may set 
errno to [ENOMEM] and a conversion error results.
The system shall allocate a buffer as if malloc had been called. The 
application shall be responsible for freeing the memory after usage.
(note, need to rework language for last piece, an alternative could be
After use the buffer allocated by the fscanf call should be freed by a call to 
free() )


Also add to the ERRORS section after line 14811
[ENOMEM]

On line 14674 (description of ell). Add to end of para:
If the M assignment-allocation character is specified, the 
conversion applies to an argument with the type pointer to 
pointer to wchar_t.

Rework 14724-14727
If the M assignment-allocation character is not specified, the 
application shall ensure ..(existing words)... . 
Otherwise the application shall ensure that the corresponding 
argument is a pointer to a pointer to a wchar_t

Similarly at 14717-14720
If the M assignment-allocation character is not specified,
the application shall ensure that the corresponding argument is a pointer to 
the initial byte of an array of  char, signed char,orunsigned char large enough 
to accept the sequence and a  terminating null character code, which shall be 
added automatically.
Otherwise the application shall ensure that the corresponding 
argument is a pointer to a pointer to a char.

Similarly changes need to be made to [ line 14728 
(The application shall ensure....)
and line 14733 (ditto)

Again at lines 14751, 14756 for the c character

We need also to make a parallel set of changes to the  fwscanf() page.

(minimally this has to be at least CX shaded, actual shading tbd)

<Prev in Thread] Current Thread [Next in Thread>