xref: /titanic_50/usr/src/cmd/lp/lib/lp/llib-llp (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/* LINTLIBRARY */
23/* PROTOLIB1 */
24
25/*
26 * Copyright (c) 1998 by Sun Microsystems, Inc.
27 * All rights reserved.
28 */
29
30/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
31/*	  All Rights Reserved  	*/
32
33#pragma ident	"%Z%%M%	%I%	%E% SMI"
34
35#include "errno.h"
36#include "fcntl.h"
37#include "sys/types.h"
38#include "sys/stat.h"
39#include "stdio.h"
40#include "dirent.h"
41
42typedef struct SCALED {
43	float	val;	/* value of number, scaled according to "sc" */
44	char	sc;	/* 'i' inches, 'c' centimeters, ' ' lines/cols */
45}			SCALED;
46
47typedef struct FALERT {
48	char *	shcmd;	/* shell command used to perform the alert */
49	int	Q;	/* # requests queued to activate alert */
50	int	W;	/* alert is sent every "W" minutes */
51} FALERT;
52
53extern int	errno;
54extern char *	sys_errlist[];
55extern int	sys_nerr;
56
57extern int	open_locked(char *, char *, mode_t);
58extern char	*fdgets(char *, int, int);
59extern int	fdprintf(int, char *, ...);
60extern int	fdputs(char *, int);
61extern int	fdputc(char, int);
62
63
64FILE		*open_lpfile ( char * , char * , mode_t );
65int		close_lpfile ( FILE * );
66int		chown_lppath ( char * path );
67int		mkdir_lpdir ( char * path , int mode );
68int		rmfile ( char * path );
69int		dumpstring ( char * path , char * str );
70
71char *		loadstring ( char * path );
72char *		loadline ( char * path );
73char *		sop_up_rest (int, char * endsop );
74
75int		addlist ( char *** , char * );
76int		addstring ( char ** , char * );
77int		appendlist ( char *** , char * );
78int		dellist ( char *** , char * );
79int		joinlist ( char *** , char ** );
80int		lenlist ( char ** );
81int		printlist ( FILE * , char ** );
82int		fdprintlist(int , char ** );
83int		searchlist ( char *, char ** );
84int		searchlist_with_terminfo ( char * , char ** );
85
86char **		duplist ( char ** );
87char **		getlist ( char * , char * , char * );
88char **		dashos ( char * );
89char **		wherelist ( char * , char ** );
90
91char *		sprintlist ( char ** );
92char *		search_cslist ( char * , char ** );
93
94void		freelist ( char ** );
95void		printlist_setup ( char * , char * , char * , char * );
96void		printlist_unsetup ( void );
97
98
99void		printsdn ( FILE * , SCALED );
100void		fdprintsdn ( int , SCALED );
101void		printsdn_setup ( char * , char * , char * );
102void		printsdn_unsetup ( void );
103
104SCALED		_getsdn ( char * , char ** , int );
105
106char *		makepath ( char * , ... );
107char *		getspooldir ( void );
108char *		getrequestfile ( char * );
109char *		getprinterfile ( char * , char * );
110char *		getsystemfile ( char * , char * );
111char *		getclassfile ( char * );
112char *		getfilterfile ( char * );
113char *		getformfile ( char * , char * );
114
115int		cs_strcmp ( char * , char * );
116int		cs_strncmp ( char * , char * , int );
117
118int		syn_name ( char * );
119int		syn_text ( char * );
120int		syn_comment ( char * );
121int		syn_machine_name ( char * );
122int		syn_option ( char * );
123
124int		putalert ( char * , char * , FALERT * );
125int		delalert ( char * , char * );
126
127FALERT *	getalert ( char * , char * );
128
129void		printalert ( FILE * , FALERT * , int );
130
131int		tidbit ( char * , char * , ... );
132void		untidbit ( char * );
133
134int		_Access ( char * , int );
135int		_Chdir ( char * );
136int		_Chmod ( char * , int );
137int		_Chown ( char * , int , int );
138int		_Close ( int );
139int		_Creat ( char * , int );
140int		_Fcntl ( int , int , ... );
141int		_Fstat ( int , struct stat * );
142int		_Link ( char * , char * );
143int		_Lstat ( char * , struct stat * );
144int		_Mknod ( char * , int , int );
145int		_Mkpipe ( char * , int , int );
146int		_Open ( char * , int , ... /* mode_t */ );
147int		_Read ( int , char * , unsigned int );
148int		_Readlink ( char * , char * , unsigned int );
149int		_Rename ( char * , char * );
150int		_Symlink ( char * , char * );
151int		_Stat ( char * , struct stat * );
152int		_Unlink ( char * );
153int		_Wait ( int * );
154int		_Write ( int , char * , unsigned int );
155
156void *		_Malloc ( size_t , const char * , int );
157void *		_Realloc ( void * , size_t , const char * , int );
158void *		_Calloc ( size_t , size_t , const char * , int );
159char *		_Strdup ( const char * , const char * , int );
160void		_Free ( void * , const char * , int );
161
162
163int		isterminfo ( char * );
164int		isprinter ( char * );
165int		isrequest ( char * );
166int		isnumber ( char * );
167
168char *		getname ( void );
169char *		makestr ( char * , ... );
170char *		strip ( char * );
171
172void		sendmail ( char * , char * );
173
174void		(*lp_alloc_fail_handler)( void );
175
176char *		next_x  ( char * , long * , unsigned int );
177
178