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