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 are permitted
6  * provided that the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  *	@(#)lp.h	5.4 (Berkeley) 08/22/89
18  */
19 
20 /*
21  * Global definitions for the line printer system.
22  */
23 
24 #include <stdio.h>
25 #include <sys/param.h>
26 #include <sys/file.h>
27 #include <sys/dir.h>
28 #include <sys/stat.h>
29 #include <sys/socket.h>
30 #include <sys/un.h>
31 #include <netinet/in.h>
32 #include <netdb.h>
33 #include <pwd.h>
34 #include <syslog.h>
35 #include <signal.h>
36 #include <sys/wait.h>
37 #include <sgtty.h>
38 #include <ctype.h>
39 #include <errno.h>
40 #include "lp.local.h"
41 
42 extern int	DU;		/* daeomon user-id */
43 extern int	MX;		/* maximum number of blocks to copy */
44 extern int	MC;		/* maximum number of copies allowed */
45 extern char	*LP;		/* line printer device name */
46 extern char	*RM;		/* remote machine name */
47 extern char	*RG;		/* restricted group */
48 extern char	*RP;		/* remote printer name */
49 extern char	*LO;		/* lock file name */
50 extern char	*ST;		/* status file name */
51 extern char	*SD;		/* spool directory */
52 extern char	*AF;		/* accounting file */
53 extern char	*LF;		/* log file for error messages */
54 extern char	*OF;		/* name of output filter (created once) */
55 extern char	*IF;		/* name of input filter (created per job) */
56 extern char	*RF;		/* name of fortran text filter (per job) */
57 extern char	*TF;		/* name of troff(1) filter (per job) */
58 extern char	*NF;		/* name of ditroff(1) filter (per job) */
59 extern char	*DF;		/* name of tex filter (per job) */
60 extern char	*GF;		/* name of graph(1G) filter (per job) */
61 extern char	*VF;		/* name of raster filter (per job) */
62 extern char	*CF;		/* name of cifplot filter (per job) */
63 extern char	*FF;		/* form feed string */
64 extern char	*TR;		/* trailer string to be output when Q empties */
65 extern short	SC;		/* suppress multiple copies */
66 extern short	SF;		/* suppress FF on each print job */
67 extern short	SH;		/* suppress header page */
68 extern short	SB;		/* short banner instead of normal header */
69 extern short	HL;		/* print header last */
70 extern short	RW;		/* open LP for reading and writing */
71 extern short	PW;		/* page width */
72 extern short	PX;		/* page width in pixels */
73 extern short	PY;		/* page length in pixels */
74 extern short	PL;		/* page length */
75 extern short	BR;		/* baud rate if lp is a tty */
76 extern int	FC;		/* flags to clear if lp is a tty */
77 extern int	FS;		/* flags to set if lp is a tty */
78 extern int	XC;		/* flags to clear for local mode */
79 extern int	XS;		/* flags to set for local mode */
80 extern short	RS;		/* restricted to those with local accounts */
81 
82 extern char	line[BUFSIZ];
83 extern char	pbuf[];		/* buffer for printcap entry */
84 extern char	*bp;		/* pointer into ebuf for pgetent() */
85 extern char	*name;		/* program name */
86 extern char	*printer;	/* printer name */
87 extern char	host[32];	/* host machine name */
88 extern char	*from;		/* client's machine name */
89 extern int	sendtorem;	/* are we sending to a remote? */
90 extern int	errno;
91 
92 /*
93  * Structure used for building a sorted list of control files.
94  */
95 struct queue {
96 	time_t	q_time;			/* modification time */
97 	char	q_name[MAXNAMLEN+1];	/* control file name */
98 };
99 
100 char	*pgetstr();
101 char	*malloc();
102 char	*getenv();
103 char	*index();
104 char	*rindex();
105 char	*checkremote();
106