Re: [dev] semicolons

From: Patrick Haller <201009-suckless_AT_haller.ws>
Date: Fri, 18 Nov 2011 21:03:23 +0800

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
Received on Fri Nov 18 2011 - 14:03:23 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 18 2011 - 14:12:03 CET