/** * @file arp.c * @brief Display the ARP table. * * Reads the ARP cache from /sys/arp/table and displays it. * * Usage: * arp - Show the ARP table */ #include "syscalls.h" int main(void) { /* Open the ARP table sysfs file */ int32_t fd = open("/sys/arp/table", 0); if (fd < 0) { puts("arp: failed to open /sys/arp/table\n"); return 1; } /* Read and display contents */ char buf[512]; int32_t n; while ((n = read(fd, buf, sizeof(buf))) > 0) { write(1, buf, (uint32_t)n); } close(fd); return 0; }