]>
Commit | Line | Data |
---|---|---|
6afde7ae | 1 | /* |
214cfbc0 | 2 | * "$Id: file.h,v 1.5 2004/08/23 18:00:59 mike Exp $" |
6afde7ae | 3 | * |
4 | * File definitions for the Common UNIX Printing System (CUPS). | |
5 | * | |
6 | * Since stdio files max out at 256 files on many systems, we have to | |
7 | * write similar functions without this limit. At the same time, using | |
8 | * our own file functions allows us to provide transparent support of | |
9 | * gzip'd print files, PPD files, etc. | |
10 | * | |
71649dc9 | 11 | * Copyright 1997-2004 by Easy Software Products, all rights reserved. |
6afde7ae | 12 | * |
13 | * These coded instructions, statements, and computer programs are the | |
14 | * property of Easy Software Products and are protected by Federal | |
15 | * copyright law. Distribution and use rights are outlined in the file | |
16 | * "LICENSE.txt" which should have been included with this file. If this | |
17 | * file is missing or damaged please contact Easy Software Products | |
18 | * at: | |
19 | * | |
20 | * Attn: CUPS Licensing Information | |
21 | * Easy Software Products | |
22 | * 44141 Airport View Drive, Suite 204 | |
214cfbc0 | 23 | * Hollywood, Maryland 20636 USA |
6afde7ae | 24 | * |
214cfbc0 | 25 | * Voice: (301) 373-9600 |
6afde7ae | 26 | * EMail: cups-info@cups.org |
27 | * WWW: http://www.cups.org | |
28 | */ | |
29 | ||
30 | #ifndef _CUPS_FILE_H | |
31 | # define _CUPS_FILE_H_ | |
32 | ||
33 | /* | |
34 | * Include necessary headers... | |
35 | */ | |
36 | ||
37 | # ifdef HAVE_LIBZ | |
38 | # include <zlib.h> | |
39 | # endif /* HAVE_LIBZ */ | |
40 | ||
41 | ||
42 | /* | |
43 | * C++ magic... | |
44 | */ | |
45 | ||
46 | # ifdef _cplusplus | |
47 | extern "C" { | |
48 | # endif /* _cplusplus */ | |
49 | ||
50 | ||
81e0e1f0 | 51 | /* |
52 | * CUPS file definitions... | |
53 | */ | |
54 | ||
55 | # define CUPS_FILE_NONE 0 /* No compression */ | |
56 | # define CUPS_FILE_GZIP 1 /* GZIP compression */ | |
57 | ||
58 | ||
6afde7ae | 59 | /* |
60 | * CUPS file structure... | |
61 | */ | |
62 | ||
63 | typedef struct | |
64 | { | |
65 | int fd; /* File descriptor */ | |
66 | char mode, /* Mode ('r' or 'w') */ | |
67 | compressed, /* Compression used? */ | |
68 | buf[2048], /* Buffer */ | |
69 | *ptr, /* Pointer into buffer */ | |
70 | *end; /* End of buffer data */ | |
71 | int pos; /* File position for start of buffer */ | |
72 | ||
73 | # ifdef HAVE_LIBZ | |
74 | z_stream stream; /* Decompression stream */ | |
75 | int eof; /* End of file? */ | |
76 | unsigned char cbuf[1024]; /* Decompression buffer */ | |
77 | # endif /* HAVE_LIBZ */ | |
78 | } cups_file_t; | |
79 | ||
80 | ||
81 | /* | |
82 | * Prototypes... | |
83 | */ | |
84 | ||
85 | extern int cupsFileClose(cups_file_t *fp); | |
81e0e1f0 | 86 | #define cupsFileCompression(fp) (fp)->compressed |
75e7fa9c | 87 | extern int cupsFileFlush(cups_file_t *fp); |
6afde7ae | 88 | extern int cupsFileGetChar(cups_file_t *fp); |
89 | extern char *cupsFileGets(cups_file_t *fp, char *buf, int buflen); | |
75e7fa9c | 90 | #define cupsFileNumber(fp) (fp)->fd |
6afde7ae | 91 | extern cups_file_t *cupsFileOpen(const char *filename, const char *mode); |
92 | extern int cupsFilePrintf(cups_file_t *fp, const char *format, ...); | |
75e7fa9c | 93 | extern int cupsFilePutChar(cups_file_t *fp, int c); |
6afde7ae | 94 | extern int cupsFilePuts(cups_file_t *fp, const char *s); |
95 | extern int cupsFileRead(cups_file_t *fp, char *buf, int bytes); | |
96 | extern int cupsFileSeek(cups_file_t *fp, int pos); | |
75e7fa9c | 97 | #define cupsFileTell(fp) (fp)->pos |
98 | extern int cupsFileWrite(cups_file_t *fp, const char *buf, int bytes); | |
6afde7ae | 99 | |
100 | ||
101 | # ifdef _cplusplus | |
102 | } | |
103 | # endif /* _cplusplus */ | |
104 | #endif /* !_CUPS_FILE_H_ */ | |
105 | ||
106 | /* | |
214cfbc0 | 107 | * End of "$Id: file.h,v 1.5 2004/08/23 18:00:59 mike Exp $". |
6afde7ae | 108 | */ |