Changeset 1770 in MondoRescue for branches/stable/mindi-busybox/networking/libiproute/rtm_map.c
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi-busybox/networking/libiproute/rtm_map.c
r821 r1770 1 /* vi: set sw=4 ts=4: */ 1 2 /* 2 3 * rtm_map.c … … 11 12 */ 12 13 13 #include <stdlib.h> 14 #include <string.h> 15 14 #include "libbb.h" 16 15 #include "rt_names.h" 17 16 #include "utils.h" 18 17 19 c har *rtnl_rtntype_n2a(int id, char *buf, int len)18 const char *rtnl_rtntype_n2a(int id, char *buf, int len) 20 19 { 21 20 switch (id) { … … 53 52 int rtnl_rtntype_a2n(int *id, char *arg) 54 53 { 54 static const char keywords[] ALIGN1 = 55 "local\0""nat\0""broadcast\0""brd\0""anycast\0" 56 "multicast\0""prohibit\0""unreachable\0""blackhole\0" 57 "xresolve\0""unicast\0""throw\0"; 58 enum { 59 ARG_local = 1, ARG_nat, ARG_broadcast, ARG_brd, ARG_anycast, 60 ARG_multicast, ARG_prohibit, ARG_unreachable, ARG_blackhole, 61 ARG_xresolve, ARG_unicast, ARG_throw 62 }; 63 const smalluint key = index_in_substrings(keywords, arg) + 1; 55 64 char *end; 56 65 unsigned long res; 57 66 58 if ( strcmp(arg, "local") == 0)67 if (key == ARG_local) 59 68 res = RTN_LOCAL; 60 else if ( strcmp(arg, "nat") == 0)69 else if (key == ARG_nat) 61 70 res = RTN_NAT; 62 else if (matches(arg, "broadcast") == 0 || 63 strcmp(arg, "brd") == 0) 71 else if (key == ARG_broadcast || key == ARG_brd) 64 72 res = RTN_BROADCAST; 65 else if ( matches(arg, "anycast") == 0)73 else if (key == ARG_anycast) 66 74 res = RTN_ANYCAST; 67 else if ( matches(arg, "multicast") == 0)75 else if (key == ARG_multicast) 68 76 res = RTN_MULTICAST; 69 else if ( matches(arg, "prohibit") == 0)77 else if (key == ARG_prohibit) 70 78 res = RTN_PROHIBIT; 71 else if ( matches(arg, "unreachable") == 0)79 else if (key == ARG_unreachable) 72 80 res = RTN_UNREACHABLE; 73 else if ( matches(arg, "blackhole") == 0)81 else if (key == ARG_blackhole) 74 82 res = RTN_BLACKHOLE; 75 else if ( matches(arg, "xresolve") == 0)83 else if (key == ARG_xresolve) 76 84 res = RTN_XRESOLVE; 77 else if ( matches(arg, "unicast") == 0)85 else if (key == ARG_unicast) 78 86 res = RTN_UNICAST; 79 else if ( strcmp(arg, "throw") == 0)87 else if (key == ARG_throw) 80 88 res = RTN_THROW; 81 89 else { … … 88 96 } 89 97 90 int get_rt_realms( __u32*realms, char *arg)98 int get_rt_realms(uint32_t *realms, char *arg) 91 99 { 92 __u32realm = 0;100 uint32_t realm = 0; 93 101 char *p = strchr(arg, '/'); 94 102
Note:
See TracChangeset
for help on using the changeset viewer.