Permalink
Browse files

Properly quote strings containing newlines or tabs.

  • Loading branch information...
1 parent 6e58ff2 commit ef4700c428af8be6e6c92199bdb59e305d5ae04f @nelhage committed Apr 9, 2010
Showing with 2 additions and 2 deletions.
  1. +1 −1 perl/lib/BarnOwl.pm
  2. +1 −1 text.c
View
@@ -362,7 +362,7 @@ sub quote {
for my $str (@_) {
if ($str eq '') {
push @quoted, "''";
- } elsif ($str !~ /['" ]/) {
+ } elsif ($str !~ /['" \n\t]/) {
push @quoted, "$str";
} elsif ($str !~ /'/) {
push @quoted, "'$str'";
View
2 text.c
@@ -270,7 +270,7 @@ const char *owl_getquoting(const char *line)
if (line[0]=='\0') return("'");
if (strchr(line, '\'')) return("\"");
if (strchr(line, '"')) return("'");
- if (strchr(line, ' ')) return("'");
+ if (strcspn(line, "\n\t ") != strlen(line)) return("'");
return("");
}

0 comments on commit ef4700c

Please sign in to comment.