Mercurial > hg > kdocs
view make/do-rfc.sh @ 81:6adf16f10d54
Split up make.sh so it's easier to call subsets of its functionality.
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 23 Oct 2007 18:35:49 -0500 |
parents | make/findrfc.sh@fa8bf02e7cfa |
children |
line wrap: on
line source
#!/bin/bash if [ -z "$LNXDIR" ] then echo set LNXDIR exit 1 fi # Blank our temp file > temp-linuxrfc.txt function findrfc() { x=0 # Iterate through *.c and *.h in the Linux source code. for i in `find "$LNXDIR"/hg -name "*.[hc]"` do # Progress indicator x=$[$x+1] if [ $x -gt 250 ] then echo -n . >&2 x=0 fi # Find each mention of an RFC, filtering out the more obvious false # positives. for j in `grep -io "rfc *[1-9][0-9]*" $i | grep -v " " | grep -v "@rfc822\.org" | sed -r 's/[Rr][Ff][Cc] *([0-9]*)/rfc\1/g'` do echo $i:$j done done } # Find the RFC comments, with progress indicator. echo -n Finding RFC comments >&2 findrfc > temp-linuxrfc.txt # Process the temporary directory into an html file. echo Converting to html... >&2 echo "<html><head><title>RFCs used by the Linux kernel</title></head>" echo "<ul>" for i in $(sed 's/.*://' temp-linuxrfc.txt | sort -u | sort -t c -k 2,2 -n) do echo '<li><h2><a href="http://tools.ietf.org/html/'$i'">'$i'</a></h2><p>' for j in $(sed -rn 's@\'"$LNXDIR"/hg'(.*):'$i'$@\1@p' temp-linuxrfc.txt) do echo '<a href="http://kernel.org/hg/linux-2.6/file/tip/'$j'">'$j'</a>' done echo "</p></li>" done echo "</ul></html>" # Remove the temporary file rm temp-linuxrfc.txt