Questo è uno script della shell Korn per verificare il programma abbellitore. Richiede il pacchetto "pdksh*.rpm" dal cdrom 'contrib' di Linux. Salvate questo file come un file di 'testo' e modificate i permessi con chmod a+rx. Potete anche riscrivere questo script in PERL così da poterlo usare su Windows 95/NT o MSDOS. Togliete il commento alla variabile PRGM se usate il bcpp, cb o indent
#!/bin/ksh # Programma per verificare l'abbellitore C++ 'bcpp', 'indent' o 'cb' ############################################################ # Copyright # The copyright policy is GNU/GPL. # Author: Al Dev (Alavoor Vasudevan) alavoor@yahoo.com ############################################################ check_beautify_now() { # Rimozione di tutti i file temporanei \rm -f ${TMP_FILE} \rm -f ${TMP_CPPFILE}*.* FNAME=$1 if [ ! -f ${FNAME} ]; then print "\nErrore: Il file ${FNAME} non esiste!!. Termino ora...." exit fi \cp -f ${FNAME} ${TMP_CPPFILE}.cpp ${COMPILER} -c ${TMP_CPPFILE}.cpp if [ ! -f ${TMP_CPPFILE}.o ]; then print "Errore fatale: fallita la compilazione di ${FNAME}. Termino ora... " exit fi \mv -f ${TMP_CPPFILE}.o ${TMP_CPPFILE}_orig.o aa=`basename $PRGM` print "\nSto lavorando, verifico $aa in ${FNAME}" ${PRGM} ${TMP_CPPFILE}.cpp ${COMPILER} -c ${TMP_CPPFILE}.cpp \rm -f $TMP_FILE diff ${TMP_CPPFILE}.o ${TMP_CPPFILE}_orig.o 1> $TMP_FILE 2>> $TMP_FILE result="" result=`wc -c $TMP_FILE | awk '{print $1}' ` if [ "$result" = "0" ]; then print "Successo!! L'abbellitore $aa sta lavorando correttamente!!\n" else print "Errore fatale: Qualcosa è andato storto!! L'abbellitore non sta lavorando!!" exit fi # ${COMPILER} -S ${TMP_CPPFILE}.cpp # diff ${TMP_CPPFILE}.s ${TMP_CPPFILE}_orig.s # Rimozione di tutti i file temporanei \rm -f ${TMP_FILE} \rm -f ${TMP_CPPFILE}*.* } ########## Il programma principale inizia qui ##################3 #PRGM=/usr/bin/bcpp #PRGM=/usr/bin/cb PRGM=/usr/bin/indent COMPILER=/usr/bin/g++ TMP_FILE=beautify.tmp TMP_CPPFILE=beautify-tmp_cppfile print -n "Inserisci il nome del file C++ <predefinito è *.cpp> : " read ans if [ "$ans" = "" -o "$ans" = " " ]; then ans="ALL" else FILENAME=$ans fi # Rimozione di tutti i file temporanei \rm -f ${TMP_FILE} \rm -f ${TMP_CPPFILE}*.* if [ "$ans" != "ALL" ]; then check_beautify_now ${FILENAME} else ls *.cpp | while read FILENAME do check_beautify_now ${FILENAME} done fi