phc2sys: common code exit point for bad usage case
Removed duplicate calls to usage() by providing common exit point for the case. Signed-off-by: Libor Pechacek <lpechacek@suse.cz>master
parent
f394e1796d
commit
daca2773de
19
phc2sys.c
19
phc2sys.c
|
@ -684,37 +684,32 @@ int main(int argc, char *argv[])
|
||||||
usage(progname);
|
usage(progname);
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
usage(progname);
|
goto bad_usage;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pps_fd < 0 && src == CLOCK_INVALID) {
|
if (pps_fd < 0 && src == CLOCK_INVALID) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"valid source clock must be selected.\n");
|
"valid source clock must be selected.\n");
|
||||||
usage(progname);
|
goto bad_usage;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dst_clock.clkid == CLOCK_INVALID) {
|
if (dst_clock.clkid == CLOCK_INVALID) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"valid destination clock must be selected.\n");
|
"valid destination clock must be selected.\n");
|
||||||
usage(progname);
|
goto bad_usage;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pps_fd >= 0 && dst_clock.clkid != CLOCK_REALTIME) {
|
if (pps_fd >= 0 && dst_clock.clkid != CLOCK_REALTIME) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"cannot use a pps device unless destination is CLOCK_REALTIME\n");
|
"cannot use a pps device unless destination is CLOCK_REALTIME\n");
|
||||||
usage(progname);
|
goto bad_usage;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wait_sync && !forced_sync_offset) {
|
if (!wait_sync && !forced_sync_offset) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"time offset must be specified using -w or -O\n");
|
"time offset must be specified using -w or -O\n");
|
||||||
usage(progname);
|
goto bad_usage;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dst_clock.stats_max_count > 0) {
|
if (dst_clock.stats_max_count > 0) {
|
||||||
|
@ -793,4 +788,8 @@ int main(int argc, char *argv[])
|
||||||
phc_readings);
|
phc_readings);
|
||||||
|
|
||||||
return do_phc_loop(&dst_clock, src, &phc_interval_tp, phc_readings);
|
return do_phc_loop(&dst_clock, src, &phc_interval_tp, phc_readings);
|
||||||
|
|
||||||
|
bad_usage:
|
||||||
|
usage(progname);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue