Debian Codegraph @

doc/grep_sample_code

raw
1 #! /usr/bin/perl -w
2
3 # A simple, not very flexible bit of Perl to extract the sample code
4 # from the User Guide.
5
6 while(<>) {
7 last if /chapter id="programming"/;
8 }
9
10 while(<>) {
11 if (/<programlisting/) {
12 $C = 1;
13 next;
14 }
15 $C = 0 if /\/programlisting/;
16 last if /chapter id="acknowledgments"/;
17 next unless $C;
18
19 s/<!\[CDATA\[|\]\]\>//;
20
21 s/<lineannotation>.+$//;
22 s/<co id.+$//;
23
24 s/&lt;/</g;
25 s/&gt;/>/g;
26
27 print;
28 }
29
30 __DATA__
31 $Id: grep_sample_code,v 1.1 2007-12-10 05:13:11 jklowden Exp $
32