r1568 - branches/batctl-0.2.x
by postmaster@open-mesh.net
Author: marek
Date: 2010-01-26 04:45:37 +0100 (Tue, 26 Jan 2010)
New Revision: 1568
Modified:
branches/batctl-0.2.x/functions.c
branches/batctl-0.2.x/sys.c
Log:
batctl: omit log lines which don't start with the correct tag
All batman-adv log messages start with a distinct tag ("batman-adv:" at the
moment) which we can use to strip the kernel log and only show batman-adv
related messages.
Modified: branches/batctl-0.2.x/functions.c
===================================================================
--- branches/batctl-0.2.x/functions.c 2010-01-26 03:21:47 UTC (rev 1567)
+++ branches/batctl-0.2.x/functions.c 2010-01-26 03:45:37 UTC (rev 1568)
@@ -35,6 +35,7 @@
#include "functions.h"
#include "bat-hosts.h"
+#define BATMAN_ADV_TAG "batman-adv:"
static struct timeval start_time;
static char *host_name;
@@ -178,6 +179,12 @@
if (read_opt & USE_READ_BUFF)
break;
+ if (read_opt & LOG_MODE) {
+ /* omit log lines which don't start with the correct tag */
+ if (strncmp(line_ptr, BATMAN_ADV_TAG, strlen(BATMAN_ADV_TAG)) != 0)
+ continue;
+ }
+
if (!(read_opt & USE_BAT_HOSTS)) {
printf("%s", line_ptr);
continue;
Modified: branches/batctl-0.2.x/sys.c
===================================================================
--- branches/batctl-0.2.x/sys.c 2010-01-26 03:21:47 UTC (rev 1567)
+++ branches/batctl-0.2.x/sys.c 2010-01-26 03:45:37 UTC (rev 1568)
@@ -68,7 +68,7 @@
if (argc > found_args)
return read_file("", argv[found_args], read_opt);
else
- return read_file("", "/dev/stdin", read_opt);
+ return read_file("", "/proc/self/fd/0", read_opt);
}
static void log_level_usage(void)
13 years
r1567 - trunk/batctl
by postmaster@open-mesh.net
Author: marek
Date: 2010-01-26 04:21:47 +0100 (Tue, 26 Jan 2010)
New Revision: 1567
Modified:
trunk/batctl/functions.c
trunk/batctl/sys.c
Log:
batctl: omit log lines which don't start with the correct tag
All batman-adv log messages start with a distinct tag ("batman-adv:" at the
moment) which we can use to strip the kernel log and only show batman-adv
related messages.
Modified: trunk/batctl/functions.c
===================================================================
--- trunk/batctl/functions.c 2010-01-25 09:25:47 UTC (rev 1566)
+++ trunk/batctl/functions.c 2010-01-26 03:21:47 UTC (rev 1567)
@@ -35,6 +35,7 @@
#include "functions.h"
#include "bat-hosts.h"
+#define BATMAN_ADV_TAG "batman-adv:"
static struct timeval start_time;
static char *host_name;
@@ -178,6 +179,12 @@
if (read_opt & USE_READ_BUFF)
break;
+ if (read_opt & LOG_MODE) {
+ /* omit log lines which don't start with the correct tag */
+ if (strncmp(line_ptr, BATMAN_ADV_TAG, strlen(BATMAN_ADV_TAG)) != 0)
+ continue;
+ }
+
if (!(read_opt & USE_BAT_HOSTS)) {
printf("%s", line_ptr);
continue;
Modified: trunk/batctl/sys.c
===================================================================
--- trunk/batctl/sys.c 2010-01-25 09:25:47 UTC (rev 1566)
+++ trunk/batctl/sys.c 2010-01-26 03:21:47 UTC (rev 1567)
@@ -68,7 +68,7 @@
if (argc > found_args)
return read_file("", argv[found_args], read_opt);
else
- return read_file("", "/dev/stdin", read_opt);
+ return read_file("", "/proc/self/fd/0", read_opt);
}
static void log_level_usage(void)
13 years
[git] batman-adv branch, linux, updated. GregKH-20091208-9740-gf601f54
by postmaster@open-mesh.net
The following commit has been merged in the linux branch:
commit f601f54446c9a8842f21f2dc07e62c8387b8f733
Author: Sven Eckelmann <sven.eckelmann(a)gmx.de>
Date: Mon Jan 25 10:09:46 2010 +0100
batman-adv: depend on NET instead of PACKET in Kconfig
The code which uses the raw packet sockets was removed. The only related
dependencies are the skb and netdev handling code. This is provided by
NET in Kconfig.
Signed-off-by: Sven Eckelmann <sven.eckelmann(a)gmx.de>
diff --git a/drivers/staging/batman-adv/Kconfig b/drivers/staging/batman-adv/Kconfig
index 69e8fb0..1e7e0a8 100644
--- a/drivers/staging/batman-adv/Kconfig
+++ b/drivers/staging/batman-adv/Kconfig
@@ -4,7 +4,7 @@
config BATMAN_ADV
tristate "B.A.T.M.A.N. Advanced Meshing Protocol"
- depends on PROC_FS && PACKET
+ depends on PROC_FS && NET
default n
---help---
--
batman-adv
13 years
r1566 - branches/batctl-0.2.x
by postmaster@open-mesh.net
Author: marek
Date: 2010-01-25 10:25:47 +0100 (Mon, 25 Jan 2010)
New Revision: 1566
Modified:
branches/batctl-0.2.x/bat-hosts.c
Log:
batctl: extend bat-hosts parser to ignore empty lines and comments
Modified: branches/batctl-0.2.x/bat-hosts.c
===================================================================
--- branches/batctl-0.2.x/bat-hosts.c 2010-01-25 09:23:12 UTC (rev 1565)
+++ branches/batctl-0.2.x/bat-hosts.c 2010-01-25 09:25:47 UTC (rev 1566)
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2007-2009 B.A.T.M.A.N. contributors:
*
* Andreas Langer <a.langer(a)q-dsl.de>, Marek Lindner <lindner_marek(a)yahoo.de>
@@ -63,10 +63,12 @@
static void parse_hosts_file(struct hashtable_t **hash, const char path[])
{
FILE *fd;
+ char *line_ptr = NULL;
char name[HOST_NAME_MAX_LEN], mac_str[18];
struct ether_addr *mac_addr;
struct bat_host *bat_host;
struct hashtable_t *swaphash;
+ size_t len = 0;
name[0] = mac_str[0] = '\0';
@@ -74,11 +76,19 @@
if (!fd)
return;
- while (fscanf(fd,"%[^ \t]%s\n", mac_str, name) != EOF) {
+ while (getline(&line_ptr, &len, fd) != -1) {
+ /* ignore empty lines and comments */
+ if ((line_ptr[0] == '\n') || (line_ptr[0] == '#'))
+ continue;
+ if (sscanf(line_ptr, "%[^ \t]%s\n", mac_str, name) != 2) {
+ fprintf(stderr, "Warning - unrecognized bat-host definition: %s", line_ptr);
+ continue;
+ }
+
mac_addr = ether_aton(mac_str);
if (!mac_addr) {
- printf("Warning - invalid mac address in '%s' detected: %s\n", path, mac_str);
+ fprintf(stderr, "Warning - invalid mac address in '%s' detected: %s\n", path, mac_str);
continue;
}
@@ -86,7 +96,7 @@
/* mac entry already exists - we found a new name for it */
if (bat_host) {
- printf("Warning - mac already known (changing name from '%s' to '%s'): %s\n",
+ fprintf(stderr, "Warning - mac already known (changing name from '%s' to '%s'): %s\n",
bat_host->name, name, mac_str);
strncpy(bat_host->name, name, HOST_NAME_MAX_LEN - 1);
continue;
@@ -96,7 +106,7 @@
/* name entry already exists - we found a new mac address for it */
if (bat_host) {
- printf("Warning - name already known (changing mac from '%s' to '%s'): %s\n",
+ fprintf(stderr, "Warning - name already known (changing mac from '%s' to '%s'): %s\n",
ether_ntoa(&bat_host->mac_addr), mac_str, name);
hash_remove(*hash, bat_host);
free(bat_host);
@@ -105,7 +115,7 @@
bat_host = malloc(sizeof(struct bat_host));
if (!bat_host) {
- printf("Error - could not allocate memory: %s\n", strerror(errno));
+ fprintf(stderr, "Error - could not allocate memory: %s\n", strerror(errno));
goto out;
}
@@ -118,16 +128,17 @@
swaphash = hash_resize((*hash), (*hash)->size * 2);
if (swaphash == NULL)
- printf("Warning - couldn't resize bat hosts hash table\n");
+ fprintf(stderr, "Warning - couldn't resize bat hosts hash table\n");
else
*hash = swaphash;
}
-
}
out:
if (fd)
fclose(fd);
+ if (line_ptr)
+ free(line_ptr);
return;
}
13 years
r1565 - trunk/batctl
by postmaster@open-mesh.net
Author: marek
Date: 2010-01-25 10:23:12 +0100 (Mon, 25 Jan 2010)
New Revision: 1565
Modified:
trunk/batctl/bat-hosts.c
Log:
batctl: extend bat-hosts parser to ignore empty lines and comments
Modified: trunk/batctl/bat-hosts.c
===================================================================
--- trunk/batctl/bat-hosts.c 2010-01-25 08:42:15 UTC (rev 1564)
+++ trunk/batctl/bat-hosts.c 2010-01-25 09:23:12 UTC (rev 1565)
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2007-2009 B.A.T.M.A.N. contributors:
*
* Andreas Langer <a.langer(a)q-dsl.de>, Marek Lindner <lindner_marek(a)yahoo.de>
@@ -63,10 +63,12 @@
static void parse_hosts_file(struct hashtable_t **hash, const char path[])
{
FILE *fd;
+ char *line_ptr = NULL;
char name[HOST_NAME_MAX_LEN], mac_str[18];
struct ether_addr *mac_addr;
struct bat_host *bat_host;
struct hashtable_t *swaphash;
+ size_t len = 0;
name[0] = mac_str[0] = '\0';
@@ -74,11 +76,19 @@
if (!fd)
return;
- while (fscanf(fd,"%[^ \t]%s\n", mac_str, name) != EOF) {
+ while (getline(&line_ptr, &len, fd) != -1) {
+ /* ignore empty lines and comments */
+ if ((line_ptr[0] == '\n') || (line_ptr[0] == '#'))
+ continue;
+ if (sscanf(line_ptr, "%[^ \t]%s\n", mac_str, name) != 2) {
+ fprintf(stderr, "Warning - unrecognized bat-host definition: %s", line_ptr);
+ continue;
+ }
+
mac_addr = ether_aton(mac_str);
if (!mac_addr) {
- printf("Warning - invalid mac address in '%s' detected: %s\n", path, mac_str);
+ fprintf(stderr, "Warning - invalid mac address in '%s' detected: %s\n", path, mac_str);
continue;
}
@@ -86,7 +96,7 @@
/* mac entry already exists - we found a new name for it */
if (bat_host) {
- printf("Warning - mac already known (changing name from '%s' to '%s'): %s\n",
+ fprintf(stderr, "Warning - mac already known (changing name from '%s' to '%s'): %s\n",
bat_host->name, name, mac_str);
strncpy(bat_host->name, name, HOST_NAME_MAX_LEN - 1);
continue;
@@ -96,7 +106,7 @@
/* name entry already exists - we found a new mac address for it */
if (bat_host) {
- printf("Warning - name already known (changing mac from '%s' to '%s'): %s\n",
+ fprintf(stderr, "Warning - name already known (changing mac from '%s' to '%s'): %s\n",
ether_ntoa(&bat_host->mac_addr), mac_str, name);
hash_remove(*hash, bat_host);
free(bat_host);
@@ -105,7 +115,7 @@
bat_host = malloc(sizeof(struct bat_host));
if (!bat_host) {
- printf("Error - could not allocate memory: %s\n", strerror(errno));
+ fprintf(stderr, "Error - could not allocate memory: %s\n", strerror(errno));
goto out;
}
@@ -118,16 +128,17 @@
swaphash = hash_resize((*hash), (*hash)->size * 2);
if (swaphash == NULL)
- printf("Warning - couldn't resize bat hosts hash table\n");
+ fprintf(stderr, "Warning - couldn't resize bat hosts hash table\n");
else
*hash = swaphash;
}
-
}
out:
if (fd)
fclose(fd);
+ if (line_ptr)
+ free(line_ptr);
return;
}
13 years
r1564 - trunk/batman-adv-kernelland
by postmaster@open-mesh.net
Author: marek
Date: 2010-01-25 09:42:15 +0100 (Mon, 25 Jan 2010)
New Revision: 1564
Modified:
trunk/batman-adv-kernelland/routing.c
Log:
batman-adv: Fix skbuff leak in VIS code.
The vis code takes a copy of the data inside the skbuf if it is interesting
for us, so we always need to release the skbuf.
Reported-by: Linus L?\195?\188ssing <linus.luessing(a)web.de>
Signed-off-by: Andrew Lunn <andrew(a)lunn.ch>
Modified: trunk/batman-adv-kernelland/routing.c
===================================================================
--- trunk/batman-adv-kernelland/routing.c 2010-01-23 08:58:22 UTC (rev 1563)
+++ trunk/batman-adv-kernelland/routing.c 2010-01-25 08:42:15 UTC (rev 1564)
@@ -1116,7 +1116,6 @@
struct vis_packet *vis_packet;
struct ethhdr *ethhdr;
int hdr_size = sizeof(struct vis_packet);
- int ret;
if (skb_headlen(skb) < hdr_size)
return NET_RX_DROP;
@@ -1139,18 +1138,18 @@
case VIS_TYPE_SERVER_SYNC:
/* TODO: handle fragmented skbs properly */
receive_server_sync_packet(vis_packet, skb_headlen(skb));
- ret = NET_RX_SUCCESS;
break;
case VIS_TYPE_CLIENT_UPDATE:
/* TODO: handle fragmented skbs properly */
receive_client_update_packet(vis_packet, skb_headlen(skb));
- ret = NET_RX_SUCCESS;
break;
default: /* ignore unknown packet */
- ret = NET_RX_DROP;
break;
}
- return ret;
+
+ /* We take a copy of the data in the packet, so we should
+ always free the skbuf. */
+ return NET_RX_DROP;
}
13 years
r1563 - trunk/batman-adv-kernelland
by postmaster@open-mesh.net
Author: marek
Date: 2010-01-23 09:58:22 +0100 (Sat, 23 Jan 2010)
New Revision: 1563
Modified:
trunk/batman-adv-kernelland/compat.h
trunk/batman-adv-kernelland/gateway_client.c
trunk/batman-adv-kernelland/gateway_common.c
Log:
batman-adv: make IPPROTO_UDP available on older kernels
Some older kernels don't support the IPPROTO_UDP define, therefore
it is necessary to make it available in the compat.h
Signed-off-by: Marek Lindner <lindner_marek(a)yahoo.de>
Modified: trunk/batman-adv-kernelland/compat.h
===================================================================
--- trunk/batman-adv-kernelland/compat.h 2010-01-23 08:08:03 UTC (rev 1562)
+++ trunk/batman-adv-kernelland/compat.h 2010-01-23 08:58:22 UTC (rev 1563)
@@ -24,6 +24,10 @@
#include <linux/version.h> /* LINUX_VERSION_CODE */
+#ifndef IPPROTO_UDP
+#define IPPROTO_UDP 17
+#endif
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
#define skb_set_network_header(_skb, _offset) \
Modified: trunk/batman-adv-kernelland/gateway_client.c
===================================================================
--- trunk/batman-adv-kernelland/gateway_client.c 2010-01-23 08:08:03 UTC (rev 1562)
+++ trunk/batman-adv-kernelland/gateway_client.c 2010-01-23 08:58:22 UTC (rev 1563)
@@ -20,6 +20,7 @@
#include "main.h"
#include "gateway_client.h"
#include "gateway_common.h"
+#include "compat.h"
#include <linux/ip.h>
#include <linux/udp.h>
#include <linux/if_vlan.h>
Modified: trunk/batman-adv-kernelland/gateway_common.c
===================================================================
--- trunk/batman-adv-kernelland/gateway_common.c 2010-01-23 08:08:03 UTC (rev 1562)
+++ trunk/batman-adv-kernelland/gateway_common.c 2010-01-23 08:58:22 UTC (rev 1563)
@@ -20,6 +20,7 @@
#include "main.h"
#include "gateway_common.h"
#include "gateway_client.h"
+#include "compat.h"
atomic_t gw_mode;
atomic_t gw_srv_class;
13 years
r1562 - trunk/batman-adv-kernelland
by postmaster@open-mesh.net
Author: marek
Date: 2010-01-23 09:08:03 +0100 (Sat, 23 Jan 2010)
New Revision: 1562
Modified:
trunk/batman-adv-kernelland/gateway_common.c
Log:
batman-adv: gateway class is an unsigned value - treat it as such
Signed-off-by: Marek Lindner <lindner_marek(a)yahoo.de>
Modified: trunk/batman-adv-kernelland/gateway_common.c
===================================================================
--- trunk/batman-adv-kernelland/gateway_common.c 2010-01-23 05:12:19 UTC (rev 1561)
+++ trunk/batman-adv-kernelland/gateway_common.c 2010-01-23 08:08:03 UTC (rev 1562)
@@ -85,7 +85,7 @@
switch (*gw_mode_tmp) {
case GW_MODE_CLIENT:
- ret = strict_strtol(tokptr, 10, gw_clnt_class_tmp);
+ ret = strict_strtoul(tokptr, 10, gw_clnt_class_tmp);
if (ret) {
printk(KERN_ERR "Client class of gateway mode invalid: %s\n",
tokptr);
@@ -104,7 +104,7 @@
if (slash_ptr)
*slash_ptr = 0;
- ret = strict_strtol(tokptr, 10, down);
+ ret = strict_strtoul(tokptr, 10, down);
if (ret) {
printk(KERN_ERR "Download speed of gateway mode invalid: %s\n",
tokptr);
@@ -121,7 +121,7 @@
/* we also got some upload info */
if (slash_ptr) {
- ret = strict_strtol(slash_ptr + 1, 10, up);
+ ret = strict_strtoul(slash_ptr + 1, 10, up);
if (ret) {
printk(KERN_ERR "Upload speed of gateway mode invalid: %s\n",
slash_ptr + 1);
13 years
r1561 - branches/batctl-0.2.x
by postmaster@open-mesh.net
Author: marek
Date: 2010-01-23 06:12:19 +0100 (Sat, 23 Jan 2010)
New Revision: 1561
Modified:
branches/batctl-0.2.x/proc.c
branches/batctl-0.2.x/sys.c
Log:
batctl: make batch-mode the default and offer watch mode to deactivate it
Modified: branches/batctl-0.2.x/proc.c
===================================================================
--- branches/batctl-0.2.x/proc.c 2010-01-23 04:55:01 UTC (rev 1560)
+++ branches/batctl-0.2.x/proc.c 2010-01-23 05:12:19 UTC (rev 1561)
@@ -72,27 +72,27 @@
{
printf("Usage: batctl [options] originators \n");
printf("options:\n");
- printf(" \t -b batch mode - read the originator table once and quit\n");
printf(" \t -h print this help\n");
printf(" \t -n don't replace mac addresses with bat-host names\n");
+ printf(" \t -w watch mode - refresh the originator table continuously\n");
}
void trans_local_usage(void)
{
printf("Usage: batctl [options] translocal \n");
printf("options:\n");
- printf(" \t -b batch mode - read the local translation table once and quit\n");
printf(" \t -h print this help\n");
printf(" \t -n don't replace mac addresses with bat-host names\n");
+ printf(" \t -w watch mode - refresh the local translation table continuously\n");
}
void trans_global_usage(void)
{
printf("Usage: batctl [options] transglobal \n");
printf("options:\n");
- printf(" \t -b batch mode - read the global translation table once and quit\n");
printf(" \t -h print this help\n");
printf(" \t -n don't replace mac addresses with bat-host names\n");
+ printf(" \t -w watch mode - refresh the global translation table continuously\n");
}
void orig_interval_usage(void)
@@ -118,19 +118,19 @@
int handle_table(int argc, char **argv, char *file_path, void table_usage(void))
{
- int optchar, read_opt = CLR_CONT_READ | USE_BAT_HOSTS;
+ int optchar, read_opt = USE_BAT_HOSTS;
- while ((optchar = getopt(argc, argv, "bhn")) != -1) {
+ while ((optchar = getopt(argc, argv, "hnw")) != -1) {
switch (optchar) {
- case 'b':
- read_opt &= ~CLR_CONT_READ;
- break;
case 'h':
table_usage();
return EXIT_SUCCESS;
case 'n':
read_opt &= ~USE_BAT_HOSTS;
break;
+ case 'w':
+ read_opt |= CLR_CONT_READ;
+ break;
default:
table_usage();
return EXIT_FAILURE;
Modified: branches/batctl-0.2.x/sys.c
===================================================================
--- branches/batctl-0.2.x/sys.c 2010-01-23 04:55:01 UTC (rev 1560)
+++ branches/batctl-0.2.x/sys.c 2010-01-23 05:12:19 UTC (rev 1561)
@@ -36,22 +36,18 @@
printf("Usage: batctl [options] log [logfile]\n");
printf("Note: if no logfile was specified stdin is read");
printf("options:\n");
- printf(" \t -b batch mode - read the log file once and quit\n");
printf(" \t -h print this help\n");
printf(" \t -n don't replace mac addresses with bat-host names\n");
+ printf(" \t -w watch mode - read the log file continuously\n");
}
int log_print(int argc, char **argv)
{
- int optchar, read_opt = CONT_READ | USE_BAT_HOSTS | LOG_MODE;
+ int optchar, read_opt = USE_BAT_HOSTS | LOG_MODE;
int found_args = 1;
- while ((optchar = getopt(argc, argv, "bhn")) != -1) {
+ while ((optchar = getopt(argc, argv, "hnw")) != -1) {
switch (optchar) {
- case 'b':
- read_opt &= ~CONT_READ;
- found_args += 1;
- break;
case 'h':
log_usage();
return EXIT_SUCCESS;
@@ -59,6 +55,10 @@
read_opt &= ~USE_BAT_HOSTS;
found_args += 1;
break;
+ case 'w':
+ read_opt |= CONT_READ;
+ found_args += 1;
+ break;
default:
log_usage();
return EXIT_FAILURE;
13 years
r1560 - trunk/batctl
by postmaster@open-mesh.net
Author: marek
Date: 2010-01-23 05:55:01 +0100 (Sat, 23 Jan 2010)
New Revision: 1560
Modified:
trunk/batctl/proc.c
trunk/batctl/sys.c
Log:
batctl: make batch-mode the default and offer watch mode to deactivate it
Modified: trunk/batctl/proc.c
===================================================================
--- trunk/batctl/proc.c 2010-01-20 18:25:36 UTC (rev 1559)
+++ trunk/batctl/proc.c 2010-01-23 04:55:01 UTC (rev 1560)
@@ -72,36 +72,36 @@
{
printf("Usage: batctl [options] originators \n");
printf("options:\n");
- printf(" \t -b batch mode - read the originator table once and quit\n");
printf(" \t -h print this help\n");
printf(" \t -n don't replace mac addresses with bat-host names\n");
+ printf(" \t -w watch mode - refresh the originator table continuously\n");
}
void trans_local_usage(void)
{
printf("Usage: batctl [options] translocal \n");
printf("options:\n");
- printf(" \t -b batch mode - read the local translation table once and quit\n");
printf(" \t -h print this help\n");
printf(" \t -n don't replace mac addresses with bat-host names\n");
+ printf(" \t -w watch mode - refresh the local translation table continuously\n");
}
void trans_global_usage(void)
{
printf("Usage: batctl [options] transglobal \n");
printf("options:\n");
- printf(" \t -b batch mode - read the global translation table once and quit\n");
printf(" \t -h print this help\n");
printf(" \t -n don't replace mac addresses with bat-host names\n");
+ printf(" \t -w watch mode - refresh the global translation table continuously\n");
}
void gw_srv_list_usage(void)
{
printf("Usage: batctl [options] gw_srv_list \n");
printf("options:\n");
- printf(" \t -b batch mode - read the gateway server list once and quit\n");
printf(" \t -h print this help\n");
printf(" \t -n don't replace mac addresses with bat-host names\n");
+ printf(" \t -w watch mode - refresh the gateway server list continuously\n");
}
void orig_interval_usage(void)
@@ -134,19 +134,19 @@
int handle_table(int argc, char **argv, char *file_path, void table_usage(void))
{
- int optchar, read_opt = CLR_CONT_READ | USE_BAT_HOSTS;
+ int optchar, read_opt = USE_BAT_HOSTS;
- while ((optchar = getopt(argc, argv, "bhn")) != -1) {
+ while ((optchar = getopt(argc, argv, "hnw")) != -1) {
switch (optchar) {
- case 'b':
- read_opt &= ~CLR_CONT_READ;
- break;
case 'h':
table_usage();
return EXIT_SUCCESS;
case 'n':
read_opt &= ~USE_BAT_HOSTS;
break;
+ case 'w':
+ read_opt |= CLR_CONT_READ;
+ break;
default:
table_usage();
return EXIT_FAILURE;
Modified: trunk/batctl/sys.c
===================================================================
--- trunk/batctl/sys.c 2010-01-20 18:25:36 UTC (rev 1559)
+++ trunk/batctl/sys.c 2010-01-23 04:55:01 UTC (rev 1560)
@@ -36,22 +36,18 @@
printf("Usage: batctl [options] log [logfile]\n");
printf("Note: if no logfile was specified stdin is read");
printf("options:\n");
- printf(" \t -b batch mode - read the log file once and quit\n");
printf(" \t -h print this help\n");
printf(" \t -n don't replace mac addresses with bat-host names\n");
+ printf(" \t -w watch mode - read the log file continuously\n");
}
int log_print(int argc, char **argv)
{
- int optchar, read_opt = CONT_READ | USE_BAT_HOSTS | LOG_MODE;
+ int optchar, read_opt = USE_BAT_HOSTS | LOG_MODE;
int found_args = 1;
- while ((optchar = getopt(argc, argv, "bhn")) != -1) {
+ while ((optchar = getopt(argc, argv, "hnw")) != -1) {
switch (optchar) {
- case 'b':
- read_opt &= ~CONT_READ;
- found_args += 1;
- break;
case 'h':
log_usage();
return EXIT_SUCCESS;
@@ -59,6 +55,10 @@
read_opt &= ~USE_BAT_HOSTS;
found_args += 1;
break;
+ case 'w':
+ read_opt |= CONT_READ;
+ found_args += 1;
+ break;
default:
log_usage();
return EXIT_FAILURE;
13 years