]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - ppdc/ppdc-file.cxx
Update cups.desktop.in
[thirdparty/cups.git] / ppdc / ppdc-file.cxx
index 171eb1d80d2861f7f4ef95fc3ce45aba3ed15b88..4bbe86dd338913d859fb7ad27ef709e00b879362 100644 (file)
@@ -1,31 +1,21 @@
 //
-// "$Id$"
+// File class for the CUPS PPD Compiler.
 //
-//   File class for the CUPS PPD Compiler.
+// Copyright 2007-2010 by Apple Inc.
+// Copyright 2002-2005 by Easy Software Products.
 //
-//   Copyright 2007-2009 by Apple Inc.
-//   Copyright 2002-2005 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/".
-//
-// Contents:
-//
-//   ppdcFile::ppdcFile()  - Create (open) a file.
-//   ppdcFile::~ppdcFile() - Delete (close) a file.
-//   ppdcFile::get()       - Get a character from a file.
-//   ppdcFile::peek()      - Look at the next character from a file.
+// 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/".
 //
 
 //
 // Include necessary headers...
 //
 
-#include "ppdc.h"
-#include <cups/i18n.h>
+#include "ppdc-private.h"
 
 
 //
@@ -43,11 +33,12 @@ ppdcFile::ppdcFile(const char  *f,          // I - File to open
   else
     fp = cupsFileOpen(f, "r");
 
-  filename = f;
-  line     = 1;
+  close_on_delete = !ffp;
+  filename        = f;
+  line            = 1;
 
   if (!fp)
-    _cupsLangPrintf(stderr, _("%s: Unable to open %s: %s\n"), "ppdc", f,
+    _cupsLangPrintf(stderr, _("ppdc: Unable to open %s: %s"), f,
                     strerror(errno));
 }
 
@@ -58,7 +49,7 @@ ppdcFile::ppdcFile(const char  *f,            // I - File to open
 
 ppdcFile::~ppdcFile()
 {
-  if (fp)
+  if (close_on_delete && fp)
     cupsFileClose(fp);
 }
 
@@ -103,8 +94,3 @@ ppdcFile::peek()
   // Otherwise return the next character without advancing...
   return (cupsFilePeekChar(fp));
 }
-
-
-//
-// End of "$Id$".
-//