1 /* $OpenBSD: lp.h,v 1.14 2003/06/02 23:36:53 millert Exp $ */ 2 /* $NetBSD: lp.h,v 1.14 2000/04/16 14:43:58 mrg Exp $ */ 3 4 /* 5 * Copyright (c) 1983, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. Neither the name of the University nor the names of its contributors 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * @(#)lp.h 8.2 (Berkeley) 4/28/95 33 */ 34 35 36 /* 37 * Global definitions for the line printer system. 38 */ 39 40 extern char *AF; /* accounting file */ 41 extern long BR; /* baud rate if lp is a tty */ 42 extern char *CF; /* name of cifplot filter (per job) */ 43 extern char *DF; /* name of tex filter (per job) */ 44 extern long DU; /* daemon user-id */ 45 extern long FC; /* flags to clear if lp is a tty */ 46 extern char *FF; /* form feed string */ 47 extern long FS; /* flags to set if lp is a tty */ 48 extern char *GF; /* name of graph(1G) filter (per job) */ 49 extern long HL; /* print header last */ 50 extern char *IF; /* name of input filter (created per job) */ 51 extern char *LF; /* log file for error messages */ 52 extern char *LO; /* lock file name */ 53 extern char *LP; /* line printer device name */ 54 extern long MC; /* maximum number of copies allowed */ 55 extern char *MS; /* stty flags to set if lp is a tty */ 56 extern long MX; /* maximum number of blocks to copy */ 57 extern char *NF; /* name of ditroff(1) filter (per job) */ 58 extern char *OF; /* name of output filter (created once) */ 59 extern long PL; /* page length */ 60 extern long PW; /* page width */ 61 extern long PX; /* page width in pixels */ 62 extern long PY; /* page length in pixels */ 63 extern char *RF; /* name of fortran text filter (per job) */ 64 extern char *RG; /* restricted group */ 65 extern char *RM; /* remote machine name */ 66 extern char *RP; /* remote printer name */ 67 extern long RS; /* restricted to those with local accounts */ 68 extern long RW; /* open LP for reading and writing */ 69 extern long SB; /* short banner instead of normal header */ 70 extern long SC; /* suppress multiple copies */ 71 extern char *SD; /* spool directory */ 72 extern long SF; /* suppress FF on each print job */ 73 extern long SH; /* suppress header page */ 74 extern char *ST; /* status file name */ 75 extern char *TF; /* name of troff(1) filter (per job) */ 76 extern char *TR; /* trailer string to be output when Q empties */ 77 extern char *VF; /* name of raster filter (per job) */ 78 extern long XC; /* flags to clear for local mode */ 79 extern long XS; /* flags to set for local mode */ 80 81 extern char line[BUFSIZ]; 82 extern char *bp; /* pointer into printcap buffer */ 83 extern char *printer; /* printer name */ 84 /* host machine name */ 85 extern char host[MAXHOSTNAMELEN]; 86 extern char *from; /* client's machine name */ 87 extern int remote; /* true if sending files to a remote host */ 88 extern char *printcapdb[]; /* printcap database array */ 89 extern u_int wait_time; /* time to wait for remote responses */ 90 91 extern uid_t real_uid, effective_uid; 92 extern gid_t real_gid, effective_gid; 93 94 extern volatile sig_atomic_t gotintr; 95 96 /* 97 * Structure used for building a sorted list of control files. 98 */ 99 struct queue { 100 time_t q_time; /* modification time */ 101 char q_name[MAXNAMLEN+1]; /* control file name */ 102 }; 103 104 /* 105 * Macros to raise/lower permissions. 106 */ 107 #define PRIV_START do { \ 108 int save_errno = errno; \ 109 (void)seteuid(effective_uid); \ 110 (void)setegid(effective_gid); \ 111 errno = save_errno; \ 112 } while (0) 113 114 #define PRIV_END do { \ 115 int save_errno = errno; \ 116 (void)setegid(real_gid); \ 117 (void)seteuid(real_uid); \ 118 errno = save_errno; \ 119 } while (0) 120 121 #include <sys/cdefs.h> 122 123 __BEGIN_DECLS 124 struct dirent; 125 126 void blankfill(int); 127 char *checkremote(void); 128 int chk(char *); 129 void displayq(int); 130 void dump(char *, char *, int); 131 __dead void fatal(const char *, ...) 132 __attribute__((__format__(__printf__, 1, 2))); 133 int getline(FILE *); 134 int getport(char *, int); 135 int getq(struct queue ***); 136 void header(void); 137 int inlist(char *, char *); 138 int iscf(struct dirent *); 139 int isowner(char *, char *); 140 void ldump(char *, char *, int); 141 void prank(int); 142 void process(char *); 143 void rmjob(void); 144 void rmremote(void); 145 void show(char *, char *, int); 146 int startdaemon(char *); 147 void nodaemon(void); 148 void delay(int); 149 int safe_open(const char *, int, mode_t); 150 __END_DECLS 151