*
* IPP backend for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
if ((fd = cupsTempFd(tmpfilename, sizeof(tmpfilename))) < 0)
{
- perror("ERROR: unable to create temporary file");
+ _cupsLangPrintError(_("ERROR: Unable to create temporary file"));
return (CUPS_BACKEND_FAILED);
}
if ((fp = cupsFileOpenFd(fd, compression ? "w9" : "w")) == NULL)
{
- perror("ERROR: unable to open temporary file");
+ _cupsLangPrintError(_("ERROR: Unable to open temporary file"));
close(fd);
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
if (cupsFileWrite(fp, buffer, bytes) < bytes)
{
- perror("ERROR: unable to write to temporary file");
+ _cupsLangPrintError(_("ERROR: Unable to write to temporary file"));
cupsFileClose(fp);
unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
_("INFO: Unable to contact printer, queuing on next "
"printer in class...\n"));
- if (argc == 6 || strcmp(filename, argv[6]))
- unlink(filename);
+ if (tmpfilename[0])
+ unlink(tmpfilename);
/*
* Sleep 5 seconds to keep the job from requeuing too rapidly...
if (job_cancelled)
{
- if (argc == 6 || strcmp(filename, argv[6]))
- unlink(filename);
+ if (tmpfilename[0])
+ unlink(tmpfilename);
return (CUPS_BACKEND_FAILED);
}
ippDelete(supported);
httpClose(http);
- if (argc == 6 || strcmp(filename, argv[6]))
- unlink(filename);
+ if (tmpfilename[0])
+ unlink(tmpfilename);
/*
* Sleep 5 seconds to keep the job from requeuing too rapidly...
num_options = cupsParseOptions(argv[5], 0, &options);
#ifdef __APPLE__
- if (!strcasecmp(content_type, "application/pictwps") && num_files == 1)
+ if (!strcasecmp(final_content_type, "application/pictwps") &&
+ num_files == 1)
{
if (format_sup != NULL)
{
for (i = 0; i < format_sup->num_values; i ++)
- if (!strcasecmp(content_type, format_sup->values[i].string.text))
+ if (!strcasecmp(final_content_type, format_sup->values[i].string.text))
break;
}
* so convert the document to PostScript...
*/
- if (run_pictwps_filter(argv, filename))
+ if (run_pictwps_filter(argv, files[0]))
+ {
+ if (pstmpname[0])
+ unlink(pstmpname);
+
+ if (tmpfilename[0])
+ unlink(tmpfilename);
+
return (CUPS_BACKEND_FAILED);
+ }
- filename = pstmpname;
+ files[0] = pstmpname;
/*
* Change the MIME type to application/postscript and change the
{
(void)prompt;
- if (password && password_tries < 3)
+ if (password && *password && password_tries < 3)
{
password_tries ++;
else if (!strncmp(reason, "moving-to-paused", 16) ||
!strncmp(reason, "paused", 6) ||
!strncmp(reason, "shutdown", 8))
- message = _("Printer off-line.");
+ message = _("Printer offline.");
else if (!strncmp(reason, "toner-low", 9))
message = _("Toner low.");
else if (!strncmp(reason, "toner-empty", 11))
_cupsLangPrintf(stderr, _("ERROR: Unable to fork pictwpstops: %s\n"),
strerror(errno));
- unlink(filename);
if (ppdfile)
unlink(ppdfile);
return (-1);
_cupsLangPrintf(stderr, _("ERROR: Unable to wait for pictwpstops: %s\n"),
strerror(errno));
close(fd);
- unlink(filename);
if (ppdfile)
unlink(ppdfile);
return (-1);
_cupsLangPrintf(stderr, _("ERROR: pictwpstops exited on signal %d!\n"),
status);
- unlink(filename);
return (status);
}