X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Futils.c;h=4bdda7122859f2649e3eacfb3f3a6cf62ffacad3;hb=fcabec0aee42af28e2846ef3674ed7ba7be72c42;hp=73ce865dfdb1f981a25c20a7d1e813c7226e4a8a;hpb=cb820e861caa85bb3942ab0c673e04b9408be0ad;p=iproute2.git diff --git a/lib/utils.c b/lib/utils.c index 73ce865..4bdda71 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -27,6 +27,9 @@ #include #include #include +#include +#include + #include "utils.h" @@ -237,10 +240,11 @@ int get_prefix_1(inet_prefix *dst, char *arg, int family) dst->bitlen = 32; } if (slash) { - if (get_integer(&plen, slash+1, 0) || plen > dst->bitlen) { + if (get_unsigned(&plen, slash+1, 0) || plen > dst->bitlen) { err = -1; goto done; } + dst->flags |= PREFIXLEN_SPECIFIED; dst->bitlen = plen; } } @@ -500,9 +504,9 @@ const char *format_host(int af, int len, const void *addr, } -__u8* hexstring_n2a(const __u8 *str, int len, __u8 *buf, int blen) +char *hexstring_n2a(const __u8 *str, int len, char *buf, int blen) { - __u8 *ptr = buf; + char *ptr = buf; int i; for (i=0; i= (maxargs - 1)) { + fprintf(stderr, "Too many arguments to command\n"); + exit(1); + } + argv[argc++] = cp; + } + argv[argc] = NULL; + + return argc; +}