1 /* $OpenBSD: lp.h,v 1.21 2016/02/29 17:26:01 jca 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 char *FF; /* form feed string */ 46 extern char *GF; /* name of graph(1G) filter (per job) */ 47 extern long HL; /* print header last */ 48 extern char *IF; /* name of input filter (created per job) */ 49 extern char *LF; /* log file for error messages */ 50 extern char *LO; /* lock file name */ 51 extern char *LP; /* line printer device name */ 52 extern long MC; /* maximum number of copies allowed */ 53 extern char *MS; /* stty flags to set if lp is a tty */ 54 extern long MX; /* maximum number of blocks to copy */ 55 extern char *NF; /* name of ditroff(1) filter (per job) */ 56 extern char *OF; /* name of output filter (created once) */ 57 extern long PL; /* page length */ 58 extern long PW; /* page width */ 59 extern long PX; /* page width in pixels */ 60 extern long PY; /* page length in pixels */ 61 extern char *RF; /* name of fortran text filter (per job) */ 62 extern char *RG; /* restricted group */ 63 extern char *RM; /* remote machine name */ 64 extern char *RP; /* remote printer name */ 65 extern long RS; /* restricted to those with local accounts */ 66 extern long RW; /* open LP for reading and writing */ 67 extern long SB; /* short banner instead of normal header */ 68 extern long SC; /* suppress multiple copies */ 69 extern char *SD; /* spool directory */ 70 extern long SF; /* suppress FF on each print job */ 71 extern long SH; /* suppress header page */ 72 extern char *ST; /* status file name */ 73 extern char *TF; /* name of troff(1) filter (per job) */ 74 extern char *TR; /* trailer string to be output when Q empties */ 75 extern char *VF; /* name of raster filter (per job) */ 76 77 extern char line[BUFSIZ]; 78 extern char *bp; /* pointer into printcap buffer */ 79 extern char *printer; /* printer name */ 80 /* host machine name */ 81 extern char host[HOST_NAME_MAX+1]; 82 extern char *from; /* client's machine name */ 83 extern int remote; /* true if sending files to a remote host */ 84 extern char *printcapdb[]; /* printcap database array */ 85 extern u_int wait_time; /* time to wait for remote responses */ 86 87 extern uid_t real_uid, effective_uid; 88 extern gid_t real_gid, effective_gid; 89 90 extern volatile sig_atomic_t gotintr; 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 /* 101 * Macros to raise/lower permissions. 102 */ 103 #define PRIV_START do { \ 104 int save_errno = errno; \ 105 (void)seteuid(effective_uid); \ 106 (void)setegid(effective_gid); \ 107 errno = save_errno; \ 108 } while (0) 109 110 #define PRIV_END do { \ 111 int save_errno = errno; \ 112 (void)setegid(real_gid); \ 113 (void)seteuid(real_uid); \ 114 errno = save_errno; \ 115 } while (0) 116 117 118 __BEGIN_DECLS 119 struct dirent; 120 121 /* common.c */ 122 char *checkremote(void); 123 int ckqueue(char *); 124 void fatal(const char *, ...) 125 __attribute__((__noreturn__,__format__(__printf__, 1, 2))); 126 int get_line(FILE *); 127 int getport(char *, int); 128 int getq(struct queue ***); 129 int safe_open(const char *, int, mode_t); 130 131 /* displayq.c */ 132 void displayq(int); 133 134 /* rmjob.c */ 135 void rmjob(void); 136 137 /* startdaemon.c */ 138 int startdaemon(char *); 139 140 __END_DECLS 141