diff options
author | Stanislav Sedov <stas@FreeBSD.org> | 2011-08-23 09:23:54 +0000 |
---|---|---|
committer | Stanislav Sedov <stas@FreeBSD.org> | 2011-08-23 09:23:54 +0000 |
commit | bfc133318122e416d28344542c602360c1c12e4d (patch) | |
tree | 8359a3777fd2c46f6d6fdbbd66d6fb77eb488f28 /Tools/scripts | |
parent | d39e30b3dc35559f57c90e7d1bbda87be0b333fa (diff) | |
download | ports-bfc133318122e416d28344542c602360c1c12e4d.tar.gz ports-bfc133318122e416d28344542c602360c1c12e4d.zip |
Notes
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-x | Tools/scripts/sunshar.rb | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/Tools/scripts/sunshar.rb b/Tools/scripts/sunshar.rb index 70b038e8958e..eb31296b5692 100755 --- a/Tools/scripts/sunshar.rb +++ b/Tools/scripts/sunshar.rb @@ -32,15 +32,11 @@ RCS_ID = %q$Idaemons: /home/cvs/sunshar/sunshar.rb,v 1.13 2004/02/28 14:15:47 kn RCS_REVISION = RCS_ID.split[2] MYNAME = File.basename($0) -require 'parsearg' +require 'optparse' require 'fileutils' require 'shellwords' require 'stringio' -begin - require 'features/ruby18/dir' -rescue LoadError; end - $USAGE = 'usage' $strip_level = 0 @@ -69,32 +65,32 @@ usage: #{MYNAME} [-fnq] [-p level] [file] end def main - parseArgs(0, nil, 'fhnq', 'd:', 'p:') + params = ARGV.getopts("fhnq", "d:", "p:") - if $OPT_h + if params['h'] usage exit 0 end - if $OPT_f + if params['f'] $force = true end - if $OPT_n + if params['n'] $dryrun = true end - if $OPT_q + if params['q'] $quiet = true end - $dir = $OPT_d || '.' + $dir = params['d'] || '.' - if $OPT_p - $strip_level = $OPT_p.to_i rescue -1 + if not params['p'].nil? + $strip_level = params['p'].to_i rescue -1 if $strip_level < 0 - STDERR.puts "negative value ignored: #{$OPT_p}" + STDERR.puts "negative value ignored: #{params['p']}" end end |