pmc: add command line options to control messaging.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
9fc5f31c8b
commit
9b2a6d543c
16
pmc.c
16
pmc.c
|
@ -20,6 +20,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
@ -312,9 +313,12 @@ static void usage(char *progname)
|
||||||
" -6 UDP IPV6\n"
|
" -6 UDP IPV6\n"
|
||||||
" -u UDS local\n\n"
|
" -u UDS local\n\n"
|
||||||
" Other Options\n\n"
|
" Other Options\n\n"
|
||||||
|
" -b [num] boundary hops, default 1\n"
|
||||||
|
" -d [num] domain number, default 0\n"
|
||||||
" -h prints this message and exits\n"
|
" -h prints this message and exits\n"
|
||||||
" -i [dev] interface device to use, default 'eth0'\n"
|
" -i [dev] interface device to use, default 'eth0'\n"
|
||||||
" for network and '/tmp/pmc' for UDS.\n"
|
" for network and '/tmp/pmc' for UDS.\n"
|
||||||
|
" -t [hex] transport specific field, default 0x0\n"
|
||||||
"\n",
|
"\n",
|
||||||
progname);
|
progname);
|
||||||
}
|
}
|
||||||
|
@ -332,7 +336,7 @@ int main(int argc, char *argv[])
|
||||||
/* Process the command line arguments. */
|
/* Process the command line arguments. */
|
||||||
progname = strrchr(argv[0], '/');
|
progname = strrchr(argv[0], '/');
|
||||||
progname = progname ? 1+progname : argv[0];
|
progname = progname ? 1+progname : argv[0];
|
||||||
while (EOF != (c = getopt(argc, argv, "246uhi:"))) {
|
while (EOF != (c = getopt(argc, argv, "246u""b:d:hi:t:"))) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '2':
|
case '2':
|
||||||
transport_type = TRANS_IEEE_802_3;
|
transport_type = TRANS_IEEE_802_3;
|
||||||
|
@ -346,9 +350,19 @@ int main(int argc, char *argv[])
|
||||||
case 'u':
|
case 'u':
|
||||||
transport_type = TRANS_UDS;
|
transport_type = TRANS_UDS;
|
||||||
break;
|
break;
|
||||||
|
case 'b':
|
||||||
|
boundary_hops = atoi(optarg);
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
domain_number = atoi(optarg);
|
||||||
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
iface_name = optarg;
|
iface_name = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 't':
|
||||||
|
if (1 == sscanf(optarg, "%x", &c))
|
||||||
|
transport_specific = c << 4;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage(progname);
|
usage(progname);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue