linux/scripts/checkincludes.pl
<<
2 2 o/spa> ospa> class="lxr_search"> 2="+search" method="post" onsubmit="return do_search(this);"> 2 3ehidden" nam>3enavtarget" 22>3e"> 2 3etext" nam>3esearch" id3esearch"> 2 3esubmit">Search ospa> class="lxr_prefs" 2 o/spa> 2 < ="ajax+*" method="post" onsubmit="return false;"> oinput typ>3ehidden" nam>3eajax_lookup" id3eajax_lookup" 22>3e"> 2 <
odiv id3efile_contents"
3eL1">< <1o/a>#!/usr/bin/perl
3eL2">< <2o/a>#
3eL3">< <3o/a># checkincludes: find/remove files included more tha> once
3eL4">< <4o/a>#
3eL5">< <5o/a># Copyright abandoned, 2000, Niels Kristia> Bech Jensen <nkbj@image.dk>.
3eL6">< <6o/a># Copyright 2009 Luis R. Rodriguez <mcgrof@gmail.com>
3eL7">< <7o/a>#
3eL8">< <8o/a># This script checks for duplicate includes. It also has support
3eL9">< <9o/a># to remove them in place. Note that this will not take into
3eL10">< ptioa># consideraion2	macros so you should run this only if you know
3eL11">< 11o/a># you do have real dups and do not have them under #ifdef's. You
3eL12">< 12ioa># could also just review the results.
3eL13">< 13o/a>
3eL14">< 14o/a>use strict;
3eL15">< 15o/a>
3eL16">< ripts/checkincludes.pl#L14" id3eL143.180.0/option>
1 u=pl# {eL16" class="line" nam>3eL16">< ripts
3eL16">< ri [-r]\n"3eL15" class="line" nam>3eL15">< 15o/a This sc1ript checks for duplica1te in18 id3        pr id "By es.a" i wecheckiwax_lof href="scrs\n"3eL15" class="line" nam>3eL15">< 15o/a to remo1ve them in place. Note 1that 19 id3        pr id "T not takehref="scrdipts/checo
3eL15">< 15o/2># consi2eraion2	macros so you s2ould 20 id3        exit 13eL15" class="line" nam>3eL15">< 15o/2># you d2 have real dups and do 2ot ha2e the}eL15" class="line" nam>3eL15">< 15o/2
3eL16">< ript2>
3eL15">< 15o/2>use str2ct;
3eL16">< ript2>
3eL16">< ript2/checkin2ludes.pl#L14" id3eL143.280.0/26 id3        u=pl#iv
eL16" class="line" nam>3eL16">< ript2
3eL15">< 15o/2 This sc2ript checks for duplica2te in28 id3eL16" class="line" nam>3eL16">< ript2 to remo2ve them in place. Note 2that 29 id3pl#($#ARGVchd3e= 1) {eL16" class="line" nam>3eL16">< ript3># consi3eraion2	macros so you s3ould 30 id3        pl#($ARGV[0] =~ /^-/) {eL16" class="line" nam>3eL16">< ript3># you d3 have real dups and do 3ot ha31 id3                pl#($ARGV[0] eq "-r") {eL16" class="line" nam>3eL16">< ript3
3eL15">< 15o/3 checkinccludes: find/remove filepl#L133 id3                        shifd3eL15" class="line" nam>3eL15">< 15o/3>use str3ct;
3eL16">< ript3>
3eL16">< ript3/checkin3ludes.pl#L14" id3eL143.380.0/36 id3                }eL16" class="line" nam>3eL16">< ript3
3eL16">< ript3 This sc3ript checks for duplica3te in38 the}eL15" class="line" nam>3eL15">< 15o/3 to remo3ve them in place. Note 3that 39 id3eL16" class="line" nam>3eL16">< ript4># consi4eraion2	macros so you s4ould 40 id3
3eL16">< ript4># you d4 have real dups and do 4ot ha41 id3        open(my $p, pl#L1heckpl#L1, $pts/)eL16" class="line" nam>3eL16">< ript4
3eL15">< 15o/4 checkin4cludes: find/remove fil4pl#L14" id3eL14" class="line" nam>3eL14">< 14o/4
3eL16">< ript4>
3eL16">< ript4/checkin4ludes.pl#L14" id3eL143.480.0/46 id3eL14" class="line" nam>3eL14">< 14o/4
3eL16">< ript4 This sc4ript checks for duplica4te in48 id3                pl#(m/^\s*#\s*3eL16">\s*[heckpquot;](\S*)[searcquot;]/o) {eL16" class="line" nam>3eL16">< ript4 to remo4ve them in place. Note 4that 49 id3                        ++$eckinclupts/c{$1}
eL16" class="line" nam>3eL16">< ript5># consi5eraion2	macros so you s5ould 50 id3                }eL16" class="line" nam>3eL16">< ript5># you d5 have real dups and do 5ot ha51 id3                push(@1c546checc, $_v
eL16" class="line" nam>3eL16">< ript5
3eL16">< ript5 checkin5cludes: find/remove fil5pl#L15" id3eL14" class="line" nam>3eL14">< 14o/5
3eL16">< ript5 Copyrighht abandoned, 2000, Nielpl#L15" id3eL16" class="line" nam>3eL16">< ript5/checkin5ludes.pl#L14" id3eL143.580.0/56 id3        pl#(!$ot tak) {eL16" class="line" nam>3eL16">< ript5
3eL16">< ript5 This sc5ript checks for duplica5te in58 id3                        pl#($eckinclupts/c{$pts/nclu}chd3e 1) {eL16" class="line" nam>3eL16">< ript5 to remo5ve them in place. Note 5that 59 id3                                pr id "$pts/: $pts/nclu icheckincludes.pl#L4" id3e.\n"3eL15" class="line" nam>3eL15">< 15o/6># consi6eraion2	macros so you s6ould 60 id3                        }eL16" class="line" nam>3eL16">< ript6># you d6 have real dups and do 6ot ha61 id3                }eL16" class="line" nam>3eL16">< ript6
3eL15">< 15o/6 checkin6cludes: find/remove fil6pl#L163 id3        }eL16" class="line" nam>3eL16">< ript6
3eL16">< ript6 Copyrig6ht abandoned, 2000, Nie6pl#L165 id3        open($p, pl#L1hgckpl#L1, $pts/)eL16" class="line" nam>3eL16">< ript6 Copyrighht 2009 Luis R. Rodrigue80.0/66 id3            3eL15">< 15o/6
3eL16">< ript6 This sc6ript checks for duplica6te in68 id3        my $s. Yo= 03eL15" class="line" nam>3eL15">< 15o/6 to remo6ve them in place. Note 6that 69 id3        
3eL16">< ript7># consi7eraion2	macros so you s7ould 70 id3                pl#(m/^\s*#\s*3eL16">\s*[heckpquot;](\S*)[searcquot;]/o) {eL16" class="line" nam>3eL16">< ript7># you d7 have real dups and do 7ot ha71 id3                        
3eL16">< ript7
3eL16">< ript7 checkin7cludes: find/remove fil7pl#L173 id3                                        pl#($eckinclupts/c{$pts/nclu}chd3e 1) {eL16" class="line" nam>3eL16">< ript7
3eL7">< <7o/a>#
 Copyrig7ht abandoned, 2000, Nie7pl#L175 id3                                                $s. Y++eL7" class="line" nam>3eL7">< <7o/a>#
 Copyrig7ht 2009 Luis R. Rodrigu780.0/76 id3                                        } gt;# {eL16" class="line" nam>3eL16">< ript7
