]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/file.h
Greatly simplify the man page handling.
[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 *
be3b49a3
MS
9 * Copyright © 2007-2018 by Apple Inc.
10 * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 11 *
be3b49a3
MS
12 * Licensed under Apache License v2.0. See the file "LICENSE" for more
13 * information.
ef416fc2 14 */
15
16#ifndef _CUPS_FILE_H_
17# define _CUPS_FILE_H_
18
19
20/*
21 * Include necessary headers...
22 */
23
2fb76298 24# include "versioning.h"
39ff2fe7 25# include <stddef.h>
ef416fc2 26# include <sys/types.h>
19dc16f7 27# if defined(_WIN32) && !defined(__CUPS_SSIZE_T_DEFINED)
b86bc4cf 28# define __CUPS_SSIZE_T_DEFINED
ef416fc2 29/* Windows does not support the ssize_t type, so map it to off_t... */
30typedef off_t ssize_t; /* @private@ */
19dc16f7 31# endif /* _WIN32 && !__CUPS_SSIZE_T_DEFINED */
ef416fc2 32
33
34/*
35 * C++ magic...
36 */
37
d09495fa 38# ifdef __cplusplus
ef416fc2 39extern "C" {
d09495fa 40# endif /* __cplusplus */
ef416fc2 41
42
43/*
44 * CUPS file definitions...
45 */
46
47# define CUPS_FILE_NONE 0 /* No compression */
48# define CUPS_FILE_GZIP 1 /* GZIP compression */
49
50
51/*
52 * Types and structures...
53 */
54
55typedef struct _cups_file_s cups_file_t;/**** CUPS file type ****/
56
57
58/*
59 * Prototypes...
60 */
61
2fb76298
MS
62extern int cupsFileClose(cups_file_t *fp) _CUPS_API_1_2;
63extern int cupsFileCompression(cups_file_t *fp) _CUPS_API_1_2;
64extern int cupsFileEOF(cups_file_t *fp) _CUPS_API_1_2;
be3b49a3 65extern const char *cupsFileFind(const char *filename, const char *path, int executable, char *buffer, int bufsize) _CUPS_API_1_2;
2fb76298
MS
66extern int cupsFileFlush(cups_file_t *fp) _CUPS_API_1_2;
67extern int cupsFileGetChar(cups_file_t *fp) _CUPS_API_1_2;
be3b49a3
MS
68extern char *cupsFileGetConf(cups_file_t *fp, char *buf, size_t buflen, char **value, int *linenum) _CUPS_API_1_2;
69extern size_t cupsFileGetLine(cups_file_t *fp, char *buf, size_t buflen) _CUPS_API_1_2;
70extern char *cupsFileGets(cups_file_t *fp, char *buf, size_t buflen) _CUPS_API_1_2;
2fb76298
MS
71extern int cupsFileLock(cups_file_t *fp, int block) _CUPS_API_1_2;
72extern int cupsFileNumber(cups_file_t *fp) _CUPS_API_1_2;
be3b49a3 73extern cups_file_t *cupsFileOpen(const char *filename, const char *mode) _CUPS_API_1_2;
2fb76298
MS
74extern cups_file_t *cupsFileOpenFd(int fd, const char *mode) _CUPS_API_1_2;
75extern int cupsFilePeekChar(cups_file_t *fp) _CUPS_API_1_2;
be3b49a3 76extern int cupsFilePrintf(cups_file_t *fp, const char *format, ...) _CUPS_FORMAT(2, 3) _CUPS_API_1_2;
2fb76298 77extern int cupsFilePutChar(cups_file_t *fp, int c) _CUPS_API_1_2;
be3b49a3
MS
78extern ssize_t cupsFilePutConf(cups_file_t *fp, const char *directive, const char *value) _CUPS_API_1_4;
79extern int cupsFilePuts(cups_file_t *fp, const char *s) _CUPS_API_1_2;
80extern ssize_t cupsFileRead(cups_file_t *fp, char *buf, size_t bytes) _CUPS_API_1_2;
2fb76298
MS
81extern off_t cupsFileRewind(cups_file_t *fp) _CUPS_API_1_2;
82extern off_t cupsFileSeek(cups_file_t *fp, off_t pos) _CUPS_API_1_2;
83extern cups_file_t *cupsFileStderr(void) _CUPS_API_1_2;
84extern cups_file_t *cupsFileStdin(void) _CUPS_API_1_2;
85extern cups_file_t *cupsFileStdout(void) _CUPS_API_1_2;
86extern off_t cupsFileTell(cups_file_t *fp) _CUPS_API_1_2;
87extern int cupsFileUnlock(cups_file_t *fp) _CUPS_API_1_2;
be3b49a3 88extern ssize_t cupsFileWrite(cups_file_t *fp, const char *buf, size_t bytes) _CUPS_API_1_2;
ef416fc2 89
90
d09495fa 91# ifdef __cplusplus
ef416fc2 92}
d09495fa 93# endif /* __cplusplus */
ef416fc2 94#endif /* !_CUPS_FILE_H_ */