Fix c2man.pl
Hans Leidekker
hans at it.vu.nl
Sun Apr 13 05:43:19 CDT 2003
I saw messages like these in the output of a 'make htmlpages':
sh: line 2: ../../include/x11drv.h: Permission denied
sh: line 2: ../../include/wingdi.h: Permission denied
sh: line 3: ../../include/x11drv.h: Permission denied
sh: line 2: ../../include/x11drv.h: Permission denied
which annoyed me enough to fix it. c2man.pl greps the headers for
functions but didn't cope well enough with multiple matches. The
patch also contains a performance improvement. The greps where
blindly performed, even if the string to search for was empty,
which is the common case. So I made that conditional.
Changelog: handle multiline output from grep and don't grep
for empty strings.
Index: tools/c2man.pl
===================================================================
RCS file: /home/wine/wine/tools/c2man.pl,v
retrieving revision 1.5
diff -u -r1.5 c2man.pl
--- tools/c2man.pl 15 Mar 2003 19:45:48 -0000 1.5
+++ tools/c2man.pl 13 Apr 2003 10:30:17 -0000
@@ -761,27 +761,29 @@
# FIXME: If we have no parameters, make sure we have a PARAMS: None. section
# Find header file
- # FIXME: This sometimes gives the error "sh: <file>.h: Permission denied" - why?
my $h_file = "";
- my $tmp = "grep -s -l $comment->{COMMENT_NAME} @opt_header_file_list 2>/dev/null";
- $tmp = `$tmp`;
- my $exit_value = $? >> 8;
- if ($exit_value == 0)
+ if ($comment->{COMMENT_NAME} ne "")
{
- $tmp =~ s/\n.*//;
- if ($tmp ne "")
+ my $tmp = "grep -s -l $comment->{COMMENT_NAME} @opt_header_file_list 2>/dev/null";
+ $tmp = `$tmp`;
+ my $exit_value = $? >> 8;
+ if ($exit_value == 0)
{
- $h_file = `basename $tmp`;
+ $tmp =~ s/\n.*//g;
+ if ($tmp ne "")
+ {
+ $h_file = `basename $tmp`;
+ }
}
}
- else
+ elsif ($comment->{ALT_NAME} ne "")
{
- $tmp = "grep -s -l $comment->{ALT_NAME} @opt_header_file_list"." 2>/dev/null";
+ my $tmp = "grep -s -l $comment->{ALT_NAME} @opt_header_file_list"." 2>/dev/null";
$tmp = `$tmp`;
- $exit_value = $? >> 8;
+ my $exit_value = $? >> 8;
if ($exit_value == 0)
{
- $tmp =~ s/\n.*//;
+ $tmp =~ s/\n.*//g;
if ($tmp ne "")
{
$h_file = `basename $tmp`;
More information about the wine-patches
mailing list