diff options
Diffstat (limited to 'contrib/perl5/lib/shellwords.pl')
-rw-r--r-- | contrib/perl5/lib/shellwords.pl | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/contrib/perl5/lib/shellwords.pl b/contrib/perl5/lib/shellwords.pl deleted file mode 100644 index 1c45a5a..0000000 --- a/contrib/perl5/lib/shellwords.pl +++ /dev/null @@ -1,48 +0,0 @@ -;# shellwords.pl -;# -;# Usage: -;# require 'shellwords.pl'; -;# @words = &shellwords($line); -;# or -;# @words = &shellwords(@lines); -;# or -;# @words = &shellwords; # defaults to $_ (and clobbers it) - -sub shellwords { - package shellwords; - local($_) = join('', @_) if @_; - local(@words,$snippet,$field); - - s/^\s+//; - while ($_ ne '') { - $field = ''; - for (;;) { - if (s/^"(([^"\\]|\\.)*)"//) { - ($snippet = $1) =~ s#\\(.)#$1#g; - } - elsif (/^"/) { - die "Unmatched double quote: $_\n"; - } - elsif (s/^'(([^'\\]|\\.)*)'//) { - ($snippet = $1) =~ s#\\(.)#$1#g; - } - elsif (/^'/) { - die "Unmatched single quote: $_\n"; - } - elsif (s/^\\(.)//) { - $snippet = $1; - } - elsif (s/^([^\s\\'"]+)//) { - $snippet = $1; - } - else { - s/^\s+//; - last; - } - $field .= $snippet; - } - push(@words, $field); - } - @words; -} -1; |