]>
git.ipfire.org Git - thirdparty/cups.git/blob - ppdc/ppdc-file.cxx
2 // File class for the CUPS PPD Compiler.
4 // Copyright 2007-2010 by Apple Inc.
5 // Copyright 2002-2005 by Easy Software Products.
7 // These coded instructions, statements, and computer programs are the
8 // property of Apple Inc. and are protected by Federal copyright
9 // law. Distribution and use rights are outlined in the file "LICENSE.txt"
10 // which should have been included with this file. If this file is
11 // file is missing or damaged, see the license at "http://www.cups.org/".
15 // Include necessary headers...
18 #include "ppdc-private.h"
22 // 'ppdcFile::ppdcFile()' - Create (open) a file.
25 ppdcFile::ppdcFile(const char *f
, // I - File to open
26 cups_file_t
*ffp
) // I - File pointer to use
34 fp
= cupsFileOpen(f
, "r");
36 close_on_delete
= !ffp
;
41 _cupsLangPrintf(stderr
, _("ppdc: Unable to open %s: %s"), f
,
47 // 'ppdcFile::~ppdcFile()' - Delete (close) a file.
52 if (close_on_delete
&& fp
)
58 // 'ppdcFile::get()' - Get a character from a file.
64 int ch
; // Character from file
67 // Return EOF if there is no open file...
71 // Get the character...
72 ch
= cupsFileGetChar(fp
);
74 // Update the line number as needed...
78 // Return the character...
84 // 'ppdcFile::peek()' - Look at the next character from a file.
87 int // O - Next character in file
90 // Return immediaely if there is no open file...
94 // Otherwise return the next character without advancing...
95 return (cupsFilePeekChar(fp
));