aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-12 09:12:38 +0100
committerMax Kellermann <max@duempel.org>2009-11-12 09:17:03 +0100
commit5b82ffc291c6b56ce85c139d48f4587d33b1f42c (patch)
tree922232b6c03a6fc57be8cc12bc6b34b17296c3bd /scripts
parent8068fd5228472387cc83b49ed4e9710f8452b865 (diff)
downloadmpd-5b82ffc291c6b56ce85c139d48f4587d33b1f42c.tar.gz
mpd-5b82ffc291c6b56ce85c139d48f4587d33b1f42c.tar.xz
mpd-5b82ffc291c6b56ce85c139d48f4587d33b1f42c.zip
include config.h in all sources
After we've been hit by Large File Support problems several times in the past week (which only occur on 32 bit platforms, which I don't have), this is yet another attempt to fix the issue.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/check_config_h.rb47
1 files changed, 47 insertions, 0 deletions
diff --git a/scripts/check_config_h.rb b/scripts/check_config_h.rb
new file mode 100755
index 000000000..2619984e4
--- /dev/null
+++ b/scripts/check_config_h.rb
@@ -0,0 +1,47 @@
+#!/usr/bin/env ruby
+#
+# This script verifies that every source includes config.h first.
+# This is very important for consistent Large File Support.
+#
+
+def check_file(file)
+ first = true
+ file.each_line do |line|
+ if line =~ /^\#include\s+(\S+)/ then
+ if $1 == '"config.h"'
+ unless first
+ puts "#{file.path}: config.h included too late"
+ end
+ else
+ if first
+ puts "#{file.path}: config.h missing"
+ end
+ end
+ first = false
+ end
+ end
+end
+
+def check_path(path)
+ File.open(path) do |file|
+ check_file(file)
+ end
+end
+
+if ARGV.empty?
+ Dir["src/*.c"].each do |path|
+ check_path(path)
+ end
+
+ Dir["src/*/*.c"].each do |path|
+ check_path(path)
+ end
+
+ Dir["test/*.c"].each do |path|
+ check_path(path)
+ end
+else
+ ARGV.each do |path|
+ check_path(path)
+ end
+end