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

Function cmd_link_show

dpdk/examples/ip_pipeline/cli.c:301–336  ·  view source on GitHub ↗

* link show [ ] */

Source from the content-addressed store, hash-verified

299 * link show [<link_name>]
300 */
301static void
302cmd_link_show(char **tokens, uint32_t n_tokens, char *out, size_t out_size)
303{
304 struct link *link;
305 char *link_name;
306
307 if (n_tokens != 2 && n_tokens != 3) {
308 snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
309 return;
310 }
311
312 if (n_tokens == 2) {
313 link = link_next(NULL);
314
315 while (link != NULL) {
316 out_size = out_size - strlen(out);
317 out = &out[strlen(out)];
318
319 print_link_info(link, out, out_size);
320 link = link_next(link);
321 }
322 } else {
323 out_size = out_size - strlen(out);
324 out = &out[strlen(out)];
325
326 link_name = tokens[2];
327 link = link_find(link_name);
328
329 if (link == NULL) {
330 snprintf(out, out_size, MSG_ARG_INVALID,
331 "Link does not exist");
332 return;
333 }
334 print_link_info(link, out, out_size);
335 }
336}
337
338static const char cmd_swq_help[] =
339"swq <swq_name>\n"

Callers 1

cli_processFunction · 0.85

Calls 4

snprintfFunction · 0.85
link_nextFunction · 0.85
link_findFunction · 0.85
print_link_infoFunction · 0.70

Tested by

no test coverage detected