]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
6539a0af | 2 | * Public file definitions for CUPS. |
ef416fc2 | 3 | * |
6539a0af MS |
4 | * Since stdio files max out at 256 files on many systems, we have to |
5 | * write similar functions without this limit. At the same time, using | |
6 | * our own file functions allows us to provide transparent support of | |
2a75f21b | 7 | * different line endings, gzip'd print files, PPD files, etc. |
ef416fc2 | 8 | * |
2a75f21b | 9 | * Copyright 2007-2017 by Apple Inc. |
6539a0af | 10 | * Copyright 1997-2007 by Easy Software Products, all rights reserved. |
ef416fc2 | 11 | * |
e3101897 | 12 | * Licensed under Apache License v2.0. See the file "LICENSE" for more information. |
ef416fc2 | 13 | */ |
14 | ||
15 | #ifndef _CUPS_FILE_H_ | |
16 | # define _CUPS_FILE_H_ | |
17 | ||
18 | ||
19 | /* | |
20 | * Include necessary headers... | |
21 | */ | |
22 | ||
2fb76298 | 23 | # include "versioning.h" |
39ff2fe7 | 24 | # include <stddef.h> |
ef416fc2 | 25 | # include <sys/types.h> |
b86bc4cf | 26 | # if defined(WIN32) && !defined(__CUPS_SSIZE_T_DEFINED) |
27 | # define __CUPS_SSIZE_T_DEFINED | |
ef416fc2 | 28 | /* Windows does not support the ssize_t type, so map it to off_t... */ |
29 | typedef off_t ssize_t; /* @private@ */ | |
b86bc4cf | 30 | # endif /* WIN32 && !__CUPS_SSIZE_T_DEFINED */ |
ef416fc2 | 31 | |
32 | ||
33 | /* | |
34 | * C++ magic... | |
35 | */ | |
36 | ||
d09495fa | 37 | # ifdef __cplusplus |
ef416fc2 | 38 | extern "C" { |
d09495fa | 39 | # endif /* __cplusplus */ |
ef416fc2 | 40 | |
41 | ||
42 | /* | |
43 | * CUPS file definitions... | |
44 | */ | |
45 | ||
46 | # define CUPS_FILE_NONE 0 /* No compression */ | |
47 | # define CUPS_FILE_GZIP 1 /* GZIP compression */ | |
48 | ||
49 | ||
50 | /* | |
51 | * Types and structures... | |
52 | */ | |
53 | ||
54 | typedef struct _cups_file_s cups_file_t;/**** CUPS file type ****/ | |
55 | ||
56 | ||
57 | /* | |
58 | * Prototypes... | |
59 | */ | |
60 | ||
2fb76298 MS |
61 | extern int cupsFileClose(cups_file_t *fp) _CUPS_API_1_2; |
62 | extern int cupsFileCompression(cups_file_t *fp) _CUPS_API_1_2; | |
63 | extern int cupsFileEOF(cups_file_t *fp) _CUPS_API_1_2; | |
fa73b229 | 64 | extern const char *cupsFileFind(const char *filename, const char *path, |
4400e98d | 65 | int executable, char *buffer, |
2fb76298 MS |
66 | int bufsize) _CUPS_API_1_2; |
67 | extern int cupsFileFlush(cups_file_t *fp) _CUPS_API_1_2; | |
68 | extern int cupsFileGetChar(cups_file_t *fp) _CUPS_API_1_2; | |
85dda01c MS |
69 | extern char *cupsFileGetConf(cups_file_t *fp, char *buf, |
70 | size_t buflen, char **value, | |
71 | int *linenum) _CUPS_API_1_2; | |
80ca4592 | 72 | extern size_t cupsFileGetLine(cups_file_t *fp, char *buf, |
2fb76298 | 73 | size_t buflen) _CUPS_API_1_2; |
85dda01c MS |
74 | extern char *cupsFileGets(cups_file_t *fp, char *buf, size_t buflen) |
75 | _CUPS_API_1_2; | |
2fb76298 MS |
76 | extern int cupsFileLock(cups_file_t *fp, int block) _CUPS_API_1_2; |
77 | extern int cupsFileNumber(cups_file_t *fp) _CUPS_API_1_2; | |
85dda01c MS |
78 | extern cups_file_t *cupsFileOpen(const char *filename, const char *mode) |
79 | _CUPS_API_1_2; | |
2fb76298 MS |
80 | extern cups_file_t *cupsFileOpenFd(int fd, const char *mode) _CUPS_API_1_2; |
81 | extern int cupsFilePeekChar(cups_file_t *fp) _CUPS_API_1_2; | |
ae71f5de | 82 | extern int cupsFilePrintf(cups_file_t *fp, const char *format, ...) |
85dda01c MS |
83 | __attribute__((__format__ (__printf__, 2, 3))) |
84 | _CUPS_API_1_2; | |
2fb76298 | 85 | extern int cupsFilePutChar(cups_file_t *fp, int c) _CUPS_API_1_2; |
58dc1933 MS |
86 | extern ssize_t cupsFilePutConf(cups_file_t *fp, const char *directive, |
87 | const char *value) _CUPS_API_1_4; | |
85dda01c MS |
88 | extern int cupsFilePuts(cups_file_t *fp, const char *s) |
89 | _CUPS_API_1_2; | |
90 | extern ssize_t cupsFileRead(cups_file_t *fp, char *buf, size_t bytes) | |
91 | _CUPS_API_1_2; | |
2fb76298 MS |
92 | extern off_t cupsFileRewind(cups_file_t *fp) _CUPS_API_1_2; |
93 | extern off_t cupsFileSeek(cups_file_t *fp, off_t pos) _CUPS_API_1_2; | |
94 | extern cups_file_t *cupsFileStderr(void) _CUPS_API_1_2; | |
95 | extern cups_file_t *cupsFileStdin(void) _CUPS_API_1_2; | |
96 | extern cups_file_t *cupsFileStdout(void) _CUPS_API_1_2; | |
97 | extern off_t cupsFileTell(cups_file_t *fp) _CUPS_API_1_2; | |
98 | extern int cupsFileUnlock(cups_file_t *fp) _CUPS_API_1_2; | |
85dda01c MS |
99 | extern ssize_t cupsFileWrite(cups_file_t *fp, const char *buf, |
100 | size_t bytes) _CUPS_API_1_2; | |
ef416fc2 | 101 | |
102 | ||
d09495fa | 103 | # ifdef __cplusplus |
ef416fc2 | 104 | } |
d09495fa | 105 | # endif /* __cplusplus */ |
ef416fc2 | 106 | #endif /* !_CUPS_FILE_H_ */ |