archer-master -> gdb-master
[nethome.git] / bin / kernel / diffkernel
1 #! /usr/bin/perl
2 #
3 # $Id$
4 #
5 # Similiar to the diff(1) command.
6 # This one automatically ignores any autogenerated files.
7
8
9 use strict;
10 use warnings;
11 use File::Basename;     # &dirname
12 require "".dirname($0)."/My-KernelIgnoreList.pm";
13
14 # Do not use the shell here as it tries to expand the argument wildcards.
15 local *DIFF;
16 # Prevent: Name ... used only once: possible typo
17 1 if @My::KernelIgnoreList::list;
18 open DIFF,"-|","diff","-ru",
19                                 map(("-x",$_),@My::KernelIgnoreList::list),
20                                 @ARGV
21                 or die "Cannot open the 'diff' output: $!";
22 while (<DIFF>) {
23         next if /^Binary files /;
24         next if /^Only in /;
25         print;
26         }
27 # It is valid for diff(1) to return its exit code 1.
28 if (close DIFF && $?!=256) {
29         die "Cannot close the 'diff' output (status=$?): $!";
30         }