1*2b15cb3dSCy Schubert# EDIT THIS FILE WITH CAUTION (ntp-wait-opts) 2*2b15cb3dSCy Schubert# 3*2b15cb3dSCy Schubert# It has been AutoGen-ed February 4, 2015 at 02:37:18 AM by AutoGen 5.18.5pre4 4*2b15cb3dSCy Schubert# From the definitions ntp-wait-opts.def 5*2b15cb3dSCy Schubert# and the template file perlopt 6*2b15cb3dSCy Schubert 7*2b15cb3dSCy Schubertuse Getopt::Long qw(GetOptionsFromArray); 8*2b15cb3dSCy SchubertGetopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always)); 9*2b15cb3dSCy Schubert 10*2b15cb3dSCy Schubertmy $usage; 11*2b15cb3dSCy Schubert 12*2b15cb3dSCy Schubertsub usage { 13*2b15cb3dSCy Schubert my ($ret) = @_; 14*2b15cb3dSCy Schubert print STDERR $usage; 15*2b15cb3dSCy Schubert exit $ret; 16*2b15cb3dSCy Schubert} 17*2b15cb3dSCy Schubert 18*2b15cb3dSCy Schubertsub paged_usage { 19*2b15cb3dSCy Schubert my ($ret) = @_; 20*2b15cb3dSCy Schubert my $pager = $ENV{PAGER} || '(less || more)'; 21*2b15cb3dSCy Schubert 22*2b15cb3dSCy Schubert open STDOUT, "| $pager" or die "Can't fork a pager: $!"; 23*2b15cb3dSCy Schubert print $usage; 24*2b15cb3dSCy Schubert 25*2b15cb3dSCy Schubert exit $ret; 26*2b15cb3dSCy Schubert} 27*2b15cb3dSCy Schubert 28*2b15cb3dSCy Schubertsub processOptions { 29*2b15cb3dSCy Schubert my $args = shift; 30*2b15cb3dSCy Schubert 31*2b15cb3dSCy Schubert my $opts = { 32*2b15cb3dSCy Schubert 'tries' => '100', 33*2b15cb3dSCy Schubert 'sleep' => '6', 34*2b15cb3dSCy Schubert 'verbose' => '', 35*2b15cb3dSCy Schubert 'help' => '', 'more-help' => '' 36*2b15cb3dSCy Schubert }; 37*2b15cb3dSCy Schubert my $argument = ''; 38*2b15cb3dSCy Schubert my $ret = GetOptionsFromArray($args, $opts, ( 39*2b15cb3dSCy Schubert 'tries|n=i', 'sleep|s=i', 'verbose|v', 40*2b15cb3dSCy Schubert 'help|?', 'more-help')); 41*2b15cb3dSCy Schubert 42*2b15cb3dSCy Schubert $usage = <<'USAGE'; 43*2b15cb3dSCy Schubertntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p1 44*2b15cb3dSCy SchubertUSAGE: ntp-wait [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 45*2b15cb3dSCy Schubert 46*2b15cb3dSCy Schubert -n, --tries=num Number of times to check ntpd 47*2b15cb3dSCy Schubert -s, --sleep=num How long to sleep between tries 48*2b15cb3dSCy Schubert -v, --verbose Be verbose 49*2b15cb3dSCy Schubert -?, --help Display usage information and exit 50*2b15cb3dSCy Schubert --more-help Pass the extended usage text through a pager 51*2b15cb3dSCy Schubert 52*2b15cb3dSCy SchubertOptions are specified by doubled hyphens and their name or by a single 53*2b15cb3dSCy Schuberthyphen and the flag character. 54*2b15cb3dSCy SchubertUSAGE 55*2b15cb3dSCy Schubert 56*2b15cb3dSCy Schubert usage(0) if $opts->{'help'}; 57*2b15cb3dSCy Schubert paged_usage(0) if $opts->{'more-help'}; 58*2b15cb3dSCy Schubert $_[0] = $opts; 59*2b15cb3dSCy Schubert return $ret; 60*2b15cb3dSCy Schubert} 61*2b15cb3dSCy Schubert 62*2b15cb3dSCy SchubertEND { close STDOUT }; 63