/*
- * "$Id: lp.c 7170 2008-01-04 02:21:30Z mike $"
+ * "$Id$"
*
- * "lp" command for CUPS.
+ * "lp" command for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products.
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products.
*
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
- *
- * Contents:
- *
- * main() - Parse options and send files for printing.
- * restart_job() - Restart a job.
- * set_job_attrs() - Set job attributes.
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
*/
/*
int i, j; /* Looping vars */
int job_id; /* Job ID */
char *printer, /* Printer name */
- *instance, /* Instance name */
+ *instance, /* Instance name */
*val, /* Option value */
*title; /* Job title */
int priority; /* Job priority (1-100) */
cupsSetUser(argv[i]);
}
break;
-
+
case 'c' : /* Copy to spool dir (always enabled) */
break;
if ((instance = strrchr(printer, '/')) != NULL)
*instance++ = '\0';
- if ((dest = cupsGetNamedDest(NULL, printer, instance)) != NULL)
+ if ((dest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, printer,
+ instance)) != NULL)
{
for (j = 0; j < dest->num_options; j ++)
if (cupsGetOption(dest->options[j].name, num_options,
dest->options[j].value,
num_options, &options);
}
+ else if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+ cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+ {
+ _cupsLangPrintf(stderr,
+ _("%s: Error - add '/version=1.1' to server "
+ "name."), argv[0]);
+ return (1);
+ }
break;
case 'f' : /* Form */
break;
case '-' : /* Stop processing options */
+ if (argv[i][2])
+ {
+ _cupsLangPrintf(stderr, _("%s: Error - unknown option \"%s\"."),
+ argv[0], argv[i]);
+ return (1);
+ }
+
end_options = 1;
break;
dest->options[j].value,
num_options, &options);
}
+ else if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+ cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+ {
+ _cupsLangPrintf(stderr,
+ _("%s: Error - add '/version=1.1' to server "
+ "name."), argv[0]);
+ return (1);
+ }
}
if (printer == NULL)
while (status == HTTP_CONTINUE &&
(bytes = read(0, buffer, sizeof(buffer))) > 0)
- status = cupsWriteRequestData(CUPS_HTTP_DEFAULT, buffer, bytes);
+ status = cupsWriteRequestData(CUPS_HTTP_DEFAULT, buffer, (size_t)bytes);
if (status != HTTP_CONTINUE)
{
if (cupsFinishDocument(CUPS_HTTP_DEFAULT, printer) != IPP_OK)
{
+ _cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
cupsCancelJob2(CUPS_HTTP_DEFAULT, printer, job_id, 0);
- job_id = 0;
+ return (1);
}
}
ippDelete(cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/jobs"));
- if (cupsLastError() > IPP_OK_CONFLICT)
+ if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+ cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+ {
+ _cupsLangPrintf(stderr,
+ _("%s: Error - add '/version=1.1' to server "
+ "name."), command);
+ return (1);
+ }
+ else if (cupsLastError() > IPP_OK_CONFLICT)
{
_cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
return (1);
ippDelete(cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/jobs"));
- if (cupsLastError() > IPP_OK_CONFLICT)
+ if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+ cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+ {
+ _cupsLangPrintf(stderr,
+ _("%s: Error - add '/version=1.1' to server "
+ "name."), command);
+ return (1);
+ }
+ else if (cupsLastError() > IPP_OK_CONFLICT)
{
_cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
return (1);
/*
- * End of "$Id: lp.c 7170 2008-01-04 02:21:30Z mike $".
+ * End of "$Id$".
*/