view make/findrfc.sh @ 80:fa8bf02e7cfa

Script to search Linux kernel for mentions of ietf RFC documents and make a page linking to the files and the appropriate RFC.
author Rob Landley <rob@landley.net>
date Tue, 23 Oct 2007 04:33:46 -0500
parents
children
line wrap: on
line source

#!/bin/bash

export LINUXDIR=~/linux/hg/

#> temp-linuxrfc.txt

function findrfc()
{
  x=0
  for i in `find "$LINUXDIR" -name "*.[hc]"`
  do
    x=$[$x+1]
    if [ $x -gt 250 ]
    then
      echo -n . >&2
      x=0
    fi
    for j in `grep -io "rfc *[1-9][0-9]*" $i | grep -v "  " | sed -r 's/[Rr][Ff][Cc] *([0-9]*)/rfc\1/g'`
    do
      echo $i:$j
    done
  done
}

echo -n Finding RFC comments >&2
#findrfc > temp-linuxrfc.txt

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@\'"$LINUXDIR"'(.*):'$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>"

#rm temp-linuxrfc.txt