Commit d9800f9f authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

Fix string handling.

Enable perl warnings Add a proper --help option and usage.
parent 1d691d5d
#! /usr/bin/perl #! /usr/bin/perl -w
# #
# Copyright 2000 Patrik Stridvall # Copyright 2000 Patrik Stridvall
# #
...@@ -19,22 +19,38 @@ ...@@ -19,22 +19,38 @@
use strict; use strict;
my $name0=$0;
$name0 =~ s%^.*/%%;
my $invert = 0; my $invert = 0;
my $pattern; my $pattern;
my @files = (); my @files = ();
my $usage;
while(defined($_ = shift)) { while(defined($_ = shift)) {
if(/^-/) { if (/^-v$/) {
if(/^-v$/) {
$invert = 1; $invert = 1;
} } elsif (/^--?(\?|h|help)$/) {
} else { $usage=0;
if(!defined($pattern)) { } elsif (/^-/) {
print STDERR "$name0:error: unknown option '$_'\n";
$usage=2;
last;
} elsif(!defined($pattern)) {
$pattern = $_; $pattern = $_;
} else { } else {
push @files, $_; push @files, $_;
} }
} }
if (defined $usage)
{
print "Usage: $name0 [--help] [-v] pattern files...\n";
print "where:\n";
print "--help Prints this help message\n";
print "-v Return functions that do not match pattern\n";
print "pattern A regular expression for the function name\n";
print "files... A list of files to search the function in\n";
exit $usage;
} }
foreach my $file (@files) { foreach my $file (@files) {
...@@ -266,9 +282,9 @@ foreach my $file (@files) { ...@@ -266,9 +282,9 @@ foreach my $file (@files) {
} }
} }
} }
} elsif(/\'[^\']*\'/s) { } elsif(/\'(?:[^\\\']*|\\.)*\'/s) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
} elsif(/\"[^\"]*\"/s) { } elsif(/\"(?:[^\\\"]*|\\.)*\"/s) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
} elsif(/;/s) { } elsif(/;/s) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment