Changeset View
Changeset View
Standalone View
Standalone View
sbin/ifconfig/ifclone.c
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
typedef enum { | typedef enum { | ||||
MT_PREFIX, | MT_PREFIX, | ||||
MT_FILTER, | MT_FILTER, | ||||
} clone_match_type; | } clone_match_type; | ||||
static void | static void | ||||
list_cloners(void) | list_cloners(void) | ||||
{ | { | ||||
ifconfig_handle_t *lifh; | |||||
char *cloners; | char *cloners; | ||||
size_t cloners_count; | size_t cloners_count; | ||||
lifh = ifconfig_open(); | |||||
if (lifh == NULL) | |||||
return; | |||||
if (ifconfig_list_cloners(lifh, &cloners, &cloners_count) < 0) | if (ifconfig_list_cloners(lifh, &cloners, &cloners_count) < 0) | ||||
errc(1, ifconfig_err_errno(lifh), "unable to list cloners"); | errc(1, ifconfig_err_errno(lifh), "unable to list cloners"); | ||||
ifconfig_close(lifh); | |||||
for (const char *name = cloners; | for (const char *name = cloners; | ||||
name < cloners + cloners_count * IFNAMSIZ; | name < cloners + cloners_count * IFNAMSIZ; | ||||
name += IFNAMSIZ) { | name += IFNAMSIZ) { | ||||
if (name > cloners) | if (name > cloners) | ||||
putchar(' '); | putchar(' '); | ||||
printf("%s", name); | printf("%s", name); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 128 Lines • Show Last 20 Lines |