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

Function monitor

tools/route/route.c:1512–1559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1510}
1511
1512static void
1513monitor(int argc, char *argv[])
1514{
1515 int n, fib, error;
1516 char msg[2048], *endptr;
1517
1518 fib = defaultfib;
1519 while (argc > 1) {
1520 argc--;
1521 argv++;
1522 if (**argv != '-')
1523 usage(*argv);
1524 switch (keyword(*argv + 1)) {
1525 case K_FIB:
1526 if (!--argc)
1527 usage(*argv);
1528 errno = 0;
1529 fib = strtol(*++argv, &endptr, 0);
1530 if (errno == 0) {
1531 if (*endptr != '\0' ||
1532 fib < 0 ||
1533 (numfibs != -1 && fib > numfibs - 1))
1534 errno = EINVAL;
1535 }
1536 if (errno)
1537 errx(EX_USAGE, "invalid fib number: %s", *argv);
1538 break;
1539 default:
1540 usage(*argv);
1541 }
1542 }
1543 error = set_sofib(fib);
1544 if (error)
1545 errx(EX_USAGE, "invalid fib number: %d", fib);
1546
1547 verbose = 1;
1548 if (debugonly) {
1549 interfaces();
1550 exit(0);
1551 }
1552 for (;;) {
1553 time_t now;
1554 n = read(s, msg, 2048);
1555 now = time(NULL);
1556 (void)printf("\ngot message of size %d on %s", n, ctime(&now));
1557 print_rtmsg((struct rt_msghdr *)(void *)msg, n);
1558 }
1559}
1560#endif
1561
1562static int

Callers 1

route.cFile · 0.85

Calls 8

keywordFunction · 0.85
strtolFunction · 0.85
set_sofibFunction · 0.85
interfacesFunction · 0.85
print_rtmsgFunction · 0.85
usageFunction · 0.70
readFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected