3 ## This will work in the majority of shells out there...
5 ## This will parse a directory named on the command line and produce a
6 ## cut and paste report for c++ files in that directory (or 'c', if you
7 ## set the environment variable LANGUAGE to 'c').
9 ## Note that other rules are only for Java code not C source.
11 ## If you run into java.lang.OutOfMemoryError, try setting the environment
12 ## variable HEAPSIZE to e.g. 512m
17 echo " $script <directory>"
23 for name
in /usr
/share
/java
/pmd
/*.jar
; do
27 HEAPSIZE
=${HEAPSIZE:-512m}
28 LANGUAGE
=${LANGUAGE:-cpp}
29 MINIMUM_TOKENS
=${MINIMUM_TOKENS:-100}
32 [1-9]*[mgMG
]) HEAPSIZE
=-Xmx$HEAPSIZE ;;
34 *) echo "HEAPSIZE '$HEAPSIZE' unknown (try: 512m)"
39 c|cpp|fortran|java|jsp|php|ruby
) ;;
40 *) echo "Language '$LANGUAGE' unknown (try: c, cpp, fortran, java, jsp, php, ruby)"
44 $JAVA_HOME/bin
/java
$HEAPSIZE -cp $CP net.sourceforge.pmd.cpd.CPD
--minimum-tokens $MINIMUM_TOKENS --files $DIRECTORY --language $LANGUAGE