3eL7">< <7o/a>#
 This sc7ript checks for duplica7te in78 id3                                        }L7" class="line" nam>3eL7">< <7o/a>#
 to remo7ve them in place. Note 7that 79 id3                                }L7" class="line" nam>3eL7">< <7o/a>#8># consi8eraion2	macros so you s8ould 80 id3                        }eL16" class="line" nam>3eL16">< ript8># you d8 have real dups and do 8ot ha81 id3                } gt;# {eL16" class="line" nam>3eL16">< ript8
3eL7">< <7o/a>#8 checkin8cludes: find/remove fil8pl#L18ript8># you2h".js                 1s>3e      pl#($ARGV[0] =~ /^-/) {eL16" classl_q This sc7ript checks for duplica7te inion2	macros so yl_q This sc7ript check1 cl              }e	  25>
  v3.180ept check1 cl              }e	  25>
  v3.        1s>3e  3< r8>#
 Copy8ig7ht 2009 Luis R. Rodr8gu78080/76 id3                pr id "$pts(!$ot d my $s.3eL15">< 18pt7
3eL16">< r8a># This  script checks for duplica7te8in78 id3        close($fv
eL16" class="line" nam>3eL16">< r8>#
 to r8mo7ve them in place. No8e 7th89n38 the}eL15" class="line" nam>3eL15">< 19>#8># co9si8eraion2	macros so yo9 s8ou9d 80 
The   iginal LXR softwadesbyudes.e}eL15" chttp://source   ge.net/projec"lilxr">LXR community 80 ,checkiexperimental versf yobyue}eL15" cdes.to:lxr@	  2 .no">lxr@	  2 .no 80 .
e_contets"

lxr.	  2 .no namdly hos="scbyue}eL15" chttp://www.redpill-	  pro.no">Redpill L  pro AS 80 ,cprovonlyax_lL  2 this ulting. You   y if ys services sam>e 1995.
e_content/bodytet/htmlsu