/*
* 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
*/
/*
*
*/
/* $Id: lp.c 179 2006-07-17 18:24:07Z njacobs $ */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <locale.h>
#include <libintl.h>
#include <papi.h>
#include "common.h"
#include <pwd.h>
#include <grp.h>
#ifdef HAVE_LIBMAGIC /* for mimetype auto-detection */
#include <magic.h>
#endif /* HAVE_LIBMAGIC */
static void
{
char *name;
else
name++;
gettext("Usage: %s [-c] [-m] [-p] [-s] [-w] [-d destination] "
"[-f form-name] [-H special-handling] [-n number] "
"[-o option] [-P page-list] [-q priority-level] "
"[-S character-set | print-wheel] [-t title] [-v] "
"[-T content-type [-r]] [-y mode-list] [file...]\n"),
name);
exit(1);
}
int
{
char b = PAPI_TRUE;
int copy = 0;
int silent = 0;
int dump = 0;
int validate = 0;
int c;
(void) textdomain("SUNW_OST_OSCMD");
switch (c) {
case 'H': /* handling */
"job-hold-until", "indefinite");
"job-hold-until", "no-hold");
else
"job-hold-until", optarg);
break;
case 'P': { /* page list */
}
break;
case 'S': /* charset */
"lp-charset", optarg);
break;
case 'T': /* type */
"document-format",
break;
case 'D': /* dump */
dump = 1;
break;
case 'c': /* copy */
copy = 1;
break;
case 'd': /* destination */
break;
case 'f': /* form */
"form", optarg);
break;
case 'i': /* modify job */
(modify < 0)) {
gettext("invalid request id: %s\n"),
optarg);
exit(1);
}
break;
case 'm': /* mail when complete */
"rfc-1179-mail", 1);
break;
case 'n': /* copies */
break;
case 'o': /* lp "options" */
break;
case 'p': /* Solaris - notification */
"rfc-1179-mail", 1);
break;
case 'q': { /* priority */
i = 100 - (i * 2.5);
if ((i < 1) || (i > 100)) {
" value \"%s\"."), optarg);
" from 0 to 39."));
exit(1);
}
"job-priority", i);
}
break;
case 'r': /* "raw" mode */
"document-format",
"stty", "raw");
break;
case 's': /* suppress message */
silent = 1;
break;
case 't': /* title */
"job-name", optarg);
break;
case 'V': /* validate */
validate = 1;
break;
case 'w':
"rfc-1179-mail", 1);
break;
case 'y': /* lp "modes" */
"lp-modes", optarg);
break;
case 'E':
break;
default:
}
/* convert "banner", "nobanner" to "job-sheet" */
if (b == PAPI_FALSE)
"job-sheets", "none");
}
if (modify == -1) {
/* get the mime type of the file data */
#ifdef MAGIC_MIME
}
#else
#endif
} else {
== 1)
}
"document-format", document_format);
"job-sheets", "standard");
}
encryption, NULL);
"Failed to contact service for %s: %s\n"), printer,
exit(1);
}
if (dump != 0) {
printf("requesting attributes:\n");
printf("\n");
}
if (modify != -1)
else if (copy == 0) /* reference the files in the job, default */
else /* copy the files before return, -c */
exit(1);
}
"printer-name", &printer);
"job-id-requested", &id);
if (id == -1) {
}
else
printf("(standard input)\n");
if (dump != 0) {
printf("job attributes:\n");
printf("\n");
}
}
return (0);
}