1 /* 2 * Copyright (c) 1983 Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. All advertising materials mentioning features or use of this software 14 * must display the following acknowledgement: 15 * This product includes software developed by the University of 16 * California, Berkeley and its contributors. 17 * 4. Neither the name of the University nor the names of its contributors 18 * may be used to endorse or promote products derived from this software 19 * without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * from: @(#)lp.h 5.5 (Berkeley) 6/1/90 34 * $Id: lp.h,v 1.2 1993/08/01 17:59:09 mycroft Exp $ 35 */ 36 37 /* 38 * Global definitions for the line printer system. 39 */ 40 41 #include <stdio.h> 42 #include <sys/param.h> 43 #include <sys/file.h> 44 #include <sys/dir.h> 45 #include <sys/stat.h> 46 #include <sys/socket.h> 47 #include <sys/un.h> 48 #include <netinet/in.h> 49 #include <netdb.h> 50 #include <pwd.h> 51 #include <syslog.h> 52 #include <signal.h> 53 #include <sys/wait.h> 54 #include <sgtty.h> 55 #include <ctype.h> 56 #include <errno.h> 57 #include "lp.local.h" 58 59 extern int DU; /* daeomon user-id */ 60 extern int MX; /* maximum number of blocks to copy */ 61 extern int MC; /* maximum number of copies allowed */ 62 extern char *LP; /* line printer device name */ 63 extern char *RM; /* remote machine name */ 64 extern char *RG; /* restricted group */ 65 extern char *RP; /* remote printer name */ 66 extern char *LO; /* lock file name */ 67 extern char *ST; /* status file name */ 68 extern char *SD; /* spool directory */ 69 extern char *AF; /* accounting file */ 70 extern char *LF; /* log file for error messages */ 71 extern char *OF; /* name of output filter (created once) */ 72 extern char *IF; /* name of input filter (created per job) */ 73 extern char *RF; /* name of fortran text filter (per job) */ 74 extern char *TF; /* name of troff(1) filter (per job) */ 75 extern char *NF; /* name of ditroff(1) filter (per job) */ 76 extern char *DF; /* name of tex filter (per job) */ 77 extern char *GF; /* name of graph(1G) filter (per job) */ 78 extern char *VF; /* name of raster filter (per job) */ 79 extern char *CF; /* name of cifplot filter (per job) */ 80 extern char *FF; /* form feed string */ 81 extern char *TR; /* trailer string to be output when Q empties */ 82 extern short SC; /* suppress multiple copies */ 83 extern short SF; /* suppress FF on each print job */ 84 extern short SH; /* suppress header page */ 85 extern short SB; /* short banner instead of normal header */ 86 extern short HL; /* print header last */ 87 extern short RW; /* open LP for reading and writing */ 88 extern short PW; /* page width */ 89 extern short PX; /* page width in pixels */ 90 extern short PY; /* page length in pixels */ 91 extern short PL; /* page length */ 92 extern short BR; /* baud rate if lp is a tty */ 93 extern int FC; /* flags to clear if lp is a tty */ 94 extern int FS; /* flags to set if lp is a tty */ 95 extern int XC; /* flags to clear for local mode */ 96 extern int XS; /* flags to set for local mode */ 97 extern short RS; /* restricted to those with local accounts */ 98 99 extern char line[BUFSIZ]; 100 extern char pbuf[]; /* buffer for printcap entry */ 101 extern char *bp; /* pointer into ebuf for pgetent() */ 102 extern char *name; /* program name */ 103 extern char *printer; /* printer name */ 104 extern char host[32]; /* host machine name */ 105 extern char *from; /* client's machine name */ 106 extern int sendtorem; /* are we sending to a remote? */ 107 extern int errno; 108 109 /* 110 * Structure used for building a sorted list of control files. 111 */ 112 struct queue { 113 time_t q_time; /* modification time */ 114 char q_name[MAXNAMLEN+1]; /* control file name */ 115 }; 116 117 char *pgetstr(); 118 char *malloc(); 119 char *getenv(); 120 char *index(); 121 char *rindex(); 122 char *checkremote(); 123