Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Aug 2000 15:38:02 +1000
From:      Harry Woodward-Clarke <Harry.Woodward-Clarke@S1.com>
To:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   printing C source files
Message-ID:  <39A0C03A.31B82F7@S1.com>

next in thread | raw e-mail | index | archive | help
Hullo,

I struck an interesting "problem" the other day printing a 'C' source
file, where the first two characters start a comment, viz. "/*".

I have, in my /etc/printcap the following...

lp:\
        :rm=172.16.48.9:\
        :rp=:\
        :if=/usr/local/libexec/lpfilter:\
        :sd=/var/spool/output:\
        :lf=/var/log/lpd-errs:\
        :mx#0:\
        :sh:

which is pretty much out of the Complete FreeBSD and the Handbook. The
'lpfilter' file is:

#!/bin/sh
# PostScript & ASCII text filter
#
read first_line
first_two_chars=`expr "$first_line" : '\(..\)'`

if [ "$first_two_chars" = "%!" ]; then
#
# PostScript
#
        echo "$first_line" && cat && printf "\004" && exit 0
        exit 2
else
#
# ASCII text
#
        printf "\033&k2G" && echo $first_line && \
                cat && printf "\033&10H" && exit 0
fi
exit 2
[end of file]

Now, (some of you are already ahead of me), when I print my source code,
the first line consists of ...
"/COPYRIGHT /bin /boot /cdrom /compat /dev /dist /etc <and so forth>"

i.e. a listing of the contents of "/", or rather "/*".

Other than starting my C-code with a space or two, are there any
suggestions? ;') It's not a real 'biggie', just piqued my curiosity ;')

Thanks,

haxxa


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?39A0C03A.31B82F7>