Index: wine/tools/winapi/winapi_cleanup
===================================================================
RCS file: /home/wine/wine/tools/winapi/winapi_cleanup,v
retrieving revision 1.3
diff -u -r1.3 winapi_cleanup
--- wine/tools/winapi/winapi_cleanup	1 Oct 2002 18:10:54 -0000	1.3
+++ wine/tools/winapi/winapi_cleanup	30 Dec 2002 20:30:59 -0000
@@ -24,10 +24,11 @@
     require "$1/winapi/setup.pm";
 }
 
-use config qw($current_dir $wine_dir);
+use config qw($current_dir $wine_dir file_absolutize file_directory);
 use output qw($output);
 use winapi_cleanup_options qw($options);
 
+use nativeapi qw($nativeapi);
 use util qw(edit_file);
 
 if($options->progress) {
@@ -43,6 +44,13 @@
     local *IN = shift;
     local *OUT = shift;
 
+    my $file = shift;
+    my $dir = do {
+	my $file2 = file_absolutize($file);
+	my $dir = file_directory($file2);
+	"$wine_dir/$dir";
+    };
+
     my $indent;
     my @comments = ();
     my $format_comments = sub {
@@ -117,6 +125,75 @@
 	    }
 	}
 
+	if ($options->include_qoutes) {
+	    my $module = "";
+	    if ($dir =~ m%^$wine_dir/(?:controls|windows)$%) {
+		$module = "user";
+	    } elsif ($dir =~ m%^$wine_dir/(?:graphics)$%) {
+		$module = "gdi";
+	    } elsif ($dir =~ m%^$wine_dir/(?:graphics|windows)/x11drv$%) {
+		$module = "x11drv";
+	    } elsif ($dir =~ m%^$wine_dir/dlls/(.*?)/.*?$%) {
+		$module = $1;
+	    }
+
+	    if (/^(\s*\#\s*include\s+)(?:<(.*?)>|\"(.*?)\")(.*?)\s*$/) {
+		my $prefix = $1;
+		my $header = $2 || $3;
+		my $local = !defined($2) && defined($3);
+		my $suffix = $4;
+
+		my $exists_system = 0; {
+		    my @system_paths = qw(/usr/include /usr/local/include /usr/X11R6/include);
+		    foreach my $path (@system_paths) {
+			$exists_system ||= (-e "$path/$header" || 0);
+		    }
+		    $exists_system ||= $nativeapi->is_conditional_header($header);
+		}
+
+		my $exists_windows = 0; {
+		    if ($header !~ m%^wine/% && $header ne "config.h") {
+			$exists_windows ||= (-e "$wine_dir/include/$header" || 0);
+		    }
+		}
+
+		my $exists_wine = 0; {
+		    $exists_wine ||= ($header eq "config.h");
+
+		    if ($header =~ m%^wine/%) {
+			$exists_wine ||= (-e "$wine_dir/include/$header" || 0);
+		    }
+		}
+
+		my $exists_local = 0; {
+		    $exists_local ||= ($header eq "y.tab.h");
+
+		    my @local_paths = ();
+		    push @local_paths, "$dir" if $dir !~ m%^$wine_dir/include%;
+		    push @local_paths, "$wine_dir/dlls/$module" if $module;
+		    foreach my $path (@local_paths) {
+			$exists_local ||= (-e "$path/$header" || 0);
+		    }
+		}
+
+		if (!$exists_system && !$exists_windows && !$exists_wine && !$exists_local) {
+		    $output->write("warning: header '$header': doesn't exist\n");
+		} elsif (($exists_system + $exists_windows + $exists_wine + $exists_local) > 1) {
+		    if ($header !~ /^(?:async\.h|comcat\.h|sql(?:ext|types)?\.h|thread\.h|user\.h)$/) {
+			$output->write("warning: header '$header': more than one possibillity\n");
+		    }
+		}
+
+		if (!$local && $exists_local) {
+		    $_ = "$prefix\"$header\"$suffix";
+		    $modified = 1;
+		} elsif ($local && !$exists_local && ($exists_system || $exists_windows || $exists_wine)) {
+		    $_ = "$prefix<$header>$suffix";
+		    $modified = 1;
+		}
+	    }
+	}
+
 	print OUT "$_\n";
     }
 
@@ -142,8 +219,9 @@
 foreach my $file (@h_files) {
     $progress_current++;
     $output->progress("$file (file $progress_current of $progress_max)");
+    $output->prefix("$file: ");
 
-    if (edit_file($file, \&cleanup_file, @_)) {
+    if (edit_file($file, \&cleanup_file, @_, $file)) {
 	$output->write("$file: modified\n");
     }
 }
@@ -151,8 +229,9 @@
 foreach my $file (@c_files) {
     $progress_current++;
     $output->progress("$file (file $progress_current of $progress_max)");
+    $output->prefix("$file: ");
 
-    if (edit_file($file, \&cleanup_file, @_)) {
+    if (edit_file($file, \&cleanup_file, $file)) {
 	$output->write("$file: modified\n");
     }
 }
Index: wine/tools/winapi/winapi_cleanup_options.pm
===================================================================
RCS file: /home/wine/wine/tools/winapi/winapi_cleanup_options.pm,v
retrieving revision 1.2
diff -u -r1.2 winapi_cleanup_options.pm
--- wine/tools/winapi/winapi_cleanup_options.pm	12 Sep 2002 20:42:44 -0000	1.2
+++ wine/tools/winapi/winapi_cleanup_options.pm	30 Dec 2002 20:30:59 -0000
@@ -37,7 +37,8 @@
 
     "progress" => { default => 1, description => "show progress" },
 
-    "cpp-comments" => { default => 1, description => "converts C++ comments to C comments" },
+    "cpp-comments" => { default => 1, description => "convert C++ comments to C comments" },
+    "include-qoutes" => { default => 0, description => "convert #include \"\" to <> or the reverse where appropriate" },
     "trailing-whitespace" => { default => 0, description => "remove trailing whitespace" },
 );
 
Index: wine/tools/winapi_check/nativeapi.pm
===================================================================
RCS file: /home/wine/wine/tools/winapi_check/nativeapi.pm,v
retrieving revision 1.14
diff -u -r1.14 nativeapi.pm
--- wine/tools/winapi_check/nativeapi.pm	1 Jun 2002 02:55:53 -0000	1.14
+++ wine/tools/winapi_check/nativeapi.pm	30 Dec 2002 20:30:59 -0000
@@ -144,7 +144,7 @@
 
     my $name = shift;
 
-    return $$functions{$name};
+    return ($$functions{$name} || 0);
 }
 
 sub is_conditional {
@@ -153,7 +153,7 @@
 
     my $name = shift;
 
-    return $$conditionals{$name};
+    return ($$conditionals{$name} || 0);
 }
 
 sub found_conditional {
@@ -171,7 +171,7 @@
 
     my $name = shift;
 
-    return $$conditional_headers{$name};
+    return ($$conditional_headers{$name} || 0);
 }
 
 sub is_conditional_function {
@@ -180,7 +180,7 @@
 
     my $name = shift;
 
-    return $$conditional_functions{$name};
+    return ($$conditional_functions{$name} || 0);
 }
 
 sub global_report {
