]>
git.ipfire.org Git - thirdparty/cups.git/blob - filter/gziptoany.c
2 * "$Id: gziptoany.c 6378 2007-03-21 07:18:18Z mike $"
4 * GZIP/raw pre-filter for the Common UNIX Printing System (CUPS).
6 * Copyright 1993-2007 by Easy Software Products.
8 * These coded instructions, statements, and computer programs are the
9 * property of Easy Software Products and are protected by Federal
10 * copyright law. Distribution and use rights are outlined in the file
11 * "LICENSE.txt" which should have been included with this file. If this
12 * file is missing or damaged please contact Easy Software Products
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636 USA
20 * Voice: (301) 373-9600
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
24 * This file is subject to the Apple OS-Developed Software exception.
28 * main() - Copy (and uncompress) files to stdout.
32 * Include necessary headers...
35 #include <cups/file.h>
36 #include <cups/string.h>
42 * 'main()' - Copy (and uncompress) files to stdout.
45 int /* O - Exit status */
46 main(int argc
, /* I - Number of command-line arguments */
47 char *argv
[]) /* I - Command-line arguments */
49 cups_file_t
*fp
; /* File */
50 char buffer
[8192]; /* Data buffer */
51 int bytes
; /* Number of bytes read/written */
52 int copies
; /* Number of copies */
56 * Check command-line...
61 fputs("ERROR: gziptoany job-id user title copies options file\n", stderr
);
66 * Get the copy count; if we have no final content type, this is a
67 * raw queue or raw print file, so we need to make copies...
70 if (!getenv("FINAL_CONTENT_TYPE"))
71 copies
= atoi(argv
[4]);
79 if ((fp
= cupsFileOpen(argv
[6], "r")) == NULL
)
81 fprintf(stderr
, "ERROR: Unable to open file \"%s\": %s\n", argv
[6],
87 * Copy the file to stdout...
96 while ((bytes
= cupsFileRead(fp
, buffer
, sizeof(buffer
))) > 0)
97 if (fwrite(buffer
, 1, bytes
, stdout
) < bytes
)
100 "ERROR: Unable to write uncompressed document data: %s\n",
101 strerror(ferror(stdout
)));
111 * Close the file and return...
121 * End of "$Id: gziptoany.c 6378 2007-03-21 07:18:18Z mike $".