[PATCH] Portability patches

Ralph Böhme rb at sernet.de
Thu Oct 9 11:36:27 MDT 2014


On Thu, Oct 09, 2014 at 10:33:45AM -0700, Richard Sharpe wrote:
> On Thu, Oct 9, 2014 at 10:20 AM, Ralph Böhme <rb at sernet.de> wrote:
> > On Thu, Oct 09, 2014 at 09:56:52AM -0700, Richard Sharpe wrote:
> >> On Thu, Oct 9, 2014 at 9:28 AM, Ralph Böhme <rb at sernet.de> wrote:
> >> > Hi all,
> >> >
> >> > attached please find two simple fixes for non-portable code that
> >> > exploded on my FreeBSD 10 testbox (the non-portable code, not the
> >> > fixes ;)
> >>
> >> Hmmm, on the CentOS 6.5 (and thus RHEL 6.x) box I am currently using,
> >> it says of %m that:
> >>
> >>        m      (Glibc  extension.)   Print output of strerror(errno).  No argu-
> >>               ment is required.
> >
> > where does it say that? In man sscanf? The only reference to this text
> > I can find is from man printf: <http://linux.die.net/man/3/printf>
> >
> >> Isn't that going to cause more portability problems?
> >
> > To reiterate:
> >
> > a    scanf glibc extension, eg FreeBSD and Solaris don't have it
> > m    In SUSv4 [1], but not in SUSv3 [2], supported by glibc since 2.7, FreeBSD
> >
> > Looks like at least Solaris 11.1 doesn't have m yet, maybe it's in 11.2.
> >
> > -Ralph
> >
> > [1] <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sscanf.html>
> > [2] <http://pubs.opengroup.org/onlinepubs/009695399/functions/sscanf.html>
> 
> D'oh. I looked in the printf man page not the scanf. Objection removed.

:) This one actually took me quite a lot of time to figure out. Can't
remember ever having used sscanf in any code and I hate format
conversion specifiers, all of them, in scanf *and* in printf. ;)

Cheerio!
-slow

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de,mailto:kontakt@sernet.de


More information about the samba-technical mailing list