--- a/src/c2html.c Tue Apr 21 09:53:01 2015 +0200 +++ b/src/c2html.c Tue Apr 21 10:11:37 2015 +0200 @@ -168,10 +168,16 @@ // write line number if (showln) { WRITECONST(stream, out, "<span class=\"c2html-lineno\">"); - char lnbuf[16]; - int len = snprintf(lnbuf, 16, "%*d ", lnw, i+1); + char lnbuf[128]; + int len; + // line number link + len = snprintf(lnbuf, 128, "<a name=\"l%d\" href=\"#l%d\">", + i+1, i+1); out(lnbuf, 1, len, stream); - WRITECONST(stream, out, "</span> "); + // justified line number + len = snprintf(lnbuf, 128, "%*d ", lnw, i+1); + out(lnbuf, 1, len, stream); + WRITECONST(stream, out, "</a></span> "); } // write formated (or plain) code line