phc2sys: update usage/error reporting

This patch updates phc2sys usage reporting to give a slightly better indication
of why the program was unable to run.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
master
Jacob Keller 2013-05-14 15:12:16 -07:00 committed by Richard Cochran
parent 73105bc65a
commit 2a89756654
1 changed files with 17 additions and 3 deletions

View File

@ -663,9 +663,23 @@ int main(int argc, char *argv[])
}
}
if (!(pps_fd >= 0 || src != CLOCK_INVALID) ||
dst_clock.clkid == CLOCK_INVALID ||
(pps_fd >= 0 && dst_clock.clkid != CLOCK_REALTIME)) {
if (pps_fd < 0 && src == CLOCK_INVALID) {
fprintf(stderr,
"valid source clock must be selected.\n");
usage(progname);
return -1;
}
if (dst_clock.clkid == CLOCK_INVALID) {
fprintf(stderr,
"valid destination clock must be selected.\n");
usage(progname);
return -1;
}
if (pps_fd >= 0 && dst_clock.clkid != CLOCK_REALTIME) {
fprintf(stderr,
"cannot use a pps device unless destination is CLOCK_REALTIME\n");
usage(progname);
return -1;
}