MCPcopy Create free account
hub / github.com/coreboot/coreboot / print_char

Function print_char

payloads/libpayload/libc/printf.c:146–169  ·  view source on GitHub ↗

* Print one formatted character. * * @param c Character to print. * @param width Width modifier. * @param flags Flags that change the way the character is printed. * @param ps Output methods spec for different printf clones. * @return Number of characters printed, negative value on failure. */

Source from the content-addressed store, hash-verified

144 * @return Number of characters printed, negative value on failure.
145 */
146static int print_char(char c, int width, uint64_t flags, struct printf_spec *ps)
147{
148 int retval;
149 int counter = 1;
150
151 if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) {
152 if ((retval = print_spaces(width - 1, ps)) < 0)
153 return retval;
154 else
155 counter += retval;
156 }
157
158 if ((retval = printf_putchar(c, ps)) < 0)
159 return retval;
160
161 if (flags & __PRINTF_FLAG_LEFTALIGNED) {
162 if ((retval = print_spaces(width - 1, ps)) < 0)
163 return retval;
164 else
165 counter += retval;
166 }
167
168 return counter;
169}
170
171/**
172 * Print string.

Callers 1

printf_coreFunction · 0.85

Calls 2

print_spacesFunction · 0.85
printf_putcharFunction · 0.85

Tested by

no test coverage detected