#!/bin/sh
#
# $Revision: 1.4 $ $Date: 2012-07-26 17:11:47-04 $
# $Source: /home/vogelke/bin/RCS/codewords,v $
# $Host: sys7.com $
# $UUID: db283f24-aae7-331a-bc15-e55b2b865ebb $
#
#<codewords: finds number of "words" in a C code file.
# Taken from Bernstein paper on secure coding.
# Expects *.[ch] files on command line.

cat $* | cpp -fpreprocessed \
  | sed 's/[_a-zA-Z0-9][_a-zA-Z0-9]*/x/g' \
  | tr -d ' \012' | wc -c

exit 0
