On 2011-11-18 11:40, pancake wrote: > > $ cat dwm.c | sed -e 's,;,ROFL\n,g' |grep ROFL |wc -l
use cpp to deal with the includes, defines, comments. __sloc() { grep -v '^#include.*<' "$1" | cpp - | grep -v '^#' | grep -v '^$' } sloc() { __sloc "$1" | wc -l __sloc "$1" | sed -e 's,;,ROFL\n,g' |grep ROFL |wc -l __sloc "$1" | sed -e 's,(,ROFL\n,g' |grep ROFL |wc -l } worrying about stuff like the next seems tree/forest-y if (error) return printf("boot->head => missed?"), -1; btw, anyone recommend a suckless AST tool for C? Patrick