xref: /titanic_51/usr/src/cmd/lp/lib/lp/llib-llp (revision bbaa8b60dd95d714741fc474adad3cf710ef4efd)
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 2005 Sun Microsystems, Inc.  All rights reserved.
27 * Use is subject to license terms.
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	open_locked(char *, char *, mode_t);
54extern char	*fdgets(char *, int, int);
55extern int	fdprintf(int, char *, ...);
56extern int	fdputs(char *, int);
57extern int	fdputc(char, int);
58
59
60FILE		*open_lpfile ( char * , char * , mode_t );
61int		close_lpfile ( FILE * );
62int		chown_lppath ( char * path );
63int		mkdir_lpdir ( char * path , int mode );
64int		rmfile ( char * path );
65int		dumpstring ( char * path , char * str );
66
67char *		loadstring ( char * path );
68char *		loadline ( char * path );
69char *		sop_up_rest (int, char * endsop );
70
71int		addlist ( char *** , char * );
72int		addstring ( char ** , char * );
73int		appendlist ( char *** , char * );
74int		dellist ( char *** , char * );
75int		joinlist ( char *** , char ** );
76int		lenlist ( char ** );
77int		printlist ( FILE * , char ** );
78int		fdprintlist(int , char ** );
79int		searchlist ( char *, char ** );
80int		searchlist_with_terminfo ( char * , char ** );
81
82char **		duplist ( char ** );
83char **		getlist ( char * , char * , char * );
84char **		dashos ( char * );
85char **		wherelist ( char * , char ** );
86
87char *		sprintlist ( char ** );
88char *		search_cslist ( char * , char ** );
89
90void		freelist ( char ** );
91void		printlist_setup ( char * , char * , char * , char * );
92void		printlist_unsetup ( void );
93
94
95void		printsdn ( FILE * , SCALED );
96void		fdprintsdn ( int , SCALED );
97void		printsdn_setup ( char * , char * , char * );
98void		printsdn_unsetup ( void );
99
100SCALED		_getsdn ( char * , char ** , int );
101
102char *		makepath ( char * , ... );
103char *		getspooldir ( void );
104char *		getrequestfile ( char * );
105char *		getprinterfile ( char * , char * );
106char *		getsystemfile ( char * , char * );
107char *		getclassfile ( char * );
108char *		getfilterfile ( char * );
109char *		getformfile ( char * , char * );
110
111int		cs_strcmp ( char * , char * );
112int		cs_strncmp ( char * , char * , int );
113
114int		syn_name ( char * );
115int		syn_text ( char * );
116int		syn_comment ( char * );
117int		syn_machine_name ( char * );
118int		syn_option ( char * );
119
120int		putalert ( char * , char * , FALERT * );
121int		delalert ( char * , char * );
122
123FALERT *	getalert ( char * , char * );
124
125void		printalert ( FILE * , FALERT * , int );
126
127int		tidbit ( char * , char * , ... );
128void		untidbit ( char * );
129
130int		_Access ( char * , int );
131int		_Chdir ( char * );
132int		_Chmod ( char * , int );
133int		_Chown ( char * , int , int );
134int		_Close ( int );
135int		_Creat ( char * , int );
136int		_Fcntl ( int , int , ... );
137int		_Fstat ( int , struct stat * );
138int		_Link ( char * , char * );
139int		_Lstat ( char * , struct stat * );
140int		_Mknod ( char * , int , int );
141int		_Mkpipe ( char * , int , int );
142int		_Open ( char * , int , ... /* mode_t */ );
143int		_Read ( int , char * , unsigned int );
144int		_Readlink ( char * , char * , unsigned int );
145int		_Rename ( char * , char * );
146int		_Symlink ( char * , char * );
147int		_Stat ( char * , struct stat * );
148int		_Unlink ( char * );
149int		_Wait ( int * );
150int		_Write ( int , char * , unsigned int );
151
152void *		_Malloc ( size_t , const char * , int );
153void *		_Realloc ( void * , size_t , const char * , int );
154void *		_Calloc ( size_t , size_t , const char * , int );
155char *		_Strdup ( const char * , const char * , int );
156void		_Free ( void * , const char * , int );
157
158
159int		isterminfo ( char * );
160int		isprinter ( char * );
161int		isrequest ( char * );
162int		isnumber ( char * );
163
164char *		getname ( void );
165char *		makestr ( char * , ... );
166char *		strip ( char * );
167
168void		sendmail ( char * , char * );
169
170void		(*lp_alloc_fail_handler)( void );
171
172char *		next_x  ( char * , long * , unsigned int );
173
174