]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * "$Id: file.h 7460 2008-04-16 02:19:54Z mike $" | |
3 | * | |
4 | * Public 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 | * | |
11 | * Copyright 2007-2008 by Apple Inc. | |
12 | * Copyright 1997-2007 by Easy Software Products, all rights reserved. | |
13 | * | |
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 | ||
21 | #ifndef _CUPS_FILE_H_ | |
22 | # define _CUPS_FILE_H_ | |
23 | ||
24 | ||
25 | /* | |
26 | * Include necessary headers... | |
27 | */ | |
28 | ||
29 | # include "versioning.h" | |
30 | # include <sys/types.h> | |
31 | # if defined(WIN32) && !defined(__CUPS_SSIZE_T_DEFINED) | |
32 | # define __CUPS_SSIZE_T_DEFINED | |
33 | /* Windows does not support the ssize_t type, so map it to off_t... */ | |
34 | typedef off_t ssize_t; /* @private@ */ | |
35 | # endif /* WIN32 && !__CUPS_SSIZE_T_DEFINED */ | |
36 | ||
37 | ||
38 | /* | |
39 | * C++ magic... | |
40 | */ | |
41 | ||
42 | # ifdef __cplusplus | |
43 | extern "C" { | |
44 | # endif /* __cplusplus */ | |
45 | ||
46 | ||
47 | /* | |
48 | * CUPS file definitions... | |
49 | */ | |
50 | ||
51 | # define CUPS_FILE_NONE 0 /* No compression */ | |
52 | # define CUPS_FILE_GZIP 1 /* GZIP compression */ | |
53 | ||
54 | ||
55 | /* | |
56 | * Types and structures... | |
57 | */ | |
58 | ||
59 | typedef struct _cups_file_s cups_file_t;/**** CUPS file type ****/ | |
60 | ||
61 | ||
62 | /* | |
63 | * Prototypes... | |
64 | */ | |
65 | ||
66 | extern int cupsFileClose(cups_file_t *fp) _CUPS_API_1_2; | |
67 | extern int cupsFileCompression(cups_file_t *fp) _CUPS_API_1_2; | |
68 | extern int cupsFileEOF(cups_file_t *fp) _CUPS_API_1_2; | |
69 | extern const char *cupsFileFind(const char *filename, const char *path, | |
70 | int executable, char *buffer, | |
71 | int bufsize) _CUPS_API_1_2; | |
72 | extern int cupsFileFlush(cups_file_t *fp) _CUPS_API_1_2; | |
73 | extern int cupsFileGetChar(cups_file_t *fp) _CUPS_API_1_2; | |
74 | extern char *cupsFileGetConf(cups_file_t *fp, char *buf, size_t buflen, | |
75 | char **value, int *linenum) _CUPS_API_1_2; | |
76 | extern size_t cupsFileGetLine(cups_file_t *fp, char *buf, | |
77 | size_t buflen) _CUPS_API_1_2; | |
78 | extern char *cupsFileGets(cups_file_t *fp, char *buf, size_t buflen) _CUPS_API_1_2; | |
79 | extern int cupsFileLock(cups_file_t *fp, int block) _CUPS_API_1_2; | |
80 | extern int cupsFileNumber(cups_file_t *fp) _CUPS_API_1_2; | |
81 | extern cups_file_t *cupsFileOpen(const char *filename, const char *mode) _CUPS_API_1_2; | |
82 | extern cups_file_t *cupsFileOpenFd(int fd, const char *mode) _CUPS_API_1_2; | |
83 | extern int cupsFilePeekChar(cups_file_t *fp) _CUPS_API_1_2; | |
84 | extern int cupsFilePrintf(cups_file_t *fp, const char *format, ...) | |
85 | #ifdef __GNUC__ | |
86 | __attribute__ ((__format__ (__printf__, 2, 3))) | |
87 | #endif /* __GNUC__ */ | |
88 | _CUPS_API_1_2; | |
89 | extern int cupsFilePutChar(cups_file_t *fp, int c) _CUPS_API_1_2; | |
90 | extern ssize_t cupsFilePutConf(cups_file_t *fp, const char *directive, | |
91 | const char *value) _CUPS_API_1_4; | |
92 | extern int cupsFilePuts(cups_file_t *fp, const char *s) _CUPS_API_1_2; | |
93 | extern ssize_t cupsFileRead(cups_file_t *fp, char *buf, size_t bytes) _CUPS_API_1_2; | |
94 | extern ssize_t cupsFileReady(cups_file_t *fp) _CUPS_API_1_4; | |
95 | extern off_t cupsFileRewind(cups_file_t *fp) _CUPS_API_1_2; | |
96 | extern off_t cupsFileSeek(cups_file_t *fp, off_t pos) _CUPS_API_1_2; | |
97 | extern cups_file_t *cupsFileStderr(void) _CUPS_API_1_2; | |
98 | extern cups_file_t *cupsFileStdin(void) _CUPS_API_1_2; | |
99 | extern cups_file_t *cupsFileStdout(void) _CUPS_API_1_2; | |
100 | extern off_t cupsFileTell(cups_file_t *fp) _CUPS_API_1_2; | |
101 | extern int cupsFileUnlock(cups_file_t *fp) _CUPS_API_1_2; | |
102 | extern ssize_t cupsFileWrite(cups_file_t *fp, const char *buf, size_t bytes) _CUPS_API_1_2; | |
103 | ||
104 | ||
105 | # ifdef __cplusplus | |
106 | } | |
107 | # endif /* __cplusplus */ | |
108 | #endif /* !_CUPS_FILE_H_ */ | |
109 | ||
110 | /* | |
111 | * End of "$Id: file.h 7460 2008-04-16 02:19:54Z mike $". | |
112 | */ |