Message ID | 20091211225835.GA17140@Linus-Debian |
---|---|
State | RFC, archived |
Headers | show |
Ah, sorry, and skip the functions.c-part please, I had submitted a seperate patch for that here already. Cheers, Linus On Fri, Dec 11, 2009 at 11:58:35PM +0100, Linus Lüssing wrote: > Hi Andrew, > > your patch seems to work pretty well here, tested it with 9 > batman-nodes in the same room. Nevertheless I found a couple of > smaller bugs in there: > - batctl segfaults, if "batctl vis" has no following argument > - batctl now displays the help-page in certain situations where we > don't want it to > - batctl ommits the first TQ tupel > The attached patch for your patch should fix these issues :). > > And I wanted to ask, what do you think about unifying the specific > help output? For instance having this "Usage: ..."-header and the > alignment for the following items the same way as it is done for > other batctl commands as well. > > Cheers, Linus > > PS: > Hmm, I'm also missing a couple of link/TQ entries already in the > unified /proc/../vis. The 9 nodes in the same room should be able > to see each other - the originator table on those nodes is also > saying so. But I think I had seen this before without your patch, > the problems has to be somewhere else. I'm attaching a batctl-vis- > and proc-vis-output of the setup here too, just in case someone > might spot some (more) parsing mistakes.
On Fri, Dec 11, 2009 at 11:58:35PM +0100, Linus L??ssing wrote: > Hi Andrew, > > your patch seems to work pretty well here, tested it with 9 > batman-nodes in the same room. Nevertheless I found a couple of > smaller bugs in there: > - batctl segfaults, if "batctl vis" has no following argument > - batctl now displays the help-page in certain situations where we > don't want it to > - batctl ommits the first TQ tupel > The attached patch for your patch should fix these issues :). Thanks for the review. I will try to look at the details today or tomorrow. Andrew
> And I wanted to ask, what do you think about unifying the specific > help output? For instance having this "Usage: ..."-header and the > alignment for the following items the same way as it is done for > other batctl commands as well. I thought about that. However the architecture allows different formats to be easily added. Different formats might need different optional arguments. It just seems easier the way it is at the moment. Andrew
diff -ur batctl/functions.c batctl2/functions.c --- batctl/functions.c 2009-12-11 23:10:31.000000000 +0100 +++ batctl2/functions.c 2009-12-11 23:09:48.000000000 +0100 @@ -161,10 +161,10 @@ if (read_opt & USE_READ_BUFF) { read_ptr = read_buff; - read_len = sizeof(read_buff); + read_len = sizeof(read_buff)-1; } else { read_ptr = lbuff; - read_len = sizeof(lbuff); + read_len = sizeof(lbuff)-1; } open: diff -ur batctl/main.c batctl2/main.c --- batctl/main.c 2009-12-11 23:10:31.000000000 +0100 +++ batctl2/main.c 2009-12-11 23:09:48.000000000 +0100 @@ -121,7 +121,7 @@ ret = handle_proc_setting(argc - 1, argv + 1, PROC_ORIG_INTERVAL, orig_interval_usage); - } if (strcmp(argv[1], "vis") == 0) { + } else if (strcmp(argv[1], "vis") == 0) { ret = vis(argc - 1, argv + 1); diff -ur batctl/vis.c batctl2/vis.c --- batctl/vis.c 2009-12-11 23:10:48.000000000 +0100 +++ batctl2/vis.c 2009-12-11 23:29:04.000000000 +0100 @@ -215,7 +215,7 @@ while ((read = getline(&line, &len, fp)) != -1) { /* First MAC address is the originator */ - orig = strtok_r(line, " ", &line_save_ptr); + orig = strtok_r(line, ",", &line_save_ptr); duplet_save_ptr = line_save_ptr; while ((duplet = strtok_r(NULL, ",", &duplet_save_ptr)) != NULL) { @@ -265,10 +265,12 @@ int c; /* Do we know the requested format? */ - if (strcmp(argv[1], "dot") == 0) - dot=true; - if (strcmp(argv[1], "json") == 0) - json=true; + if(argc > 1) { + if (strcmp(argv[1], "dot") == 0) + dot=true; + if (strcmp(argv[1], "json") == 0) + json=true; + } if (!dot && !json) { usage(); @@ -319,5 +321,3 @@ return EXIT_FAILURE; } - -