Re: [Hampshire] scanf conversion - anyone know what "%m" is?

Top Page

Reply to this message
Author: Bob Dunlop
Date:  
To: hampshire
Subject: Re: [Hampshire] scanf conversion - anyone know what "%m" is?
Hi,

On Tue, Jul 22 at 04:11, Vic wrote:
> I've just raised a bug against a RH package because it uses the %m format
> conversion, which doesn't exist according to everything I've found. The
> response I got is that it's a poorly-documented extension...


As a note for the future it would be really useful if you could provide
more information with this sort of query.

What package are you talking about, where in the code have you spotted
this problem.


> Leaving aside the fact that poorly-documented extensions have no place in
> code like this, does anyone know what it's supposed to do? I can't find a
> single reference to %m...


You see "code like this" doesn't help us identify the package and access
how important portability is and the impact this could have on whether
extensions should be used.


Anyway. I know of no use of %m with scanf() are you sure it was scanf() ?

%m has two documented uses for output that I'm aware of.

First it is the format string marker for syslog() where it marks the
point to include the output of strerror(errno). See "man 3 syslog" and
I believe POSIX.1

Secondly it's use for the same function in printf() in the GNU C library
has been documented as a GNU extension in the GNU C Library Reference
Manual since at least 1993.


So if it's reasonable that the package in question is only ever going
to be used/built on systems with the GNU library then the use of the
extension is okay.  If it's targeted at non-GNU environments such as
embedded systems then the use of the extension should be investigated.
RH I would say is a firmly GNU based system.
-- 
        Bob Dunlop