summaryrefslogtreecommitdiffstats
path: root/utils/trimmodmap
blob: 0d87114c89204605bcbfc0978e3fb38894c77311 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/perl

open (F, $ARGV[0]);
@ents = (<F>);
close (F);

shift @ARGV;

foreach $n (@ARGV) {
    $n =~ s/\.ko$//;
    $mods{"$n"} = $n;
}


while (<STDIN>) {
    chop;
    $line = $_;
    s/0x0000/0x/g;
    @a = split;
    if ($mods{$a[0]}) {
	if ($a[1] ne "0xffffffff" && $a[2] ne "0xffffffff") {
	    if ($a[3] eq "0xffffffff" && $a[4] eq "0xffffffff") {
	        @res = grep (/^$a[1]\t$a[2]\t"$a[0]"/, @ents);
		if (length(@res) != 0 && ! $res[0]) {
		    print $line."\n";
		}
	    } else {
	        @res = grep (/^$a[1]\t$a[2]\t"$a[0]"/, @ents);
		if ($res[0]) {
		    @b = split "\t",$res[0];
		    if ($b[2] ne "\"$a[0]\"") {
			print $line."\n";
		    }
		} else {
	            @res = grep (/^$a[1]\t$a[2]\t$a[3]\t$a[4]\t"$a[0]"/, @ents);
		    if (!$res[0]) {
			print $line."\n";
		    }
		}
	    }
	}
    }
}