check-sources.pl revision 9c3531d72aeaad6c5f01efe6a1c82023e1379e4d
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# Copyright (C) 2000 Internet Software Consortium.
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# Permission to use, copy, modify, and distribute this software for any
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# purpose with or without fee is hereby granted, provided that the above
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# copyright notice and this permission notice appear in all copies.
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# $Id: check-sources.pl,v 1.4 2000/06/22 22:00:34 tale Exp $
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# Rudimentary, primarily for use by the developers.
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# This just evolved with no serious attempt at making it
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# bulletproof or foolproof. Or pretty even. Probably would
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# have done it differently if it were actually designed as opposed
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# to just growing as a multi-tentacled thing as various messages
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# were either added or selectively silenced.
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews if (-d $::a) {
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews if (-d $::b) {
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews return ($::a cmp $::b);
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews return (-1);
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews } elsif (-d $::b) {
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews return ($::a cmp $::b);
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews my $newdir = $predir ne "" ? "$predir/$dir" : $dir;
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews print "================> $newdir\n";
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews unless (chdir("$dir")) {
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews print "cd $newdir: $1\n";
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews print "opendir $predir/$dir: $!\n";
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews foreach my $entry (sort sortdir readdir(DIR)) {
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews next if $entry =~ /^\.\.?$/;
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews next if $entry !~ /\.o$/;
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews chdir("..") or
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews die "major malfunction: can't chdir to parent dir: $!\n";
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews print "================> $predir\n";
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews my ($config_h, $cpp_if, $prefix, $elided, $comment, $prefix_extend, $body);
343aeac7176d28c4a1b9d246b1f7311b4cd5da7dFrancis Dupont unless ($objfile =~ /\.o$/) {
343aeac7176d28c4a1b9d246b1f7311b4cd5da7dFrancis Dupont print "$0: skipping non-object file $objfile\n";
if (-f $savesource) {
unless (-f $file) {
close(SOURCE);
if (! $config_h) {
next if m%snprintf%m;
close(SOURCE);
if (! defined($cpp_if)) {
if $cpp_if;
compile($) {
unless ($obj =~ /\.o$/) {
close(COMPILE);
unlink($obj);
main() {
print <<EOF;
main();