MCPcopy Index your code
hub / github.com/F-Stack/f-stack / bprintf

Function bprintf

tools/ipfw/ipfw2.c:474–496  ·  view source on GitHub ↗

* Print message specified by @format and args. * Automatically manage buffer space and transparently handle * buffer overruns. * * Returns number of bytes that should have been printed. */

Source from the content-addressed store, hash-verified

472 * Returns number of bytes that should have been printed.
473 */
474int
475bprintf(struct buf_pr *b, const char *format, ...)
476{
477 va_list args;
478 int i;
479
480 va_start(args, format);
481
482 i = vsnprintf(b->ptr, b->avail, format, args);
483 va_end(args);
484
485 if (i < 0 || (size_t)i > b->avail) {
486 /* Overflow or print error */
487 b->avail = 0;
488 } else {
489 b->ptr += i;
490 b->avail -= i;
491 }
492
493 b->needed += i;
494
495 return (i);
496}
497
498/*
499 * Special values printer for tablearg-aware opcodes.

Callers 15

print_unreach6_codeFunction · 0.85
print_ip6Function · 0.85
print_icmp6typesFunction · 0.85
print_flow6idFunction · 0.85
print_ext6hdrFunction · 0.85
list_flowFunction · 0.85
print_altq_cmdFunction · 0.85
bprint_uint_argFunction · 0.85
pr_u64Function · 0.85
print_portFunction · 0.85
print_newportsFunction · 0.85
print_reject_codeFunction · 0.85

Calls 1

vsnprintfFunction · 0.85

Tested by

no test coverage detected