2000-10-12 00:23:46 +04:00
|
|
|
/* $NetBSD: lp.h,v 1.15 2000/10/11 20:23:52 is Exp $ */
|
1995-11-28 22:43:04 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
1994-05-18 05:25:21 +04:00
|
|
|
* Copyright (c) 1983, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
1993-03-21 12:45:37 +03:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1997-10-05 15:52:17 +04:00
|
|
|
* @(#)lp.h 8.2 (Berkeley) 4/28/95
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
|
|
|
|
1994-05-18 05:25:21 +04:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
|
|
|
* Global definitions for the line printer system.
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern char *AF; /* accounting file */
|
1994-05-18 05:25:21 +04:00
|
|
|
extern long BR; /* baud rate if lp is a tty */
|
|
|
|
extern char *CF; /* name of cifplot filter (per job) */
|
|
|
|
extern char *DF; /* name of tex filter (per job) */
|
1997-07-10 10:18:52 +04:00
|
|
|
extern long DU; /* daemon user-id */
|
1994-05-18 05:25:21 +04:00
|
|
|
extern long FC; /* flags to clear if lp is a tty */
|
|
|
|
extern char *FF; /* form feed string */
|
|
|
|
extern long FS; /* flags to set if lp is a tty */
|
|
|
|
extern char *GF; /* name of graph(1G) filter (per job) */
|
|
|
|
extern long HL; /* print header last */
|
|
|
|
extern char *IF; /* name of input filter (created per job) */
|
1993-03-21 12:45:37 +03:00
|
|
|
extern char *LF; /* log file for error messages */
|
1994-05-18 05:25:21 +04:00
|
|
|
extern char *LO; /* lock file name */
|
|
|
|
extern char *LP; /* line printer device name */
|
|
|
|
extern long MC; /* maximum number of copies allowed */
|
1995-10-03 18:02:17 +03:00
|
|
|
extern char *MS; /* stty flags to set if lp is a tty */
|
1997-07-10 10:18:52 +04:00
|
|
|
extern long MX; /* maximum number of blocks to copy */
|
1994-05-18 05:25:21 +04:00
|
|
|
extern char *NF; /* name of ditroff(1) filter (per job) */
|
1993-03-21 12:45:37 +03:00
|
|
|
extern char *OF; /* name of output filter (created once) */
|
1994-05-18 05:25:21 +04:00
|
|
|
extern long PL; /* page length */
|
|
|
|
extern long PW; /* page width */
|
|
|
|
extern long PX; /* page width in pixels */
|
|
|
|
extern long PY; /* page length in pixels */
|
1993-03-21 12:45:37 +03:00
|
|
|
extern char *RF; /* name of fortran text filter (per job) */
|
1994-05-18 05:25:21 +04:00
|
|
|
extern char *RG; /* restricted group */
|
|
|
|
extern char *RM; /* remote machine name */
|
|
|
|
extern char *RP; /* remote printer name */
|
|
|
|
extern long RS; /* restricted to those with local accounts */
|
|
|
|
extern long RW; /* open LP for reading and writing */
|
|
|
|
extern long SB; /* short banner instead of normal header */
|
|
|
|
extern long SC; /* suppress multiple copies */
|
|
|
|
extern char *SD; /* spool directory */
|
|
|
|
extern long SF; /* suppress FF on each print job */
|
|
|
|
extern long SH; /* suppress header page */
|
|
|
|
extern char *ST; /* status file name */
|
1993-03-21 12:45:37 +03:00
|
|
|
extern char *TF; /* name of troff(1) filter (per job) */
|
|
|
|
extern char *TR; /* trailer string to be output when Q empties */
|
1994-05-18 05:25:21 +04:00
|
|
|
extern char *VF; /* name of raster filter (per job) */
|
|
|
|
extern long XC; /* flags to clear for local mode */
|
|
|
|
extern long XS; /* flags to set for local mode */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
extern char line[BUFSIZ];
|
1994-05-18 05:25:21 +04:00
|
|
|
extern char *bp; /* pointer into printcap buffer */
|
1993-03-21 12:45:37 +03:00
|
|
|
extern char *name; /* program name */
|
|
|
|
extern char *printer; /* printer name */
|
1994-05-18 05:25:21 +04:00
|
|
|
/* host machine name */
|
1998-07-07 07:36:53 +04:00
|
|
|
extern char host[MAXHOSTNAMELEN + 1];
|
1993-03-21 12:45:37 +03:00
|
|
|
extern char *from; /* client's machine name */
|
1997-10-05 15:52:17 +04:00
|
|
|
extern int remote; /* true if sending files to a remote host */
|
1994-05-18 05:25:21 +04:00
|
|
|
extern char *printcapdb[]; /* printcap database array */
|
- add timeouts to displayq(), rmremote(), sendfile() and response(),
and use these timeout in the lpq, lpd and lprm programs.
these stop hung remote printers that accept tcp connections but do
not process jobs from hanging the whole system and letting the sysadmin
have a clue about what is going on with this rogue printer.
- add a -r flag to lpd to allow `of' filters for remote jobs.
i know there are ways around this, but i just don't care.
- add a -f flag to lpf to add missing carriage returns.
useful when printing UNIX files to an, eg, LaserWriter that wants CR's
as well as LF's in raw text. stair-stepped text is no fun.
- implement child process accounting: we just have a limit on the number
of children we can have (settable by the sysadmin), and we sleep when
this number is reached. this can reduce malicious not-so-malicious
attacks on the print server by a rogue remote client..
- use setproctitle() where appropriate so the sysadmin has a clue about
what each of the lpd's here are doing.
this was useful to help diagnose a problem (that the above child process
accounting change reduces the lossages of) where a rogue client was
attempting "lpq" operations on one stuck queue in rapid succession,
causing the lpd server to be extremely slow, due to the large number
of lpd processes running.
i have been running these changes in production for about a year.
1999-12-07 17:54:44 +03:00
|
|
|
extern int wait_time; /* time to wait for remote responses */
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
|
|
|
* Structure used for building a sorted list of control files.
|
|
|
|
*/
|
|
|
|
struct queue {
|
|
|
|
time_t q_time; /* modification time */
|
|
|
|
char q_name[MAXNAMLEN+1]; /* control file name */
|
|
|
|
};
|
|
|
|
|
1994-05-18 05:25:21 +04:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
struct dirent;
|
|
|
|
|
|
|
|
void blankfill __P((int));
|
|
|
|
char *checkremote __P((void));
|
|
|
|
int chk __P((char *));
|
|
|
|
void displayq __P((int));
|
|
|
|
void dump __P((char *, char *, int));
|
2000-10-12 00:23:46 +04:00
|
|
|
void fatal __P((const char *, ...))
|
|
|
|
__attribute__((__format__(__printf__, 1, 2)));
|
1994-05-18 05:25:21 +04:00
|
|
|
int getline __P((FILE *));
|
1997-10-05 15:52:17 +04:00
|
|
|
int getport __P((char *, int));
|
1994-05-18 05:25:21 +04:00
|
|
|
int getq __P((struct queue *(*[])));
|
|
|
|
void header __P((void));
|
|
|
|
void inform __P((char *));
|
|
|
|
int inlist __P((char *, char *));
|
2000-04-16 18:43:56 +04:00
|
|
|
int iscf __P((const struct dirent *));
|
1994-05-18 05:25:21 +04:00
|
|
|
int isowner __P((char *, char *));
|
|
|
|
void ldump __P((char *, char *, int));
|
|
|
|
int lockchk __P((char *));
|
|
|
|
void prank __P((int));
|
|
|
|
void process __P((char *));
|
|
|
|
void rmjob __P((void));
|
|
|
|
void rmremote __P((void));
|
|
|
|
void show __P((char *, char *, int));
|
|
|
|
int startdaemon __P((char *));
|
1997-10-05 19:11:58 +04:00
|
|
|
void nodaemon __P((void));
|
1997-10-05 15:52:17 +04:00
|
|
|
void delay __P((int));
|
1994-05-18 05:25:21 +04:00
|
|
|
__END_DECLS
|