]>
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 // Licensed under Apache License v2.0. See the file "LICENSE" for more information.
11 // Include necessary headers...
14 #include "ppdc-private.h"
18 // 'ppdcFile::ppdcFile()' - Create (open) a file.
21 ppdcFile::ppdcFile(const char *f
, // I - File to open
22 cups_file_t
*ffp
) // I - File pointer to use
30 fp
= cupsFileOpen(f
, "r");
32 close_on_delete
= !ffp
;
37 _cupsLangPrintf(stderr
, _("ppdc: Unable to open %s: %s"), f
,
43 // 'ppdcFile::~ppdcFile()' - Delete (close) a file.
48 if (close_on_delete
&& fp
)
54 // 'ppdcFile::get()' - Get a character from a file.
60 int ch
; // Character from file
63 // Return EOF if there is no open file...
67 // Get the character...
68 ch
= cupsFileGetChar(fp
);
70 // Update the line number as needed...
74 // Return the character...
80 // 'ppdcFile::peek()' - Look at the next character from a file.
83 int // O - Next character in file
86 // Return immediaely if there is no open file...
90 // Otherwise return the next character without advancing...
91 return (cupsFilePeekChar(fp
));