1#!/bin/sh
2
3# print the sum of SLOC for a subset of a package.
4# The subset is specified using a regular expression.
5
6# To use, "cd" into the package data directory (with the "_outfile.dat" files),
7# then specify as the first parameter the pattern defining the subset.
8
9# E.G.:
10# cd ../data/linux
11# print_sum_subset 'BUILD\/linux\/drivers\/'
12#
13#  will show the SLOC total for the "drivers" directory & subdirs
14#  of the "linux" data subdirectory.
15
16# This is part of SLOCCount, a toolsuite that counts
17# source lines of code (SLOC).
18# Copyright (C) 2001-2004 David A. Wheeler.
19#
20# This program is free software; you can redistribute it and/or modify
21# it under the terms of the GNU General Public License as published by
22# the Free Software Foundation; either version 2 of the License, or
23# (at your option) any later version.
24#
25# This program is distributed in the hope that it will be useful,
26# but WITHOUT ANY WARRANTY; without even the implied warranty of
27# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28# GNU General Public License for more details.
29#
30# You should have received a copy of the GNU General Public License
31# along with this program; if not, write to the Free Software
32# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
33#
34# To contact David A. Wheeler, see his website at:
35#  http://www.dwheeler.com.
36#
37#
38
39echo -n "$1 "
40grep -h "$1" *_outfile.dat | grep '^[1-9][0-9]* [^ ]' | print_sum
41
42