summaryrefslogtreecommitdiff
path: root/networking/libiproute
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2002-11-28 12:45:48 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2002-11-28 12:45:48 +0000
commit82d2cd4eadd8cb009eafe5fae184f502672f47ba (patch)
treea430b37dcfd1675df33ba9172844383c0109efc1 /networking/libiproute
parent1b0813ab613c59c875f142eebfde7a07fbc34964 (diff)
downloadbusybox-w32-82d2cd4eadd8cb009eafe5fae184f502672f47ba.tar.gz
busybox-w32-82d2cd4eadd8cb009eafe5fae184f502672f47ba.tar.bz2
busybox-w32-82d2cd4eadd8cb009eafe5fae184f502672f47ba.zip
Clean up error messages
Diffstat (limited to 'networking/libiproute')
-rw-r--r--networking/libiproute/utils.c42
1 files changed, 13 insertions, 29 deletions
diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c
index 70d6853d2..9ae21b464 100644
--- a/networking/libiproute/utils.c
+++ b/networking/libiproute/utils.c
@@ -25,9 +25,10 @@
25#include <netdb.h> 25#include <netdb.h>
26#include <arpa/inet.h> 26#include <arpa/inet.h>
27#include <resolv.h> 27#include <resolv.h>
28#include "./linux/pkt_sched.h"
29 28
29#include "./linux/pkt_sched.h"
30#include "utils.h" 30#include "utils.h"
31#include "libbb.h"
31 32
32int get_integer(int *val, char *arg, int base) 33int get_integer(int *val, char *arg, int base)
33{ 34{
@@ -216,16 +217,10 @@ int get_prefix_1(inet_prefix * dst, char *arg, int family)
216int get_addr(inet_prefix * dst, char *arg, int family) 217int get_addr(inet_prefix * dst, char *arg, int family)
217{ 218{
218 if (family == AF_PACKET) { 219 if (family == AF_PACKET) {
219 fprintf(stderr, 220 error_msg_and_die("\"%s\" may be inet address, but it is not allowed in this context.", arg);
220 "Error: \"%s\" may be inet address, but it is not allowed in this context.\n",
221 arg);
222 exit(1);
223 } 221 }
224 if (get_addr_1(dst, arg, family)) { 222 if (get_addr_1(dst, arg, family)) {
225 fprintf(stderr, 223 error_msg_and_die("an inet address is expected rather than \"%s\".", arg);
226 "Error: an inet address is expected rather than \"%s\".\n",
227 arg);
228 exit(1);
229 } 224 }
230 return 0; 225 return 0;
231} 226}
@@ -233,16 +228,10 @@ int get_addr(inet_prefix * dst, char *arg, int family)
233int get_prefix(inet_prefix * dst, char *arg, int family) 228int get_prefix(inet_prefix * dst, char *arg, int family)
234{ 229{
235 if (family == AF_PACKET) { 230 if (family == AF_PACKET) {
236 fprintf(stderr, 231 error_msg_and_die("\"%s\" may be inet address, but it is not allowed in this context.", arg);
237 "Error: \"%s\" may be inet prefix, but it is not allowed in this context.\n",
238 arg);
239 exit(1);
240 } 232 }
241 if (get_prefix_1(dst, arg, family)) { 233 if (get_prefix_1(dst, arg, family)) {
242 fprintf(stderr, 234 error_msg_and_die("an inet address is expected rather than \"%s\".", arg);
243 "Error: an inet prefix is expected rather than \"%s\".\n",
244 arg);
245 exit(1);
246 } 235 }
247 return 0; 236 return 0;
248} 237}
@@ -252,38 +241,32 @@ __u32 get_addr32(char *name)
252 inet_prefix addr; 241 inet_prefix addr;
253 242
254 if (get_addr_1(&addr, name, AF_INET)) { 243 if (get_addr_1(&addr, name, AF_INET)) {
255 fprintf(stderr, 244 error_msg_and_die("an IP address is expected rather than \"%s\"", name);
256 "Error: an IP address is expected rather than \"%s\"\n",
257 name);
258 exit(1);
259 } 245 }
260 return addr.data[0]; 246 return addr.data[0];
261} 247}
262 248
263void incomplete_command() 249void incomplete_command()
264{ 250{
265 fprintf(stderr, "Command line is not complete. Try option \"help\"\n"); 251 error_msg("Command line is not complete. Try option \"help\"");
266 exit(-1); 252 exit(-1);
267} 253}
268 254
269void invarg(char *msg, char *arg) 255void invarg(char *msg, char *arg)
270{ 256{
271 fprintf(stderr, "Error: argument \"%s\" is wrong: %s\n", arg, msg); 257 error_msg("argument \"%s\" is wrong: %s", arg, msg);
272 exit(-1); 258 exit(-1);
273} 259}
274 260
275void duparg(char *key, char *arg) 261void duparg(char *key, char *arg)
276{ 262{
277 fprintf(stderr, "Error: duplicate \"%s\": \"%s\" is the second value.\n", 263 error_msg("duplicate \"%s\": \"%s\" is the second value.", key, arg);
278 key, arg);
279 exit(-1); 264 exit(-1);
280} 265}
281 266
282void duparg2(char *key, char *arg) 267void duparg2(char *key, char *arg)
283{ 268{
284 fprintf(stderr, 269 error_msg("either \"%s\" is duplicate, or \"%s\" is a garbage.", key, arg);
285 "Error: either \"%s\" is duplicate, or \"%s\" is a garbage.\n",
286 key, arg);
287 exit(-1); 270 exit(-1);
288} 271}
289 272
@@ -291,8 +274,9 @@ int matches(char *cmd, char *pattern)
291{ 274{
292 int len = strlen(cmd); 275 int len = strlen(cmd);
293 276
294 if (len > strlen(pattern)) 277 if (len > strlen(pattern)) {
295 return -1; 278 return -1;
279 }
296 return memcmp(pattern, cmd, len); 280 return memcmp(pattern, cmd, len);
297} 281}
298 282