summaryrefslogtreecommitdiff
path: root/check-config-h.pl
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2000-05-02 00:50:32 +0000
committerDarin Adler <darin@src.gnome.org>2000-05-02 00:50:32 +0000
commit292a29b61f5eb74c003425e961b6805a8ceb2b04 (patch)
tree317dfce550ce5e14c10f21f16f76fd9840f8a95f /check-config-h.pl
parentf115ffb697c4974d4589db0c980cfec78b4dfba2 (diff)
downloadnautilus-292a29b61f5eb74c003425e961b6805a8ceb2b04.tar.gz
Wrote a script to check for files that forget to include <config.h> and
* check-config-h.pl: Wrote a script to check for files that forget to include <config.h> and optionally edit to add it. * src/nautilus-zoom-control.c (set_zoom_level): Fixed the bug number in a FIXME. * docs/style-guide.html: Added one more tip. * check-FIXME.pl: Use my newfound Perl knowledge to spruce it up. * components/help/converters/gnome-db2html2/gdb3html.c: * components/help/converters/gnome-db2html2/sect-elements.c: * components/help/converters/gnome-db2html2/sect-preparse.c: * components/help/converters/gnome-db2html2/toc-elements.c: * components/help/converters/gnome-info2html2/html.c: * components/help/converters/gnome-info2html2/main.c: * components/help/converters/gnome-info2html2/parse.c: * components/help/converters/gnome-info2html2/utils.c: * components/help/converters/gnome-man2html2/gnome-man2html.c: * components/help/hyperbola-filefmt.c: * components/help/hyperbola-nav-index.c: * components/help/hyperbola-nav-search.c: * components/help/hyperbola-nav-tree.c: * components/html/glibwww-callbacks.c: * components/html/glibwww-init.c: * components/html/glibwww-trans.c: * components/html/gnome-dialogs.c: * components/html/ntl-web-browser.c: * components/services/install/eazel-install-metadata.c: * components/services/install/eazel-install-protocols.c: * components/services/install/eazel-install-rpm-glue.c: * components/services/install/eazel-install-tests.c: * components/services/install/eazel-install-utils.c: * components/services/install/eazel-install-xml-package-list.c: * components/services/install/eazel-install.c: * components/services/install/helixcode-install-utils.c: * components/services/startup/eazel-register.c: * components/websearch/ntl-web-search.c: * helper-utilities/authenticate/nautilus-authenticate-fork.c: * helper-utilities/authenticate/nautilus-authenticate-pam.c: * helper-utilities/authenticate/nautilus-authenticate.c: * libnautilus-extensions/nautilus-bonobo-extensions.c: * libnautilus-extensions/nautilus-file-utilities.c: * libnautilus-extensions/nautilus-glib-extensions.c: * libnautilus-extensions/nautilus-link.c: * libnautilus-extensions/nautilus-mime-type.c: * libnautilus-extensions/nautilus-undo-transaction.c: * librsvg/art_rgba.c: * librsvg/art_rgba_svp.c: * librsvg/rsvg-bpath-util.c: * librsvg/rsvg-path.c: * librsvg/rsvg.c: * librsvg/test-rsvg.c: * nautilus-widgets/nautilus-caption-table.c: * nautilus-widgets/nautilus-password-dialog.c: * nautilus-widgets/nautilus-preferences-box.c: * nautilus-widgets/nautilus-preferences-dialog.c: * nautilus-widgets/nautilus-preferences-group.c: * nautilus-widgets/nautilus-preferences-item.c: * nautilus-widgets/nautilus-preferences-pane.c: * nautilus-widgets/nautilus-radio-button-group.c: * nautilus-widgets/test-nautilus-widgets.c: * nautilus-widgets/test-preferences.c: * src/file-manager/desktop-item.c: * src/file-manager/desktop-layout.c: * src/file-manager/desktop-menu.c: * src/nautilus-bookmarks-window.c: * src/nautilus-gconf.c: * src/nautilus-window-menus.c: * src/nautilus-window-toolbars.c: * src/nautilus-zoom-control.c * src/nautilus-zoomable-frame-svr.c: * src/ntl-app.c: * src/ntl-content-view.c: * src/ntl-main.c: * src/ntl-meta-view.c: * src/ntl-miniicon.c: * src/ntl-uri-map.c: * src/ntl-view-frame-svr.c: * src/ntl-view.c: * src/ntl-window-state.c: Added includes of <config.h>.
Diffstat (limited to 'check-config-h.pl')
-rwxr-xr-xcheck-config-h.pl91
1 files changed, 91 insertions, 0 deletions
diff --git a/check-config-h.pl b/check-config-h.pl
new file mode 100755
index 000000000..d7ee76856
--- /dev/null
+++ b/check-config-h.pl
@@ -0,0 +1,91 @@
+#!/usr/bin/perl -w
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+
+#
+# Nautilus
+#
+# Copyright (C) 2000 Eazel, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this library; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# Author: Darin Adler <darin@eazel.com>,
+#
+
+# check-config-h.pl: Search for .c files where someone forgot to
+# put an include for <config.h> in.
+
+use diagnostics;
+use strict;
+
+use Getopt::Long;
+
+my $edit = 0;
+&GetOptions("edit" => \$edit);
+
+# default to all the files starting from the current directory
+my %skip_files;
+if (!@ARGV)
+ {
+ @ARGV = `find -name '*.c'`;
+ }
+
+# locate all of the target lines
+my @missing_files;
+FILE: foreach my $file (@ARGV)
+ {
+ chomp $file;
+ next if $skip_files{$file};
+ open FILE, $file or die "can't open $file";
+ while (<FILE>)
+ {
+ next FILE if /generated by/;
+ next FILE if /^\s*\#\s*include\s*[<\"]config\.h[>\"]/;
+ }
+ close FILE;
+ push @missing_files, $file;
+ }
+
+if (@missing_files)
+ {
+ print "\n", scalar(@missing_files), " C files don't have bug reports:\n\n";
+ if (!$edit)
+ {
+ print join("\n", @missing_files), "\n";
+ }
+ else
+ {
+ foreach my $file (@missing_files)
+ {
+ open OLD, $file or die "can't open $file";
+ open NEW, "> $file.new" or die "can't open $file.new";
+ while (<OLD>)
+ {
+ if (/^\s*\#\s*include\s/)
+ {
+ print NEW "$&<config.h>\n";
+ print NEW;
+ last;
+ }
+ print NEW;
+ }
+ print NEW <OLD>;
+ close NEW;
+ close OLD;
+ rename "$file.new", $file or die "can't rename $file";
+ print "edited $file\n";
+ }
+ }
+ }
+