// @(#)print.hh 1.3 93/08/01 // // Contains definitions for class "Print". // // Copyright (c) Steve Holden and Rich Burridge. // All rights reserved. // // Permission is given to distribute these sources, as long as the // copyright messages are not removed, and no monies are exchanged. // // No responsibility is taken for any errors or inaccuracies inherent // either to the comments or the code of this program, but if // reported to me then an attempt will be made to fix them. #define EQUALN(a, b) (*a == *b && !strncmp(a, b, strlen(b))) #define FPRINTF (void) fprintf #define FPUTS(s) (void) fputs((s), ofp) #define LINELENGTH 80 // Number of characters per line. #define MAXTTYPES 4 // Maximum number of text types. #define PAGELENGTH 60 // Number of lines per page. #define PRINTPROG "/usr/spool/lp" // BSD or System V system? typedef enum { IS_COL, IS_FILE, IS_LINE, IS_PAGE } action_type ; typedef enum { A4, US } paper_type ; typedef enum { T_BOLD, T_MIXED, T_PLAIN, T_ROMAN } text_type ; class Print { public: char curfname[MAXPATHLEN] ; // Current file being printed. char *message_for ; // "[Mail,News,Listing] for " line. char *printer_name ; // Printer name (if any) for output. int colct ; // Column count on current page. int linect ; // Line count on current page. int pageno ; // Page number within message. int tpn ; // Total number of pages printed. paper_type paper_size ; // Paper size - default US. FILE *ofp ; // Output file pointer (stdout or print cmd). Print () ; void end (action_type) ; FILE *makecmd (char *) ; void print_extra (void) ; void show_prologue (char *) ; void show_text (text_type, char *, char *) ; void show_trailer (void) ; void start (action_type) ; private: void do_date (void) ; void expand (unsigned char *) ; void psdef (char *, char *) ; void set_defs (void) ; void useline (void) ; } ;