]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - filter/gziptoany.c
Fix source file header text duplication text duplication.
[thirdparty/cups.git] / filter / gziptoany.c
index 6744c3bfa90a65ad25a5e60753a3db49ab7f4ae6..0eae85ec95ffe0dc9258911b149d2d96137cf9bc 100644 (file)
@@ -1,16 +1,14 @@
 /*
- * "$Id$"
- *
  * GZIP/raw pre-filter for CUPS.
  *
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2015 by Apple Inc.
  * Copyright 1993-2007 by Easy Software Products.
  *
  * 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/".
+ * missing or damaged, see the license at "http://www.cups.org/".
  *
  * This file is subject to the Apple OS-Developed Software exception.
  */
@@ -40,7 +38,7 @@ main(int  argc,                               /* I - Number of command-line arguments */
   * Check command-line...
   */
 
-  if (argc != 7)
+  if (argc < 6 || argc > 7)
   {
     _cupsLangPrintf(stderr,
                     _("Usage: %s job-id user title copies options [file]"),
@@ -62,8 +60,14 @@ main(int  argc,                              /* I - Number of command-line arguments */
   * Open the file...
   */
 
-  if ((fp = cupsFileOpen(argv[6], "r")) == NULL)
+  if (argc == 6)
+  {
+    copies = 1;
+    fp     = cupsFileStdin();
+  }
+  else if ((fp = cupsFileOpen(argv[6], "r")) == NULL)
   {
+    fprintf(stderr, "DEBUG: Unable to open \"%s\".\n", argv[6]);
     _cupsLangPrintError("ERROR", _("Unable to open print file"));
     return (1);
   }
@@ -85,7 +89,8 @@ main(int  argc,                               /* I - Number of command-line arguments */
        _cupsLangPrintFilter(stderr, "ERROR",
                             _("Unable to write uncompressed print data: %s"),
                             strerror(errno));
-       cupsFileClose(fp);
+        if (argc == 7)
+         cupsFileClose(fp);
 
        return (1);
       }
@@ -97,12 +102,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
   * Close the file and return...
   */
 
-  cupsFileClose(fp);
+  if (argc == 7)
+    cupsFileClose(fp);
 
   return (0);
 }
-
-
-/*
- * End of "$Id$".
- */