gcov2html.sh - randomcrap - random crap programs of varying quality
 (HTM) git clone git://git.codemadness.org/randomcrap
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       gcov2html.sh (696B)
       ---
            1 #!/bin/sh
            2 # highlight/color covered source-codes lines from gcov to HTML.
            3 #
            4 # for gcov with gcc use:
            5 # make CC=gcc CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS="-fprofile-arcs"
            6 
            7 awk '
            8 function encode(s) {
            9         gsub("&", "\\&", s);
           10         gsub("<", "\\&lt;", s);
           11         gsub(">", "\\&gt;", s);
           12         gsub("'"'"'", "\\&#39;", s);
           13         gsub("\"", "\\&quot;", s);
           14         return s;
           15 }
           16 BEGIN {
           17         print "<style type=\"text/css\">.n { background-color: #ff7777; }</style>";
           18         print "<pre>";
           19 }
           20 /^        -:/ {
           21         print "<span class=\"a\">" encode($0) "</span>";
           22         next;
           23 }
           24 /^    #####:/ {
           25         print "<span class=\"n\">" encode($0) "</span>";
           26         next;
           27 }
           28 {
           29         print "<span class=\"e\">" encode($0) "</span>";
           30         next;
           31 }
           32 END {
           33         print "</pre>";
           34 }
           35 '