Eneboo - Documentación para desarrolladores
src/posprinter/lpr/common_source/lp.h
Ir a la documentación de este archivo.
00001 /*      $OpenBSD: lp.h,v 1.14 2003/06/02 23:36:53 millert Exp $ */
00002 /*      $NetBSD: lp.h,v 1.14 2000/04/16 14:43:58 mrg Exp $      */
00003 
00004 /*
00005  * Copyright (c) 1983, 1993
00006  *      The Regents of the University of California.  All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 3. Neither the name of the University nor the names of its contributors
00017  *    may be used to endorse or promote products derived from this software
00018  *    without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00021  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00022  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00023  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00024  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00025  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00026  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00027  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00028  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00029  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00030  * SUCH DAMAGE.
00031  *
00032  *      @(#)lp.h        8.2 (Berkeley) 4/28/95
00033  */
00034 
00035 #include <dirent.h>
00036 #include <sys/param.h>
00037 #include <signal.h>
00038 #include <grp.h>
00039 
00040 /*
00041  * Global definitions for the line printer system.
00042  */
00043 
00044 extern char     *AF;            /* accounting file */
00045 extern long      BR;            /* baud rate if lp is a tty */
00046 extern char     *CF;            /* name of cifplot filter (per job) */
00047 extern char     *DF;            /* name of tex filter (per job) */
00048 extern long      DU;            /* daemon user-id */
00049 extern long      FC;            /* flags to clear if lp is a tty */
00050 extern char     *FF;            /* form feed string */
00051 extern long      FS;            /* flags to set if lp is a tty */
00052 extern char     *GF;            /* name of graph(1G) filter (per job) */
00053 extern long      HL;            /* print header last */
00054 extern char     *IF;            /* name of input filter (created per job) */
00055 extern char     *LF;            /* log file for error messages */
00056 extern char     *LO;            /* lock file name */
00057 extern char     *LP;            /* line printer device name */
00058 extern long      MC;            /* maximum number of copies allowed */
00059 extern char     *MS;            /* stty flags to set if lp is a tty */
00060 extern long      MX;            /* maximum number of blocks to copy */
00061 extern char     *NF;            /* name of ditroff(1) filter (per job) */
00062 extern char     *OF;            /* name of output filter (created once) */
00063 extern long      PL;            /* page length */
00064 extern long      PW;            /* page width */
00065 extern long      PX;            /* page width in pixels */
00066 extern long      PY;            /* page length in pixels */
00067 extern char     *RF;            /* name of fortran text filter (per job) */
00068 extern char     *RG;            /* restricted group */
00069 extern char     *RM;            /* remote machine name */
00070 extern char     *RP;            /* remote printer name */
00071 extern long      RS;            /* restricted to those with local accounts */
00072 extern long      RW;            /* open LP for reading and writing */
00073 extern long      SB;            /* short banner instead of normal header */
00074 extern long      SC;            /* suppress multiple copies */
00075 extern char     *SD;            /* spool directory */
00076 extern long      SF;            /* suppress FF on each print job */
00077 extern long      SH;            /* suppress header page */
00078 extern char     *ST;            /* status file name */
00079 extern char     *TF;            /* name of troff(1) filter (per job) */
00080 extern char     *TR;            /* trailer string to be output when Q empties */
00081 extern char     *VF;            /* name of raster filter (per job) */
00082 extern long      XC;            /* flags to clear for local mode */
00083 extern long      XS;            /* flags to set for local mode */
00084 
00085 extern char     line[BUFSIZ];
00086 extern char     *bp;            /* pointer into printcap buffer */
00087 extern char     *printer;       /* printer name */
00088                                 /* host machine name */
00089 extern char     host[MAXHOSTNAMELEN];
00090 extern char     *from;          /* client's machine name */
00091 extern int      remote;         /* true if sending files to a remote host */
00092 extern char     *printcapdb[];  /* printcap database array */
00093 extern u_int    wait_time;      /* time to wait for remote responses */
00094 
00095 extern uid_t    real_uid, effective_uid;
00096 extern gid_t    real_gid, effective_gid;
00097 
00098 extern volatile sig_atomic_t    gotintr;
00099 
00100 /*
00101  * Structure used for building a sorted list of control files.
00102  */
00103 struct queue {
00104         time_t  q_time;                 /* modification time */
00105         char    q_name[MAXNAMLEN+1];    /* control file name */
00106 };
00107 
00108 /*
00109  * Macros to raise/lower permissions.
00110  */
00111 #define PRIV_START do {                         \
00112         int save_errno = errno;                 \
00113         (void)seteuid(effective_uid);           \
00114         (void)setegid(effective_gid);           \
00115         errno = save_errno;                     \
00116 } while (0)
00117 
00118 #define PRIV_END do {                           \
00119         int save_errno = errno;                 \
00120         (void)setegid(real_gid);                \
00121         (void)seteuid(real_uid);                \
00122         errno = save_errno;                     \
00123 } while (0)
00124 
00125 #include <sys/cdefs.h>
00126 
00127 __BEGIN_DECLS
00128 struct dirent;
00129 
00130 void     blankfill(int);
00131 char    *checkremote(void);
00132 int      chk(char *);
00133 void     displayq(int);
00134 void     dump(char *, char *, int);
00135 void fatal(const char *, ...)
00136         __attribute__((__format__(__printf__, 1, 2)));
00137 int      getcfline(FILE *);
00138 int      getport(char *, int);
00139 int      getq(struct queue ***);
00140 void     header(void);
00141 int      inlist(char *, char *);
00142 int      iscf(const struct dirent *);
00143 int      isowner(char *, char *);
00144 void     ldump(char *, char *, int);
00145 void     prank(int);
00146 void     process(char *);
00147 void     rmjob(void);
00148 void     rmremote(void);
00149 void     show(char *, char *, int);
00150 int      startdaemon(char *);
00151 void     nodaemon(void);
00152 void     delay(int);
00153 int      safe_open(const char *, int, mode_t);
00154 
00155 char    *cgetcap (char *, const char *, int);
00156 int      cgetent (char **, char **, const char *);
00157 int      cgetmatch (char *, const char *);
00158 int      cgetnext (char **, char **);
00159 int      cgetstr (char *, const char *, char **);
00160 int      cgetunum (char *, const char *, long *);
00161 int     cgetnum(char *, const char *, long *);
00162 
00163 size_t  strlcpy(char *dst, const char *src, size_t siz);
00164 size_t  strlcat(char *dst, const char *src, size_t siz);
00165 
00166 int     cgetclose();
00167 int     lprGetUID(void);
00168 
00169 __END_DECLS
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'