diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-04-10 05:48:43 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-04-10 05:48:43 +0000 |
commit | 12e1ee3abd5587c9d0750700a2478b2fbf8904d1 (patch) | |
tree | 2897ec289b6190b3b51602bf4ca0ebbcaad2622f /lib | |
parent | bb1321b4e52b0a6cec5003487215dc364739c897 (diff) |
2000-04-10
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ftplib.rb | 2 | ||||
-rw-r--r-- | lib/mkmf.rb | 2 | ||||
-rw-r--r-- | lib/shellwords.rb | 31 |
3 files changed, 19 insertions, 16 deletions
diff --git a/lib/ftplib.rb b/lib/ftplib.rb index 0b90749274..4cb1b752d6 100644 --- a/lib/ftplib.rb +++ b/lib/ftplib.rb @@ -2,7 +2,7 @@ # ftplib.rb # -$stderr.puts 'Warning: ftplib.rb is obsolute: use net/ftp' +$stderr.puts 'Warning: ftplib.rb is obsolete: use net/ftp' require 'net/ftp' diff --git a/lib/mkmf.rb b/lib/mkmf.rb index f510e9c509..805be307d0 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -327,7 +327,7 @@ def create_makefile(target) $DLDFLAGS = CONFIG["DLDFLAGS"] if RUBY_PLATFORM =~ /beos/ - $libs = $libs + " -lruby" + $libs = $libs + " " + CONFIG["LIBRUBYARG"] $DLDFLAGS = $DLDFLAGS + " -L" + CONFIG["prefix"] + "/lib" end diff --git a/lib/shellwords.rb b/lib/shellwords.rb index 60996be17c..7b16c6cb52 100644 --- a/lib/shellwords.rb +++ b/lib/shellwords.rb @@ -2,43 +2,46 @@ # original is shellwords.pl # # Usage: -# require 'shellwords.rb' +# require 'shellwords' # words = Shellwords.shellwords(line) # # or # +# require 'shellwords' # include Shellwords # words = shellwords(line) module Shellwords def shellwords(line) - return '' unless line - line.sub! /^\s+/, '' + unless line.kind_of?(String) + raise ArgumentError, "Argument must be String class object." + end + line.sub!(/^\s+/, '') words = [] while line != '' field = '' while true - if line.sub! /^"(([^"\\]|\\.)*)"/, '' then #" + if line.sub!(/^"(([^"\\]|\\.)*)"/, '') then #" snippet = $1 - snippet.gsub! /\\(.)/, '\1' + snippet.gsub!(/\\(.)/, '\1') elsif line =~ /^"/ then #" - raise ArgError, "Unmatched double quote: #{line}" - elsif line.sub! /^'(([^'\\]|\\.)*)'/, '' then #' + raise ArgumentError, "Unmatched double quote: #{line}" + elsif line.sub!(/^'(([^'\\]|\\.)*)'/, '') then #' snippet = $1 - snippet.gsub! /\\(.)/, '\1' + snippet.gsub!(/\\(.)/, '\1') elsif line =~ /^'/ then #' - raise ArgError, "Unmatched single quote: #{line}" - elsif line.sub! /^\\(.)/, '' then + raise ArgumentError, "Unmatched single quote: #{line}" + elsif line.sub!(/^\\(.)/, '') then snippet = $1 - elsif line.sub! /^([^\s\\'"]+)/, '' then #' + elsif line.sub!(/^([^\s\\'"]+)/, '') then #' snippet = $1 else - line.sub! /^\s+/, '' + line.sub!(/^\s+/, '') break end - field += snippet + field.concat(snippet) end - words += field + words.push(field) end words end |