/*
- * "$Id: rastertohp.c 7403 2008-03-26 15:23:43Z mike $"
+ * "$Id: rastertohp.c 7834 2008-08-04 21:02:09Z mike $"
*
* Hewlett-Packard Page Control Language filter for the Common UNIX
* Printing System (CUPS).
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1993-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
+#include <errno.h>
/*
printf("\033&l80A"); /* Set page size */
break;
+ case 595 : /* A5 */
+ printf("\033&l25A"); /* Set page size */
+ break;
+
case 624 : /* DL Envelope */
printf("\033&l90A"); /* Set page size */
break;
if (!ppd || ppd->model_number != 2)
{
- if (header->Duplex)
- printf("\033&l%dS", /* Set duplex mode */
- header->Duplex + header->Tumble);
+ int mode = Duplex ? 1 + header->Tumble != 0 : 0;
+ printf("\033&l%dS", mode); /* Set duplex mode */
printf("\033&l0L"); /* Turn off perforation skip */
}
}
if ((Planes[0] = malloc(header->cupsBytesPerLine)) == NULL)
{
- fputs("ERROR: Unable to allocate memory!\n", stderr);
+ fputs("ERROR: Unable to allocate memory\n", stderr);
exit(1);
}
* and return.
*/
- fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"),
- argv[0]);
+ _cupsLangPrintf(stderr,
+ _("Usage: %s job-id user title copies options [file]\n"),
+ "rastertohp");
return (1);
}
{
if ((fd = open(argv[6], O_RDONLY)) == -1)
{
- perror("ERROR: Unable to open raster file - ");
+ _cupsLangPrintf(stderr, _("ERROR: Unable to open raster file - %s\n"),
+ strerror(errno));
sleep(1);
return (1);
}
break;
if ((y & 127) == 0)
- fprintf(stderr, _("INFO: Printing page %d, %d%% complete...\n"), Page,
- 100 * y / header.cupsHeight);
+ _cupsLangPrintf(stderr, _("INFO: Printing page %d, %d%% complete...\n"),
+ Page, 100 * y / header.cupsHeight);
/*
* Read a line of graphics...
*/
if (Page == 0)
- fputs(_("ERROR: No pages found!\n"), stderr);
+ {
+ _cupsLangPuts(stderr, _("ERROR: No pages found\n"));
+ return (1);
+ }
else
- fputs(_("INFO: Ready to print.\n"), stderr);
-
- return (Page == 0);
+ {
+ _cupsLangPuts(stderr, _("INFO: Ready to print.\n"));
+ return (0);
+ }
}
/*
- * End of "$Id: rastertohp.c 7403 2008-03-26 15:23:43Z mike $".
+ * End of "$Id: rastertohp.c 7834 2008-08-04 21:02:09Z mike $".
*/