3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 *
26 */
27
28 /* $Id: lpr.c 146 2006-03-24 00:26:54Z njacobs $ */
29
30 #pragma ident "%Z%%M% %I% %E% SMI"
31
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <unistd.h>
35 #include <string.h>
36 #include <locale.h>
37 #include <libintl.h>
38 #include <papi.h>
39 #include "common.h"
40
41 #ifdef HAVE_LIBMAGIC /* for mimetype auto-detection */
42 #include <magic.h>
43 #endif /* HAVE_LIBMAGIC */
44
45 static void
46 usage(char *program)
47 {
48 char *name;
49
50 if ((name = strrchr(program, '/')) == NULL)
51 name = program;
58 "[-p [-i indent] [-w width]] "
59 "[-1|-2|-3|-4 font] [-m] [-h] [-s] "
60 "[-filter_option] [file ..]\n"), name);
61 exit(1);
62 }
63
64 int
65 main(int ac, char *av[])
66 {
67 papi_status_t status;
68 papi_service_t svc = NULL;
69 papi_attribute_t **list = NULL;
70 papi_job_t job = NULL;
71 int exit_code = 0;
72 char *printer = NULL;
73 char prefetch[3];
74 int prefetch_len = sizeof (prefetch);
75 papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
76 int dump = 0;
77 int validate = 0;
78 int remove = 0;
79 int copy = 1; /* default is to copy the data */
80 char *document_format = "text/plain";
81 int c;
82
83 (void) setlocale(LC_ALL, "");
84 (void) textdomain("SUNW_OST_OSCMD");
85
86 while ((c = getopt(ac, av,
87 "EP:#:C:DVJ:T:w:i:hplrstdgvcfmn1:2:3:4:")) != EOF)
88 switch (c) {
89 case 'E':
90 encryption = PAPI_ENCRYPT_REQUIRED;
91 break;
92 case 'P':
93 printer = optarg;
94 break;
95 case '#':
96 papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL,
97 "copies", atoi(optarg));
98 break;
153 papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
154 "document-format", "application/x-plot");
155 break;
156 case 'n':
157 papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
158 "document-format", "application/x-ditroff");
159 break;
160 case 't':
161 papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
162 "document-format", "application/x-troff");
163 break;
164 case 'v':
165 papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
166 "document-format", "application/x-raster");
167 break;
168 case 'm':
169 papiAttributeListAddBoolean(&list, PAPI_ATTR_EXCL,
170 "rfc-1179-mail", 1);
171 break;
172 case 'r':
173 remove = 1;
174 break;
175 case 's':
176 copy = 0;
177 break;
178 case 'V': /* validate */
179 validate = 1;
180 break;
181 case '1':
182 papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
183 "rfc-1179-font-r", optarg);
184 break;
185 case '2':
186 papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
187 "rfc-1179-font-i", optarg);
188 break;
189 case '3':
190 papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
191 "rfc-1179-font-b", optarg);
192 break;
193 case '4':
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2017 Gary Mills
24 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 *
27 */
28
29 /* $Id: lpr.c 146 2006-03-24 00:26:54Z njacobs $ */
30
31 #include <stdio.h>
32 #include <stdlib.h>
33 #include <unistd.h>
34 #include <string.h>
35 #include <locale.h>
36 #include <libintl.h>
37 #include <papi.h>
38 #include "common.h"
39
40 #ifdef HAVE_LIBMAGIC /* for mimetype auto-detection */
41 #include <magic.h>
42 #endif /* HAVE_LIBMAGIC */
43
44 static void
45 usage(char *program)
46 {
47 char *name;
48
49 if ((name = strrchr(program, '/')) == NULL)
50 name = program;
57 "[-p [-i indent] [-w width]] "
58 "[-1|-2|-3|-4 font] [-m] [-h] [-s] "
59 "[-filter_option] [file ..]\n"), name);
60 exit(1);
61 }
62
63 int
64 main(int ac, char *av[])
65 {
66 papi_status_t status;
67 papi_service_t svc = NULL;
68 papi_attribute_t **list = NULL;
69 papi_job_t job = NULL;
70 int exit_code = 0;
71 char *printer = NULL;
72 char prefetch[3];
73 int prefetch_len = sizeof (prefetch);
74 papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
75 int dump = 0;
76 int validate = 0;
77 int copy = 1; /* default is to copy the data */
78 char *document_format = "text/plain";
79 int c;
80
81 (void) setlocale(LC_ALL, "");
82 (void) textdomain("SUNW_OST_OSCMD");
83
84 while ((c = getopt(ac, av,
85 "EP:#:C:DVJ:T:w:i:hplrstdgvcfmn1:2:3:4:")) != EOF)
86 switch (c) {
87 case 'E':
88 encryption = PAPI_ENCRYPT_REQUIRED;
89 break;
90 case 'P':
91 printer = optarg;
92 break;
93 case '#':
94 papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL,
95 "copies", atoi(optarg));
96 break;
151 papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
152 "document-format", "application/x-plot");
153 break;
154 case 'n':
155 papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
156 "document-format", "application/x-ditroff");
157 break;
158 case 't':
159 papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
160 "document-format", "application/x-troff");
161 break;
162 case 'v':
163 papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
164 "document-format", "application/x-raster");
165 break;
166 case 'm':
167 papiAttributeListAddBoolean(&list, PAPI_ATTR_EXCL,
168 "rfc-1179-mail", 1);
169 break;
170 case 'r':
171 break;
172 case 's':
173 copy = 0;
174 break;
175 case 'V': /* validate */
176 validate = 1;
177 break;
178 case '1':
179 papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
180 "rfc-1179-font-r", optarg);
181 break;
182 case '2':
183 papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
184 "rfc-1179-font-i", optarg);
185 break;
186 case '3':
187 papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
188 "rfc-1179-font-b", optarg);
189 break;
190 case '4':
|