ÀÌ °ÍÀº ¾Æ¸§´ä°Ô ÇÏ´Â ÇÁ·Î±×·¥À» °ËÁõÇϱâ À§ÇÑ ÄܼР½ºÅ©¸³Æ®ÀÌ´Ù. ¸®´ª½º 'contrib' ½Ãµð·Ò¿¡ ÀÖ´Â "pdksh*.rpm" ÀÌ ÇÊ¿äÇÏ´Ù. ÀÌ ÆÄÀÏÀ» 'ÅØ½ºÆ®' ÆÄÀϰú a+rx·Î ÀúÀåÇØ¶ó. ´ç½ÅÀº ÆÞ·Î ÀÌ ¼Ð ½ºÅ©¸³Æ®¸¦ ´Ù½Ã ¾µ ¼ö ÀÖ¾î¼ ´ç½ÅÀº Windows 95/NT ȤÀº MSDOS ¿¡¼ ±×°ÍÀ» ¾µ ¼ö ÀÖ´Ù. bcpp, cb ȤÀº indent¸¦ À§ÇÑ Æ÷ÀÎÆ® PRGM º¯¼ö¸¦ ¼³¸íÇØ¶ó.
#!/bin/ksh
# Verification program to check C++ Beautifiers 'bcpp', 'indent' or cb
############################################################
# Copyright
# The copyright policy is GNU/GPL.
# Author: Al Dev (Alavoor Vasudevan) alavoor@yahoo.com
############################################################
check_beautify_now()
{
# Remove all the temp files....
\rm -f ${TMP_FILE}
\rm -f ${TMP_CPPFILE}*.*
FNAME=$1
if [ ! -f ${FNAME} ]; then
print "\nError: The file ${FNAME} does not exist!!. Aborting now ...."
exit
fi
\cp -f ${FNAME} ${TMP_CPPFILE}.cpp
${COMPILER} -c ${TMP_CPPFILE}.cpp
if [ ! -f ${TMP_CPPFILE}.o ]; then
print "Fatal Error: Failed to compile ${FNAME}. Aborting now... "
exit
fi
\mv -f ${TMP_CPPFILE}.o ${TMP_CPPFILE}_orig.o
aa=`basename $PRGM`
print "\nRunning, verifying $aa on ${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 "Success!! Beautifier $aa is working properly!!\n"
else
print "Fatal Error: Something wrong!! Beautifier is not working!!"
exit
fi
# ${COMPILER} -S ${TMP_CPPFILE}.cpp
# diff ${TMP_CPPFILE}.s ${TMP_CPPFILE}_orig.s
# Remove all the temp files....
\rm -f ${TMP_FILE}
\rm -f ${TMP_CPPFILE}*.*
}
########## Main of program begins here ##################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 "Enter the C++ file name <default is *.cpp> : "
read ans
if [ "$ans" = "" -o "$ans" = " " ]; then
ans="ALL"
else
FILENAME=$ans
fi
# Remove all the temp files....
\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