1/*
2 * Public file definitions for CUPS.
3 *
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
7 * different line endings, gzip'd print files, PPD files, etc.
8 *
9 * Copyright © 2007-2018 by Apple Inc.
10 * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
11 *
12 * Licensed under Apache License v2.0. See the file "LICENSE" for more
13 * information.
14 */
15
16#ifndef _CUPS_FILE_H_
17# define _CUPS_FILE_H_
18
19
20/*
21 * Include necessary headers...
22 */
23
24# include "versioning.h"
25# include <stddef.h>
26# include <sys/types.h>
27# if defined(_WIN32) && !defined(__CUPS_SSIZE_T_DEFINED)
28# define __CUPS_SSIZE_T_DEFINED
29/* Windows does not support the ssize_t type, so map it to off_t... */
30typedef off_t ssize_t; /* @private@ */
31# endif /* _WIN32 && !__CUPS_SSIZE_T_DEFINED */
32
33
34/*
35 * C++ magic...
36 */
37
38# ifdef __cplusplus
39extern "C" {
40# endif /* __cplusplus */
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
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;
65extern const char *cupsFileFind(const char *filename, const char *path, int executable, char *buffer, int bufsize) _CUPS_API_1_2;
66extern int cupsFileFlush(cups_file_t *fp) _CUPS_API_1_2;
67extern int cupsFileGetChar(cups_file_t *fp) _CUPS_API_1_2;
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;
71extern int cupsFileLock(cups_file_t *fp, int block) _CUPS_API_1_2;
72extern int cupsFileNumber(cups_file_t *fp) _CUPS_API_1_2;
73extern cups_file_t *cupsFileOpen(const char *filename, const char *mode) _CUPS_API_1_2;
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;
76extern int cupsFilePrintf(cups_file_t *fp, const char *format, ...) _CUPS_FORMAT(2, 3) _CUPS_API_1_2;
77extern int cupsFilePutChar(cups_file_t *fp, int c) _CUPS_API_1_2;
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;
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;
88extern ssize_t cupsFileWrite(cups_file_t *fp, const char *buf, size_t bytes) _CUPS_API_1_2;
89
90
91# ifdef __cplusplus
92}
93# endif /* __cplusplus */
94#endif /* !_CUPS_FILE_H_ */
95

source code of include/cups/file.h