1275970Scy# EDIT THIS FILE WITH CAUTION (ntp-wait-opts) 2275970Scy# 3330567Sgordon# It has been AutoGen-ed February 27, 2018 at 10:49:48 AM by AutoGen 5.18.5 4275970Scy# From the definitions ntp-wait-opts.def 5275970Scy# and the template file perlopt 6275970Scy 7275970Scyuse Getopt::Long qw(GetOptionsFromArray); 8275970ScyGetopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always)); 9275970Scy 10275970Scymy $usage; 11275970Scy 12275970Scysub usage { 13275970Scy my ($ret) = @_; 14275970Scy print STDERR $usage; 15275970Scy exit $ret; 16275970Scy} 17275970Scy 18275970Scysub paged_usage { 19275970Scy my ($ret) = @_; 20275970Scy my $pager = $ENV{PAGER} || '(less || more)'; 21275970Scy 22275970Scy open STDOUT, "| $pager" or die "Can't fork a pager: $!"; 23275970Scy print $usage; 24275970Scy 25275970Scy exit $ret; 26275970Scy} 27275970Scy 28275970Scysub processOptions { 29275970Scy my $args = shift; 30275970Scy 31275970Scy my $opts = { 32275970Scy 'tries' => '100', 33275970Scy 'sleep' => '6', 34275970Scy 'verbose' => '', 35275970Scy 'help' => '', 'more-help' => '' 36275970Scy }; 37275970Scy my $argument = ''; 38275970Scy my $ret = GetOptionsFromArray($args, $opts, ( 39275970Scy 'tries|n=i', 'sleep|s=i', 'verbose|v', 40275970Scy 'help|?', 'more-help')); 41275970Scy 42275970Scy $usage = <<'USAGE'; 43330567Sgordonntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p11 44275970ScyUSAGE: ntp-wait [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 45275970Scy 46275970Scy -n, --tries=num Number of times to check ntpd 47275970Scy -s, --sleep=num How long to sleep between tries 48275970Scy -v, --verbose Be verbose 49275970Scy -?, --help Display usage information and exit 50275970Scy --more-help Pass the extended usage text through a pager 51275970Scy 52275970ScyOptions are specified by doubled hyphens and their name or by a single 53275970Scyhyphen and the flag character. 54275970ScyUSAGE 55275970Scy 56275970Scy usage(0) if $opts->{'help'}; 57275970Scy paged_usage(0) if $opts->{'more-help'}; 58275970Scy $_[0] = $opts; 59275970Scy return $ret; 60275970Scy} 61275970Scy 62275970ScyEND { close STDOUT }; 63