DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Collective Pretty Printing C/C++

01.17.2007
| 3731 views |
  • submit to reddit
        Pretty Print all C/C++ and headers into ONE file each.

#!/bin/sh -

echo 'Pretty Print Script v0.2 by s tayefeh (2004)'
echo 'collects all .C .cc .cpp and .h from a ./.'
echo 'and create a PRETTY_C.ps file with the C-sources'
echo 'and a PRETTY_h.ps file with the header-sources'

ls -lq *.C *.cc *.cpp \
        | awk '{printf "%s ", $8}' \
        > clist.temp

ls -lq *.h \
        | awk '{printf "%s ", $8}' \
        > hlist.temp

a2ps --prologue=color -Ec++ -o PRETTY_C.ps \
`cat clist.temp` $1 $2 $3 $4

a2ps --prologue=color -Ec++ -o PRETTY_h.ps \
`cat hlist.temp` $1 $2 $3 $4

rm hlist.temp clist.temp