lpr.c revision e2738c5e21a9e5d9a6525e48af4738deda3df455
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
*/
/* $Id: lpr.c 146 2006-03-24 00:26:54Z njacobs $ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <locale.h>
#include <libintl.h>
#include <papi.h>
#include "common.h"
#ifdef HAVE_LIBMAGIC /* for mimetype auto-detection */
#include <magic.h>
#endif /* HAVE_LIBMAGIC */
static void
{
char *name;
else
name++;
gettext("Usage: %s [-P printer] [-# copies] [-C class] "
"[-J job] [-T title] "
"[-p [-i indent] [-w width]] "
"[-1|-2|-3|-4 font] [-m] [-h] [-s] "
"[-filter_option] [file ..]\n"), name);
exit(1);
}
int
{
int exit_code = 0;
int dump = 0;
int validate = 0;
int remove = 0;
char *document_format = "application/octet-stream";
int c;
(void) textdomain("SUNW_OST_OSCMD");
"EP:#:C:DVJ:T:w:i:hplrstdgvcfmn1:2:3:4:")) != EOF)
switch (c) {
case 'E':
break;
case 'P':
break;
case '#':
break;
case 'C':
"rfc-1179-class", optarg);
break;
case 'D':
dump = 1;
break;
case 'J':
"job-name", optarg);
break;
case 'T':
"pr-title", optarg);
break;
case 'p':
"document-format", "application/x-pr");
"pr-filter", 1);
break;
case 'i':
break;
case 'w':
break;
case 'h':
"job-sheets", "none");
break;
case 'l':
"document-format", "application/octet-stream");
break;
case 'o':
"document-format", "application/postscript");
break;
case 'c':
"document-format", "application/x-cif");
break;
case 'd':
"document-format", "application/x-dvi");
break;
case 'f':
"document-format", "application/x-fortran");
break;
case 'g':
"document-format", "application/x-plot");
break;
case 'n':
"document-format", "application/x-ditroff");
break;
case 't':
"document-format", "application/x-troff");
break;
case 'v':
"document-format", "application/x-raster");
break;
case 'm':
"rfc-1179-mail", 1);
break;
case 'r':
remove = 1;
break;
case 's':
copy = 0;
break;
case 'V': /* validate */
validate = 1;
break;
case '1':
"rfc-1179-font-r", optarg);
break;
case '2':
"rfc-1179-font-i", optarg);
break;
case '3':
"rfc-1179-font-b", optarg);
break;
case '4':
"rfc-1179-font-s", optarg);
break;
default:
}
"-r and -s may not be used together\n"));
exit(1);
}
#ifdef MAGIC_MIME
/* get the mime type of the file data */
}
}
#endif
"document-format", document_format);
"job-sheets", "standard");
encryption, NULL);
"Failed to contact service for %s: %s\n"), printer,
exit(1);
}
else if (copy == 0) /* reference the files in the job, default */
else /* copy the files before return, -c */
exit(1);
}
if (dump != 0) {
printf("job attributes:\n");
printf("\n");
}
return (exit_code);
}