__output
function · crt · primitive
- Address
0x742ba5· 1825 bytes, up to0x7432c5- Signature
int __cdecl (FILE *stream, const char *format, va_list args)- Meaning
- Formats a printf format and its arguments into a FILE; returns the bytes written, or -1 once a write fails
- Confidence
- verified, proof one
- Name from
- the community database (idb)
- Finding
- crt/printf#the-format-state-machine
- Test
crt::crt_sprintf_states_difftest,crt::crt_sprintf_difftest,crt::crt_sprintf_float_difftest,crt::crt_vsnprintf_difftest
Finding: The format state machine in crt: formatted output
__output reads the format a byte at a time until its NUL. A byte's class and the state give
the next state: 0 normal, 1 percent, 2 flag, 3 width, 4 dot, 5 precision, 6 size, 7 type. Bytes
outside 0x20 to 0x78 are of class other. The normal state writes the byte, so %% writes %
and a byte of class other ends a conversion by being written. State 1 clears the flags and width
and sets the precision to -1. * reads an int: a negative width sets - and is negated, a
negative precision is -1. Digits accumulate in 32 bits. I is a size only before 64, else
written. F, L and N do nothing.
| class | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|---|
| other | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
% | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
. | 0 | 4 | 4 | 4 | 0 | 0 | 0 | 0 |
* | 0 | 3 | 3 | 0 | 5 | 0 | 0 | 0 |
0 | 0 | 2 | 2 | 3 | 5 | 5 | 0 | 0 |
1 to 9 | 0 | 3 | 3 | 3 | 5 | 5 | 0 | 0 |
space # + - | 0 | 2 | 2 | 0 | 0 | 0 | 0 | 0 |
F I L N h l w | 0 | 6 | 6 | 6 | 6 | 6 | 6 | 0 |
B C E G S X Z c d e f g i n o p s u x | 0 | 7 | 7 | 7 | 7 | 7 | 7 | 0 |
The derivation is in the doc.
Callers 5
- _fprintf crt
- __vsnprintf crt
- _sprintf crt
- __snprintf crt
- _vsprintf crt
Callees 10
- _strlen crt
- __aulldiv crt
- __aullrem crt
- _write_char crt
- _write_multi_char crt
- _write_string crt
- _get_int_arg crt
- _get_int64_arg crt
- _get_short_arg crt
- _wctomb crt
Calls and jumps by a bare address, from tables/calls.tsv.