source: MondoRescue/trunk/tools/quality@ 119

Last change on this file since 119 was 119, checked in by bcornec, 18 years ago

quality tool added

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1#!/bin/bash
2#
3# $Id$
4#
5# Mesures quality improvement of mondorescue project
6#
7
8# Adapt to your needs
9dname=`dirname $0`
10prem=`echo $dname |cut -c1`
11if [ ${prem} == "/" ]; then
12 export TOOLHOME=$dname
13else
14 export TOOLHOME=${PWD}/$dname
15fi
16
17d=$TOOLHOME/..
18
19if [ $# -gt 0 ]; then
20 if [ -d $1 ]; then
21 d=$1
22 fi
23fi
24
25echo "Working on $d"
26echo " "
27cd $d
28
29# How many sprintf/strcat/strcpy vs asprintf are they
30echo "monodrescue uses : `find . -name '*.c' -o -name '*.h' | egrep -v '\.svn' | egrep -v '/\*' | xargs grep -r asprintf | wc -l` asprintf"
31echo "monodrescue uses : `find . -name '*.c' -o -name '*.h' | egrep -v '\.svn' | egrep -v '/\*' | xargs grep -r sprintf | grep -v asprintf | wc -l` sprintf"
32echo "monodrescue uses : `find . -name '*.c' -o -name '*.h' | egrep -v '\.svn' | egrep -v '/\*' | xargs grep -r strcat | wc -l` strcat"
33echo "monodrescue uses : `find . -name '*.c' -o -name '*.h' | egrep -v '\.svn' | egrep -v '/\*' | xargs grep -r strcpy | wc -l` strcpy"
34echo "monodrescue uses : `find . -name '*.c' -o -name '*.h' | egrep -v '\.svn' | egrep -v '/\*' | xargs grep -r malloc_string | wc -l` malloc_string"
35echo "monodrescue uses : `find . -name '*.c' -o -name '*.h' | egrep -v '\.svn' | egrep -v '/\*' | xargs grep -r MAX_STR_LEN | wc -l` MAX_STR_LEN"
36
37echo " "
38echo "Qualimetry: "
39find . -name '*.c' -o -name '*.h' | egrep -v '\.svn' | xargs grep -r asprintf | egrep -v '/\*' | egrep -v 'asprintf\(&' > /tmp/mondo.quality
40cat /tmp/mondo.quality
41echo "monodrescue uses : `cat /tmp/mondo.quality | wc -l` asprintf without &"
42find . -name '*.c' -o -name '*.h' | egrep -v '\.svn' | xargs grep -r getline | egrep -v '/\*' | egrep -v 'getline\(&' > /tmp/mondo.quality
43cat /tmp/mondo.quality
44echo "monodrescue uses : `cat /tmp/mondo.quality | wc -l` getline without &"
45
46echo " "
47echo "Splint: "
48find . -name '*.c' -o -name '*.h' | xargs splint +posixlib -Dlinux
49
50rm -f /tmp/mondo.quality
Note: See TracBrowser for help on using the repository browser.