]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
f2d18633 | 2 | * "$Id$" |
ef416fc2 | 3 | * |
6539a0af | 4 | * Public file definitions for CUPS. |
ef416fc2 | 5 | * |
6539a0af MS |
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. | |
ef416fc2 | 10 | * |
6539a0af MS |
11 | * Copyright 2007-2014 by Apple Inc. |
12 | * Copyright 1997-2007 by Easy Software Products, all rights reserved. | |
ef416fc2 | 13 | * |
6539a0af MS |
14 | * These coded instructions, statements, and computer programs are the |
15 | * property of Apple Inc. and are protected by Federal copyright | |
16 | * law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
17 | * which should have been included with this file. If this file is | |
18 | * file is missing or damaged, see the license at "http://www.cups.org/". | |
19 | * | |
20 | * This file is subject to the Apple OS-Developed Software exception. | |
ef416fc2 | 21 | */ |
22 | ||
23 | #ifndef _CUPS_FILE_H_ | |
24 | # define _CUPS_FILE_H_ | |
25 | ||
26 | ||
27 | /* | |
28 | * Include necessary headers... | |
29 | */ | |
30 | ||
2fb76298 | 31 | # include "versioning.h" |
39ff2fe7 | 32 | # include <stddef.h> |
ef416fc2 | 33 | # include <sys/types.h> |
b86bc4cf | 34 | # if defined(WIN32) && !defined(__CUPS_SSIZE_T_DEFINED) |
35 | # define __CUPS_SSIZE_T_DEFINED | |
ef416fc2 | 36 | /* Windows does not support the ssize_t type, so map it to off_t... */ |
37 | typedef off_t ssize_t; /* @private@ */ | |
b86bc4cf | 38 | # endif /* WIN32 && !__CUPS_SSIZE_T_DEFINED */ |
ef416fc2 | 39 | |
40 | ||
41 | /* | |
42 | * C++ magic... | |
43 | */ | |
44 | ||
d09495fa | 45 | # ifdef __cplusplus |
ef416fc2 | 46 | extern "C" { |
d09495fa | 47 | # endif /* __cplusplus */ |
ef416fc2 | 48 | |
49 | ||
50 | /* | |
51 | * CUPS file definitions... | |
52 | */ | |
53 | ||
54 | # define CUPS_FILE_NONE 0 /* No compression */ | |
55 | # define CUPS_FILE_GZIP 1 /* GZIP compression */ | |
56 | ||
57 | ||
58 | /* | |
59 | * Types and structures... | |
60 | */ | |
61 | ||
62 | typedef struct _cups_file_s cups_file_t;/**** CUPS file type ****/ | |
63 | ||
64 | ||
65 | /* | |
66 | * Prototypes... | |
67 | */ | |
68 | ||
2fb76298 MS |
69 | extern int cupsFileClose(cups_file_t *fp) _CUPS_API_1_2; |
70 | extern int cupsFileCompression(cups_file_t *fp) _CUPS_API_1_2; | |
71 | extern int cupsFileEOF(cups_file_t *fp) _CUPS_API_1_2; | |
fa73b229 | 72 | extern const char *cupsFileFind(const char *filename, const char *path, |
4400e98d | 73 | int executable, char *buffer, |
2fb76298 MS |
74 | int bufsize) _CUPS_API_1_2; |
75 | extern int cupsFileFlush(cups_file_t *fp) _CUPS_API_1_2; | |
76 | extern int cupsFileGetChar(cups_file_t *fp) _CUPS_API_1_2; | |
85dda01c MS |
77 | extern char *cupsFileGetConf(cups_file_t *fp, char *buf, |
78 | size_t buflen, char **value, | |
79 | int *linenum) _CUPS_API_1_2; | |
80ca4592 | 80 | extern size_t cupsFileGetLine(cups_file_t *fp, char *buf, |
2fb76298 | 81 | size_t buflen) _CUPS_API_1_2; |
85dda01c MS |
82 | extern char *cupsFileGets(cups_file_t *fp, char *buf, size_t buflen) |
83 | _CUPS_API_1_2; | |
2fb76298 MS |
84 | extern int cupsFileLock(cups_file_t *fp, int block) _CUPS_API_1_2; |
85 | extern int cupsFileNumber(cups_file_t *fp) _CUPS_API_1_2; | |
85dda01c MS |
86 | extern cups_file_t *cupsFileOpen(const char *filename, const char *mode) |
87 | _CUPS_API_1_2; | |
2fb76298 MS |
88 | extern cups_file_t *cupsFileOpenFd(int fd, const char *mode) _CUPS_API_1_2; |
89 | extern int cupsFilePeekChar(cups_file_t *fp) _CUPS_API_1_2; | |
ae71f5de | 90 | extern int cupsFilePrintf(cups_file_t *fp, const char *format, ...) |
85dda01c MS |
91 | __attribute__((__format__ (__printf__, 2, 3))) |
92 | _CUPS_API_1_2; | |
2fb76298 | 93 | extern int cupsFilePutChar(cups_file_t *fp, int c) _CUPS_API_1_2; |
58dc1933 MS |
94 | extern ssize_t cupsFilePutConf(cups_file_t *fp, const char *directive, |
95 | const char *value) _CUPS_API_1_4; | |
85dda01c MS |
96 | extern int cupsFilePuts(cups_file_t *fp, const char *s) |
97 | _CUPS_API_1_2; | |
98 | extern ssize_t cupsFileRead(cups_file_t *fp, char *buf, size_t bytes) | |
99 | _CUPS_API_1_2; | |
2fb76298 MS |
100 | extern off_t cupsFileRewind(cups_file_t *fp) _CUPS_API_1_2; |
101 | extern off_t cupsFileSeek(cups_file_t *fp, off_t pos) _CUPS_API_1_2; | |
102 | extern cups_file_t *cupsFileStderr(void) _CUPS_API_1_2; | |
103 | extern cups_file_t *cupsFileStdin(void) _CUPS_API_1_2; | |
104 | extern cups_file_t *cupsFileStdout(void) _CUPS_API_1_2; | |
105 | extern off_t cupsFileTell(cups_file_t *fp) _CUPS_API_1_2; | |
106 | extern int cupsFileUnlock(cups_file_t *fp) _CUPS_API_1_2; | |
85dda01c MS |
107 | extern ssize_t cupsFileWrite(cups_file_t *fp, const char *buf, |
108 | size_t bytes) _CUPS_API_1_2; | |
ef416fc2 | 109 | |
110 | ||
d09495fa | 111 | # ifdef __cplusplus |
ef416fc2 | 112 | } |
d09495fa | 113 | # endif /* __cplusplus */ |
ef416fc2 | 114 | #endif /* !_CUPS_FILE_H_ */ |
115 | ||
116 | /* | |
f2d18633 | 117 | * End of "$Id$". |
ef416fc2 | 118 | */ |