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 <stdio.h>
36
37typedef enum FILTERTYPE {
38	fl_none,
39	fl_fast,
40	fl_slow,
41	fl_both
42}			FILTERTYPE;
43
44typedef struct FILTER {
45	char *		name;		/* name of filter (redundant) */
46	char *		command;	/* shell command (full path) */
47	FILTERTYPE	type;		/* type of filter (fast/slow) */
48	char **		printer_types;	/* list of valid printer types */
49	char **		printers;	/* list of valid printers */
50	char **		input_types;	/* list of valid input types */
51	char **		output_types;	/* list of valid output types */
52	char **		templates;	/* list of option templates */
53}			FILTER;
54
55
56
57typedef struct TYPE {
58	char *			name;
59	unsigned short		info;	/* 1 iff "name" is in Terminfo */
60}			TYPE;
61
62
63typedef struct TEMPLATE {
64	char *			keyword;
65	char *			pattern;
66	char *			re;
67	char *			result;
68	int			nbra;
69}			TEMPLATE;
70
71typedef struct _FILTER {
72	struct _FILTER *	next;		/* for linking several */
73	char *			name;
74	char *			command;
75	char **			printers;
76	TYPE *			printer_types;
77	TYPE *			input_types;	/* all possible choices */
78	TYPE *			output_types;	/* all possible choices */
79	TYPE *			inputp;		/* the one to be used */
80	TYPE *			outputp;	/* the one to be used */
81	TEMPLATE *		templates;
82	FILTERTYPE		type;
83	unsigned char		mark,
84				level;
85}			_FILTER;
86
87
88FILTER *	getfilter ( char * );
89
90_FILTER *	search_filter ( char * );
91
92FILTERTYPE	insfilter ( char ** , char * , char * , char * , char * , char ** , unsigned short * );
93FILTERTYPE	s_to_filtertype ( char * );
94
95TEMPLATE	s_to_template ( char * );
96
97TEMPLATE *	sl_to_templatel ( char ** );
98
99TYPE		s_to_type ( char * );
100
101TYPE *		sl_to_typel ( char ** );
102
103char *		template_to_s ( TEMPLATE );
104char *		type_to_s ( TYPE );
105
106char **		templatel_to_sl ( TEMPLATE * );
107char **		typel_to_sl ( TYPE * );
108
109int		open_filtertable ( char * , char * );
110
111int		get_and_load ( void );
112int		putfilter ( char * , FILTER * );
113int		delfilter ( char * );
114int		loadfilters ( char * );
115
116void		freetempl ( TEMPLATE * );
117void		freefilter ( FILTER * );
118void		free_filter ( _FILTER * );
119void		trash_filters ( void );
120void		close_filtertable ( FILE * );
121