Subject: Re: bin/8880: Output from pac not always formatted correctly.
To: Brian Stark <bstark@uswest.net>
From: Jaromir Dolecek <dolecek@ics.muni.cz>
List: tech-userlevel
Date: 11/27/1999 12:39:23
Hi,
seems like ANSI C and POSIX doesn't aggree on usage of "width" for %s
type
for printf(3). According to POSIX (Brian Stark sent me a scanned copy or
relevant pages, I don't have copy available myself), "%24s" should mean
in POSIX prontf(3) the same as "%.24s" means for ANSI C - i.e. use
maximum of 24 characters from the passed string.
Am I seriously confused or the POSIX and ANSI C really don't treat this
the
same way ? If so, it's rather unfortunate ...
From the POSIX:
Description Meaning of width Meaning of precision
s Argument is assumed to be Specifies the maximum UNDEFINED
char *. Characters up to (but number of characters
not including) a terminating to be written.
null are written.
The ANSI C way is explained in manpage.
Jaromir