cb@cci632.UUCP (Just another hired gun (n2hkd)) (05/06/89)
I have written a program for the PC which is like the un*x cpr program. It has some nice features for printing C and ASM files. I has the hooks for other type of files too. If you'd be interested in checking it out, send me email and I will mail you a copy of the executable. It also comes with a configuration file so that you can change the screen colors, the printer attributes and the reserved word list, etc. Below is a man page: CCPR(1) REFERENCE MANUAL (21 April, 1989) CCPR(1) NAME ccpr - Print formatted output SYNOPSIS ccpr [ -{a c d e f n m[] p[] q t u v x[] z} ] [ -{A B D C E F I L M[] Q R S T[] X] #} ] [ -i file.cfg ] [ -o outputfile ] [filename list] DESCRIPTION Ccpr is used to format documents to be printed or displayed. It defaults to using stdin and stdout, and therefore can be used in a pipe stream. If it finds a configuration file, that configuration is loaded, then the command options are checked. If an option is off then it is turned on. If an option is on (from the configuration file) then the option can be turned off on the command line. Command line options also have options, sub options. (Ie: -nn ) If only the command line option is set (IE: -n ) then the default version is invoked. If sub option to the option is specified then that sub option is invoked. If a sub option is not available then the default option is invoked. If an option is set in the configuration file, it can be overriden by the command line option in some cases, or superseded in some others. If an (Ie: -e) option is set in the configuration file, then the same command line option (Ie: -e) will turn it off). However, if there is a comflict, many sub options have off option (Ie: -ex). Command line options: -# This option causes the page counter to be reset starting with each file. The default is to number all pages printed consecutively. -a invoke automatic indent options for screen list and piping (Ie.): ccpr -a file | ccpr -P ... -A invoke automatic indent options for printing. same as -a but requires printer option (Ie): ccpr -A -pp file -B Change font to BOLD -c Use ansi color attributes for screen. -C Use Compressed pitch, Epson(R) line size = 136. -C -E Use Compressed pitch, Epson(R) line size = 160. -d do not output body of text. This is useful for creating just a table of contents and/or a reference listing, with the files themselves. -D Change font to DOUBLE STRIKE -e Use enhanced text features, allows bold and Italic printing. -E Use Elite pitch, Epson(R) line size = 95. -f Use form feed (^L) instead of line feeds. -F Send a form feed (^L) at start and end of job. -h display an option list. -H[x] suppress the printing of the header and/or footer. Default: suppress Header and footer x = a delete header and footer x = f delete footer only x = h delete header only x = F suppress Footer only x = H suppress Header only x = x restore printing of header and footer If using -Ha option and print mode is turned on (ie -P or -p) then 3 lines are inserted in between pages. For -H -HF -HF the printing is suppressed but the header and/or footer space is preserved. Example: to indent a file 8 spaces before printing, use a script like this: cpr -iNULL -M0 -m8 -ha filename | cpr -pp -i use the next agruement for the configuration file. -i NULL sets all options to their default state, and overides the default configuration file. If it is the first command line option then all susequent options are turned on. -I Change font to ITALIC -L Ledger output, this enables a string of characters to preform a top of form command and comment area expansion. For .c files: /**/ does not get printed but does TOF /** expands to end of line using * **/ expands to end of line using * /*** expands to end of line and does TOF -m[x] add margin space of x characters after the number region. The margin space is calculated by adding, the -M value + 6 + the -m value = margin space. If the -n option is off then, the -M value + the -m value = margin space. -M[x] add margin space of x characters before the number region. The margin space is calculated by adding, the -M value + 6 + the -m value = margin space. If the -n option is off then, the -M value + the -m value = margin space. -n[x] number lines in each file. Default: number lines in each file starting at 1 x = n number lines continously across files x = x do not print line numbers The margin space is calculated by adding, the -M value + 6 + the -m value = margin space. If the -n option is off then, the -M value + the -m value = margin space. -N This option allows a filename to be printed when using standard IO. Default: print "stdio" or -N filename. -o direct output to a specified file. -p[x] Use printer attributes and send to printer. Default: standard output x = p send to LPT1 x = c send to COM1 -P Use printer attributes, create a cppr.### file and exec the DOS background print function. The program automatically creates a file for the print command with the next available number. It uses the environment variable CCPRTMP to place the output file. Unfortunately it is not a true spooler and the files are not deleted automatically after printing. -q Quick print, invokes option -P -N and prints each file but prints the table of contents at the end. -Q Change font to QUALITY (near letter quality mode). -R reset printer before printing, NOTE: does NOT send a form feed first! (add -F). -r reset printer after printing, but send a form feed first to align paper. -s[x] Sort filenames and procedures for table of contents, -t option is required. Default: sort all filenames and procedures x = a sort filenames by arguement Ie: sort *.c then *.h files x = f sort only filenames, not procedures x = p sort only procedures, not filenames x = s sort filenames (by arguement) and procedures -S Use Pica pitch (Default), Epson(R) line size = 80. -t provide a table of contents. This is further determined by the file extension. The following file extensions use it: .asm use Asembler code method .bas use Basic code method .c use C code method .cc use C code method .eng use Document method .for use Fortran code method .i use C code method .inc use Assembler code method .h use C code method .mac use Assembler code method .man use Document method .mke use Makefile method .pas use Pascal code method .rc use C code method .spc use Document method -T[x] change tab expansion from default (8) to x. -u If the unix '-' is used instead of '/' for options. This is mainly for inclusion in the ccpr.cfg file. -v Verbose mode, used for print program state information. -V Print version number of software and exits. -x[x] provide a cross reference index listing, file: ccpr.ref. Default: do not print xref table x = p print cross reference table -X Use Expanded pitch, Epson(R) line size = 40. -z Do not print revision level in headers or contents table. -+[x] print only pages starting with page x. --[x] print only pages up to and including page x. FILES ccpr.tmp - temporary storage file Set Environment variable CCPRTMP for path: Ie: set CCPRTMP=h: Default path = . ccpr.### - file (by number) to be used by the DOS print command SET Environment variable CCPRTMP for path: Ie: set CCPRTMP=d: Default path = . ccpr.cfg - configuration file, tries to find it in current path first then checks Environment variable CCPR for path: Ie: set CCPR=g:\ Default path = . ccpr.ref - label reference file SEE ALSO BUGS * Some printers can only have 3 pitch settings. * Printer commands are not automatically cancelled. * If there isn't enough disk space when using -P option then only last part of the created file exists to be printed. * Pascal files have not been tested. * Serial Printer mode has not been tested. * Using expanded mode printing the table of contents does not work properly, maybe when I get time. * The -i option must be used to change the reserved word list I may have each type of file have it's own in the future. DIAGNOSTICS -v verbose mode. -V print version number. -? print option list. COMPATIBILITY CHANGES FUTURE DIRECTIONS * Will add an option for two sided copying. Print all odds sequentially first, then all evens, after paper is reloaded. * Add interactive menu for option selection from keyboard or mouse. * Add option to force a file type (Ie. -lc for *.c files). * Add kill options to stop printing. ACKNOWLEDGEMENTS AUTHOR Curtis J. Braun , Computronics PO Box 1002, Fairport NY 14450