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;
Show replies by thread