summaryrefslogtreecommitdiff
path: root/networking/arp.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-06-07 15:10:29 +0000
committerDenis Vlasenko2008-06-07 15:10:29 +0000
commit53354ac47df03bdccebad66bc22958fa2b4da520 (patch)
treeb3d85b6cd19f81293848235560b24cbce86f77d7 /networking/arp.c
parentf0d6c255860509b10148c70ef7cb518eb81bea6d (diff)
downloadbusybox-53354ac47df03bdccebad66bc22958fa2b4da520.zip
busybox-53354ac47df03bdccebad66bc22958fa2b4da520.tar.gz
libbb: introduce and use print_flags().
Mostly by Natanael Copa <natanael.copa AT gmail.com> function old new delta print_e2flags - 189 +189 print_flags_separated - 86 +86 static.flag_labels - 60 +60 static.dma_wmode_masks - 32 +32 static.flag_masks - 28 +28 static.arp_labels - 16 +16 static.arp_masks - 12 +12 ls_main 836 843 +7 ... popstring 140 134 -6 arp_show 740 708 -32 print_flags 189 25 -164 ipaddr_list_or_flush 2396 2170 -226 process_dev 5306 4706 -600 ------------------------------------------------------------------------------ (add/remove: 10/0 grow/shrink: 5/10 up/down: 458/-1043) Total: -585 bytes text data bss dec hex filename 810564 624 7060 818248 c7c48 busybox_old 810002 624 7060 817686 c7a16 busybox_unstripped
Diffstat (limited to 'networking/arp.c')
-rw-r--r--networking/arp.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/networking/arp.c b/networking/arp.c
index f42e09f..f85a910 100644
--- a/networking/arp.c
+++ b/networking/arp.c
@@ -313,6 +313,26 @@ static void
arp_disp(const char *name, char *ip, int type, int arp_flags,
char *hwa, char *mask, char *dev)
{
+ static const int arp_masks[] = {
+ ATF_PERM, ATF_PUBL,
+#ifdef HAVE_ATF_MAGIC
+ ATF_MAGIC,
+#endif
+#ifdef HAVE_ATF_DONTPUB
+ ATF_DONTPUB,
+#endif
+ ATF_USETRAILERS,
+ };
+ static const char arp_labels[] ALIGN1 = "PERM\0""PUP\0"
+#ifdef HAVE_ATF_MAGIC
+ "AUTO\0"
+#endif
+#ifdef HAVE_ATF_DONTPUB
+ "DONTPUB\0"
+#endif
+ "TRAIL\0"
+ ;
+
const struct hwtype *xhw;
xhw = get_hwntype(type);
@@ -333,22 +353,8 @@ arp_disp(const char *name, char *ip, int type, int arp_flags,
if (arp_flags & ATF_NETMASK)
printf("netmask %s ", mask);
- if (arp_flags & ATF_PERM)
- printf("PERM ");
- if (arp_flags & ATF_PUBL)
- printf("PUP ");
-#ifdef HAVE_ATF_MAGIC
- if (arp_flags & ATF_MAGIC)
- printf("AUTO ");
-#endif
-#ifdef HAVE_ATF_DONTPUB
- if (arp_flags & ATF_DONTPUB)
- printf("DONTPUB ");
-#endif
- if (arp_flags & ATF_USETRAILERS)
- printf("TRAIL ");
-
- printf("on %s\n", dev);
+ print_flags_separated(arp_masks, arp_labels, arp_flags, " ");
+ printf(" on %s\n", dev);
}
/* Display the contents of the ARP cache in the kernel. */