diff -r b954e9d91ea5 -r 30fddfce8db6 tools/main.cpp --- a/tools/main.cpp Mon Jun 02 10:51:31 2008 +0000 +++ b/tools/main.cpp Mon Jun 02 11:08:49 2008 +0000 @@ -16,10 +16,10 @@ #define DEFAULT_MASTER 0 #define DEFAULT_COMMAND "slaves" -#define DEFAULT_SLAVESPEC "" +#define DEFAULT_SLAVEPOSITION -1 static unsigned int masterIndex = DEFAULT_MASTER; -static int slavePosition = -1; +static int slavePosition = DEFAULT_SLAVEPOSITION; static string command = DEFAULT_COMMAND; /*****************************************************************************/ @@ -34,8 +34,10 @@ << "Global options:" << endl << " --master -m Index of the master to use. Default: " << DEFAULT_MASTER << endl - << " --slave -s Numerical ring position. Default: All " - "slaves." << endl + << " --slave -s Positive numerical ring position," + << endl + << " or 'all' for all slaves. Default: 'all'." + << endl << " --help -h Show this help." << endl; } @@ -69,14 +71,19 @@ break; case 's': - number = strtoul(optarg, &remainder, 0); - if (remainder == optarg || *remainder - || number < 0 || number > 0xFFFF) { - cerr << "Invalid slave position " << optarg << "!" << endl; - printUsage(); - exit(1); + if (!strcmp(optarg, "all")) { + slavePosition = -1; + } else { + number = strtoul(optarg, &remainder, 0); + if (remainder == optarg || *remainder + || number < 0 || number > 0xFFFF) { + cerr << "Invalid slave position " + << optarg << "!" << endl; + printUsage(); + exit(1); + } + slavePosition = number; } - slavePosition = number; break; case 'h':