From the FreeBSD manpage man 3 printf
An optional precision, in the form of
a period . followed by an optional
digit string. If the digit string is
omitted, the precision is taken as
zero. This gives the minimum number
of digits to appear for d, i, o, u,
x, and X conversions, the number of
digits to appear after the
decimal-point for a, A, e, E, f, and F
conversions, the maximum number of
significant digits for g and G
conversions, or the maximum number of
characters to be printed from a string
for s conversions.
So in this case, %04.4d
, the .4
specifies that all four digits of the number should be printed. Of course, the 04
part just pads the number with leading zeros if it is less than 1000. However, in this case, as the above manual page states,
`0' (zero) Zero padding. For all conversions except n, the converted
value is padded on the left with zeros rather
than blanks.
If a precision is given with a numeric
conversion (d, i, o, u, i, x, and X), the 0 flag is
ignored.
Since surely all four digits would be printed anyway, my guess would be that it was just a leftover or typo or something. This syntax produces compiler warnings with gcc -Wall
(see Sinan Unur's example) but it does not seem to be an actual error.