8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / lp / model / lp.set.c
blobe2748a08907df02dc11d58f6b3dc9e09052a4f7e
1 /*
2 * CDDL HEADER START
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.
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.
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]
20 * CDDL HEADER END
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include "stdio.h"
34 #include "lp.h"
35 #include "lp.set.h"
37 extern char *getenv();
39 /**
40 ** main()
41 **/
43 int
44 main(int argc, char *argv[])
46 static char not_set[10] = "H V W L S";
48 int exit_code;
50 char *TERM = getenv("TERM");
53 if (!TERM || !*TERM || tidbit(TERM, (char *)0) == -1)
54 exit (1);
57 * Very simple calling sequence:
59 * lpset horz-pitch vert-pitch width length char-set
61 * The first four can be scaled with 'i' (inches) or
62 * 'c' (centimeters). A pitch scaled with 'i' is same
63 * as an unscaled pitch.
64 * Blank arguments will skip the corresponding setting.
66 if (argc != 6)
67 exit (1);
69 exit_code = 0;
71 if (argv[1][0]) {
72 switch (set_pitch(argv[1], 'H', 1)) {
73 case E_SUCCESS:
74 not_set[0] = ' ';
75 break;
76 case E_FAILURE:
77 break;
78 default:
79 exit_code = 1;
80 break;
82 } else
83 not_set[0] = ' ';
85 if (argv[2][0]) {
86 switch (set_pitch(argv[2], 'V', 1)) {
87 case E_SUCCESS:
88 not_set[2] = ' ';
89 break;
90 case E_FAILURE:
91 break;
92 default:
93 exit_code = 1;
94 break;
96 } else
97 not_set[2] = ' ';
99 if (argv[3][0]) {
100 switch (set_size(argv[3], 'W', 1)) {
101 case E_SUCCESS:
102 not_set[4] = ' ';
103 break;
104 case E_FAILURE:
105 break;
106 default:
107 exit_code = 1;
108 break;
110 } else
111 not_set[4] = ' ';
113 if (argv[4][0]) {
114 switch (set_size(argv[4], 'L', 1)) {
115 case E_SUCCESS:
116 not_set[6] = ' ';
117 break;
118 case E_FAILURE:
119 break;
120 default:
121 exit_code = 1;
122 break;
124 } else
125 not_set[6] = ' ';
127 if (argv[5][0]) {
128 switch (set_charset(argv[5], 1, TERM)) {
129 case E_SUCCESS:
130 not_set[8] = ' ';
131 break;
132 case E_FAILURE:
133 break;
134 default:
135 exit_code = 1;
136 break;
138 } else
139 not_set[8] = ' ';
141 fprintf (stderr, "%s\n", not_set);
143 return (exit_code);