Ignore:
Timestamp:
Nov 4, 2007, 3:16:40 AM (17 years ago)
Author:
Bruno Cornec
Message:

Update to busybox 1.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi-busybox/networking/libiproute/rtm_map.c

    r821 r1765  
     1/* vi: set sw=4 ts=4: */
    12/*
    23 * rtm_map.c
     
    1112 */
    1213
    13 #include <stdlib.h>
    14 #include <string.h>
    15 
     14#include "libbb.h"
    1615#include "rt_names.h"
    1716#include "utils.h"
    1817
    19 char *rtnl_rtntype_n2a(int id, char *buf, int len)
     18const char *rtnl_rtntype_n2a(int id, char *buf, int len)
    2019{
    2120    switch (id) {
     
    5352int rtnl_rtntype_a2n(int *id, char *arg)
    5453{
     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;
    5564    char *end;
    5665    unsigned long res;
    5766
    58     if (strcmp(arg, "local") == 0)
     67    if (key == ARG_local)
    5968        res = RTN_LOCAL;
    60     else if (strcmp(arg, "nat") == 0)
     69    else if (key == ARG_nat)
    6170        res = RTN_NAT;
    62     else if (matches(arg, "broadcast") == 0 ||
    63          strcmp(arg, "brd") == 0)
     71    else if (key == ARG_broadcast || key == ARG_brd)
    6472        res = RTN_BROADCAST;
    65     else if (matches(arg, "anycast") == 0)
     73    else if (key == ARG_anycast)
    6674        res = RTN_ANYCAST;
    67     else if (matches(arg, "multicast") == 0)
     75    else if (key == ARG_multicast)
    6876        res = RTN_MULTICAST;
    69     else if (matches(arg, "prohibit") == 0)
     77    else if (key == ARG_prohibit)
    7078        res = RTN_PROHIBIT;
    71     else if (matches(arg, "unreachable") == 0)
     79    else if (key == ARG_unreachable)
    7280        res = RTN_UNREACHABLE;
    73     else if (matches(arg, "blackhole") == 0)
     81    else if (key == ARG_blackhole)
    7482        res = RTN_BLACKHOLE;
    75     else if (matches(arg, "xresolve") == 0)
     83    else if (key == ARG_xresolve)
    7684        res = RTN_XRESOLVE;
    77     else if (matches(arg, "unicast") == 0)
     85    else if (key == ARG_unicast)
    7886        res = RTN_UNICAST;
    79     else if (strcmp(arg, "throw") == 0)
     87    else if (key == ARG_throw)
    8088        res = RTN_THROW;
    8189    else {
     
    8896}
    8997
    90 int get_rt_realms(__u32 *realms, char *arg)
     98int get_rt_realms(uint32_t *realms, char *arg)
    9199{
    92     __u32 realm = 0;
     100    uint32_t realm = 0;
    93101    char *p = strchr(arg, '/');
    94102
Note: See TracChangeset for help on using the changeset viewer.