char *argv[]) /* I - Command-line arguments */
{
int fd; /* File descriptor */
+ int empty = 1;
cups_raster_t *ras; /* Raster stream for printing */
cups_page_header2_t header; /* Page header from file */
int page; /* Current page */
signal(SIGTERM, CancelJob);
#endif /* HAVE_SIGSET */
- /*
- * Initialize the print device...
- */
-
- Setup(ppd);
-
/*
* Process pages as needed...
*/
* Write a status message with the page number and number of copies.
*/
+ if (empty)
+ {
+ /*
+ * Initialize the print device...
+ */
+ Setup(ppd);
+ empty = 0;
+ }
+
if (Canceled)
break;
break;
}
- Shutdown(ppd);
+ if (!empty)
+ Shutdown(ppd);
cupsFreeOptions(num_options, options);
if (DotBuffers[i] != NULL)
free(DotBuffers[i]);
+ if (empty)
+ {
+ fprintf(stderr, "DEBUG: Input is empty, outputting empty file.\n");
+ return 0;
+ }
return (page == 0);
}