]>
git.ipfire.org Git - thirdparty/cups.git/blob - ppdc/ppdc-file.cxx
4 // File class for the CUPS PPD Compiler.
6 // Copyright 2007 by Apple Inc.
7 // Copyright 2002-2005 by Easy Software Products.
9 // These coded instructions, statements, and computer programs are the
10 // property of Apple Inc. and are protected by Federal copyright
11 // law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 // which should have been included with this file. If this file is
13 // file is missing or damaged, see the license at "http://www.cups.org/".
17 // ppdcFile::ppdcFile() - Create (open) a file.
18 // ppdcFile::~ppdcFile() - Delete (close) a file.
19 // ppdcFile::get() - Get a character from a file.
20 // ppdcFile::peek() - Look at the next character from a file.
24 // Include necessary headers...
31 // 'ppdcFile::ppdcFile()' - Create (open) a file.
34 ppdcFile::ppdcFile(const char *f
) // I - File to open
36 fp
= cupsFileOpen(f
, "r");
41 fprintf(stderr
, "ppdc: Unable to open %s: %s\n", f
, strerror(errno
));
46 // 'ppdcFile::~ppdcFile()' - Delete (close) a file.
57 // 'ppdcFile::get()' - Get a character from a file.
63 int ch
; // Character from file
66 // Return EOF if there is no open file...
70 // Get the character...
71 ch
= cupsFileGetChar(fp
);
73 // Update the line number as needed...
77 // Return the character...
83 // 'ppdcFile::peek()' - Look at the next character from a file.
86 int // O - Next character in file
89 // Return immediaely if there is no open file...
93 // Otherwise return the next character without advancing...
94 return (cupsFilePeekChar(fp
));