#!/bin/bash
cd $MSSCFHOME
let TotalLines=0
let TotalFiles=0
for adir in *-2-10 
do
	if [ "${adir}" != "net-sourceforge-MSSCodeFactory-CFLib-2-10" ]; then
		pushd $adir/cplus
		let CPlusFiles=0
		let CPlusLines=0
		for subdir in *
		do
			if [ -d ${subdir} ]; then
				if [ "${subdir}" != "installer" ]; then
					if [ "${subdir}" != "RemoteSystemsTempFiles" ]; then
						if [ "${subdir}" != "bin" ]; then
							if [ "${subdir}" != "sources" ]; then
								if [[ ${subdir} != *"loader"* ]]; then
									for afile in ${subdir}/*/*.cpp ${subdir}/*/*/*.hpp
									do
										SubLines=`wc -l $afile | cut -d " " -f 1`
										let TotalLines=TotalLines+SubLines
										let TotalFiles=TotalFiles+1
										let CPlusLines=CPlusLines+SubLines
										let CPlusFiles=CPlusFiles+1
									done
								else
									for afile in ${subdir}/*/*.cpp ${subdir}/*/*.hpp
									do
										SubLines=`wc -l $afile | cut -d " " -f 1`
										let TotalLines=TotalLines+SubLines
										let TotalFiles=TotalFiles+1
										let CPlusLines=CPlusLines+SubLines
										let CPlusFiles=CPlusFiles+1
									done
								fi
							fi
						fi
					fi
				fi
			fi
		done
		popd
		echo "$adir CPlus files $CPlusFiles lines $CPlusLines"
	fi
done
echo "TOTAL files $TotalFiles lines $TotalLines"
cd $MSSCFHOME
