]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/file.h
License change: Apache License, Version 2.0.
[thirdparty/cups.git] / cups / file.h
CommitLineData
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... */
29typedef 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 38extern "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
54typedef struct _cups_file_s cups_file_t;/**** CUPS file type ****/
55
56
57/*
58 * Prototypes...
59 */
60
2fb76298
MS
61extern int cupsFileClose(cups_file_t *fp) _CUPS_API_1_2;
62extern int cupsFileCompression(cups_file_t *fp) _CUPS_API_1_2;
63extern int cupsFileEOF(cups_file_t *fp) _CUPS_API_1_2;
fa73b229 64extern const char *cupsFileFind(const char *filename, const char *path,
4400e98d 65 int executable, char *buffer,
2fb76298
MS
66 int bufsize) _CUPS_API_1_2;
67extern int cupsFileFlush(cups_file_t *fp) _CUPS_API_1_2;
68extern int cupsFileGetChar(cups_file_t *fp) _CUPS_API_1_2;
85dda01c
MS
69extern char *cupsFileGetConf(cups_file_t *fp, char *buf,
70 size_t buflen, char **value,
71 int *linenum) _CUPS_API_1_2;
80ca4592 72extern size_t cupsFileGetLine(cups_file_t *fp, char *buf,
2fb76298 73 size_t buflen) _CUPS_API_1_2;
85dda01c
MS
74extern char *cupsFileGets(cups_file_t *fp, char *buf, size_t buflen)
75 _CUPS_API_1_2;
2fb76298
MS
76extern int cupsFileLock(cups_file_t *fp, int block) _CUPS_API_1_2;
77extern int cupsFileNumber(cups_file_t *fp) _CUPS_API_1_2;
85dda01c
MS
78extern cups_file_t *cupsFileOpen(const char *filename, const char *mode)
79 _CUPS_API_1_2;
2fb76298
MS
80extern cups_file_t *cupsFileOpenFd(int fd, const char *mode) _CUPS_API_1_2;
81extern int cupsFilePeekChar(cups_file_t *fp) _CUPS_API_1_2;
ae71f5de 82extern int cupsFilePrintf(cups_file_t *fp, const char *format, ...)
85dda01c
MS
83 __attribute__((__format__ (__printf__, 2, 3)))
84 _CUPS_API_1_2;
2fb76298 85extern int cupsFilePutChar(cups_file_t *fp, int c) _CUPS_API_1_2;
58dc1933
MS
86extern ssize_t cupsFilePutConf(cups_file_t *fp, const char *directive,
87 const char *value) _CUPS_API_1_4;
85dda01c
MS
88extern int cupsFilePuts(cups_file_t *fp, const char *s)
89 _CUPS_API_1_2;
90extern ssize_t cupsFileRead(cups_file_t *fp, char *buf, size_t bytes)
91 _CUPS_API_1_2;
2fb76298
MS
92extern off_t cupsFileRewind(cups_file_t *fp) _CUPS_API_1_2;
93extern off_t cupsFileSeek(cups_file_t *fp, off_t pos) _CUPS_API_1_2;
94extern cups_file_t *cupsFileStderr(void) _CUPS_API_1_2;
95extern cups_file_t *cupsFileStdin(void) _CUPS_API_1_2;
96extern cups_file_t *cupsFileStdout(void) _CUPS_API_1_2;
97extern off_t cupsFileTell(cups_file_t *fp) _CUPS_API_1_2;
98extern int cupsFileUnlock(cups_file_t *fp) _CUPS_API_1_2;
85dda01c
MS
99extern 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_ */