pmc: provide a reasonable default path when using UDS.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2012-08-25 09:30:44 +02:00
parent dac6372091
commit 9fc5f31c8b
1 changed files with 5 additions and 1 deletions

6
pmc.c
View File

@ -314,13 +314,14 @@ static void usage(char *progname)
" Other Options\n\n" " Other Options\n\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"
"\n", "\n",
progname); progname);
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
char *iface_name = "eth0", *progname; char *iface_name = NULL, *progname;
int c, cnt, length; int c, cnt, length;
char line[1024]; char line[1024];
enum transport_type transport_type = TRANS_UDP_IPV4; enum transport_type transport_type = TRANS_UDP_IPV4;
@ -360,6 +361,9 @@ int main(int argc, char *argv[])
} }
} }
if (!iface_name) {
iface_name = transport_type == TRANS_UDS ? "/tmp/pmc" : "eth0";
}
if (transport_type != TRANS_UDS && if (transport_type != TRANS_UDS &&
generate_clock_identity(&port_identity.clockIdentity, iface_name)) { generate_clock_identity(&port_identity.clockIdentity, iface_name)) {
fprintf(stderr, "failed to generate a clock identity\n"); fprintf(stderr, "failed to generate a clock identity\n");