enscript ... MORE on it ...

Ben Duncan bns
Fri Nov 11 10:56:54 PST 2005


Ok, as part of MY SLAG project, I have been trying to decode several
FOSS projects and use parts of them. Since I have my WAY of wanting
to view and read C programs, they way others write makes it often
times difficult to follow.

So given the "enscript" thread, I came up with this little gem.


-------------------------------------------------------------


#!/bin/sh
# Script to beautify and print out a C Program
#
# Written by Ben Duncan 11/11/2005 and released under the GPL
#
# Note: My Default settings in $HOME/.indent.pro is set to this:
# -bad -bl -bls -bs -cs -hnl -l72 -lp -ncdw -nce -npsl -nut -pcs -pi2 -prs -st
#
# If you wish this as a STANDARD setting for this script, copy the above lines
# onto the "indent" command line below ..


if [ "$1" = "" ]
then
    echo "Please enter the name of the C program .."
    read C_PROG
else
    C_PROG=$1
fi

export C_PROG

if [ ! -f $C_PROG ]
then
    echo "Program is NOT found .. aborting ..."
    exit 1
fi

rm /tmp/${C_PROG} 1>/dev/null 2>&1

indent $C_PROG > /tmp/${C_PROG}
enscript --header='$(C_PROG)|%W|Page $% of $=' --pretty-print=c /tmp/${C_PROG}

rm /tmp/${C_PROG} 1>/dev/null 2>&1

exit 0

---------------------------------------------------------------------------

Hope this helps someone ...


Jorge Almeida wrote:
> 	On Thu, 10 Nov 2005, Collins Richey wrote:

-- 
Ben Duncan   - VersAccounting Software LLC 336 Elton Road  Jackson MS, 39212
"Never attribute to malice, that which can be adequately explained by stupidity"
        - Hanlon's Razor



More information about the Linux-users mailing list