Read-only ifconfig — prints eth0 inet address, MAC, and byte counters from sysfs. Per D-01, D-05.
More...
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
|
| static void | rprint (const char *s) |
| static int | read_sysfs (const char *path, char *buf, int bufsiz) |
| | Read a sysfs file into buf, strip trailing newline, null-terminate.
|
| int | main (void) |
Read-only ifconfig — prints eth0 inet address, MAC, and byte counters from sysfs. Per D-01, D-05.
◆ main()
◆ read_sysfs()
| int read_sysfs |
( |
const char * | path, |
|
|
char * | buf, |
|
|
int | bufsiz ) |
|
static |
Read a sysfs file into buf, strip trailing newline, null-terminate.
- Parameters
-
| path | Sysfs path to open. |
| buf | Destination buffer. |
| bufsiz | Size of destination buffer (including null terminator space). |
- Returns
- Number of bytes read (excluding null), or -1 on error.
◆ rprint()
| void rprint |
( |
const char * | s | ) |
|
|
static |