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.
State Changed From-To: open->closed Man page misunderstanding