/*
- * "$Id: gziptoany.c 6420 2007-03-30 20:00:59Z mike $"
+ * "$Id$"
*
- * GZIP/raw pre-filter for the Common UNIX Printing System (CUPS).
+ * GZIP/raw pre-filter for CUPS.
*
- * Copyright 1993-2007 by Easy Software Products.
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1993-2007 by Easy Software Products.
*
- * These coded instructions, statements, and computer programs are the
- * property of Easy Software Products 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 missing or damaged please contact Easy Software Products
- * at:
+ * 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/".
*
- * Attn: CUPS Licensing Information
- * Easy Software Products
- * 44141 Airport View Drive, Suite 204
- * Hollywood, Maryland 20636 USA
- *
- * Voice: (301) 373-9600
- * EMail: cups-info@cups.org
- * WWW: http://www.cups.org
- *
- * This file is subject to the Apple OS-Developed Software exception.
- *
- * Contents:
- *
- * main() - Copy (and uncompress) files to stdout.
+ * This file is subject to the Apple OS-Developed Software exception.
*/
/*
* Include necessary headers...
*/
-#include <cups/file.h>
-#include <cups/string.h>
-#include <cups/i18n.h>
-#include <stdlib.h>
-#include <errno.h>
+#include <cups/cups-private.h>
/*
{
cups_file_t *fp; /* File */
char buffer[8192]; /* Data buffer */
- int bytes; /* Number of bytes read/written */
+ ssize_t bytes; /* Number of bytes read/written */
int copies; /* Number of copies */
if (argc != 7)
{
- 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]"),
+ argv[0]);
return (1);
}
if ((fp = cupsFileOpen(argv[6], "r")) == NULL)
{
- fprintf(stderr, _("ERROR: Unable to open file \"%s\": %s\n"), argv[6],
- strerror(errno));
+ _cupsLangPrintError("ERROR", _("Unable to open print file"));
return (1);
}
* Copy the file to stdout...
*/
- setbuf(stdout, NULL);
-
while (copies > 0)
{
if (!getenv("FINAL_CONTENT_TYPE"))
cupsFileRewind(fp);
while ((bytes = cupsFileRead(fp, buffer, sizeof(buffer))) > 0)
- if (fwrite(buffer, 1, bytes, stdout) < bytes)
+ if (write(1, buffer, (size_t)bytes) < bytes)
{
- fprintf(stderr,
- _("ERROR: Unable to write uncompressed document data: %s\n"),
- strerror(ferror(stdout)));
+ _cupsLangPrintFilter(stderr, "ERROR",
+ _("Unable to write uncompressed print data: %s"),
+ strerror(errno));
cupsFileClose(fp);
return (1);
/*
- * End of "$Id: gziptoany.c 6420 2007-03-30 20:00:59Z mike $".
+ * End of "$Id$".
*/