xref: /illumos-gate/usr/src/cmd/lp/lib/forms/f_head.c (revision 45ede40b2394db7967e59f19288fae9b62efd4aa)
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 /*
23  * Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.2	*/
32 /* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
33 
34 #include "sys/types.h"
35 
36 #include "lp.h"
37 #include "form.h"
38 
39 struct {
40 	char			*v;
41 	short			len;
42 	short			infile;
43 }			formheadings[FO_MAX] = {
44 
45 #define	ENTRY(X)	X, sizeof(X)-1
46 
47 	ENTRY("page length:"),		1,	/* FO_PLEN */
48 	ENTRY("page width:"),		1,	/* FO_PWID */
49 	ENTRY("number of pages:"),	1,	/* FO_NP */
50 	ENTRY("line pitch:"),		1,	/* FO_LPI */
51 	ENTRY("character pitch:"),	1,	/* FO_CPI */
52 	ENTRY("character set choice:"),	1,	/* FO_CHSET */
53 	ENTRY("ribbon color:"),		1,	/* FO_RCOLOR */
54 	ENTRY("comment:"),		0,	/* FO_CMT */
55 	ENTRY("alignment pattern:"),	1,	/* FO_ALIGN */
56 	ENTRY("paper:"),		1,	/* FO_PAPER */
57 
58 #undef	ENTRY
59 
60 };
61 
62 /**
63  ** _search_fheading()
64  **/
65 
66 int
67 #if	defined(__STDC__)
68 _search_fheading (
69 	char *			buf
70 )
71 #else
72 _search_fheading (buf)
73 	char *			buf;
74 #endif
75 {
76 	int			fld;
77 
78 
79 	for (fld = 0; fld < FO_MAX; fld++)
80 		if (
81 			formheadings[fld].v
82 		     && formheadings[fld].len
83 		     && CS_STRNEQU(
84 				buf,
85 				formheadings[fld].v,
86 				formheadings[fld].len
87 			)
88 		)
89 			break;
90 
91 	return (fld);
92 }
93