MCPcopy Create free account
hub / github.com/F-Stack/f-stack / print_addr

Function print_addr

tools/netstat/nhops.c:149–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147#endif
148
149static int
150print_addr(const char *name, const char *addr, int width)
151{
152 char buf[128];
153 int protrusion;
154
155 if (width < 0) {
156 snprintf(buf, sizeof(buf), "{:%s/%%s} ", name);
157 xo_emit(buf, addr);
158 protrusion = 0;
159 } else {
160 if (Wflag != 0 || numeric_addr) {
161 snprintf(buf, sizeof(buf), "{[:%d}{:%s/%%s}{]:} ",
162 -width, name);
163 xo_emit(buf, addr);
164 protrusion = strlen(addr) - width;
165 if (protrusion < 0)
166 protrusion = 0;
167 } else {
168 snprintf(buf, sizeof(buf), "{[:%d}{:%s/%%-.*s}{]:} ",
169 -width, name);
170 xo_emit(buf, width, addr);
171 protrusion = 0;
172 }
173 }
174 return (protrusion);
175}
176
177
178static void

Callers 1

print_nhop_entry_sysctlFunction · 0.70

Calls 2

snprintfFunction · 0.85
xo_emitFunction · 0.85

Tested by

no test coverage detected