Bug 155 - precision doesn't work for %s
Summary: precision doesn't work for %s
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1995-01-21 07:30 UTC by Peter Dufault
Modified: 1995-01-21 07:30 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Dufault 1995-01-21 07:30:02 UTC
The precision for "%s" is ignored.  Either the man page or the
code are wrong.

How-To-Repeat: This code:
main()
{
	printf("precision = 4\n%4s",
"if a precision is specified, no more than the number specified are written.\n");
}

produces this output:

> precision = 4
> if a precision is specified, no more than the number specified are written.

"man 3 printf" says;

> The ``char *'' argument is expected to be a pointer to an array
>            of character type (pointer to a string).  Characters from the ar-
>            ray are written up to (but not including) a terminating NUL char-
>            acter; if a precision is specified, no more than the number spec-
>            ified are written. If a precision is given, no null character
>            need be present; if the precision is not specified, or is greater
>            than the size of the array, the array must contain a terminating
>            NUL character.
Comment 1 Andrey A. Chernov freebsd_committer freebsd_triage 1995-03-20 06:26:01 UTC
State Changed
From-To: open->closed

Man page misunderstanding