# File lib/mpdserver.rb, line 1087 def build_args( line ) ret = [] word = '' escaped = false in_quote = false line.strip! line.each_byte do |c| c = c.chr if c == ' ' and !in_quote ret << word unless word.empty? word = '' elsif c == '"' and !escaped if in_quote in_quote = false else in_quote = true end ret << word unless word.empty? word = '' else escaped = (c == '\\') word += c end end ret << word unless word.empty? return ret end