]>
Commit | Line | Data |
---|---|---|
b9faaae1 | 1 | /* |
6539a0af | 2 | * Private file definitions for CUPS. |
b9faaae1 | 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. |
b9faaae1 | 8 | * |
5a855d85 MS |
9 | * Copyright © 2007-2018 by Apple Inc. |
10 | * Copyright © 1997-2007 by Easy Software Products, all rights reserved. | |
b9faaae1 | 11 | * |
5a855d85 MS |
12 | * Licensed under Apache License v2.0. See the file "LICENSE" for more |
13 | * information. | |
b9faaae1 MS |
14 | */ |
15 | ||
16 | #ifndef _CUPS_FILE_PRIVATE_H_ | |
17 | # define _CUPS_FILE_PRIVATE_H_ | |
18 | ||
19 | /* | |
20 | * Include necessary headers... | |
21 | */ | |
22 | ||
71e16022 | 23 | # include "cups-private.h" |
b9faaae1 MS |
24 | # include <stdio.h> |
25 | # include <stdlib.h> | |
26 | # include <stdarg.h> | |
b9faaae1 | 27 | # include <fcntl.h> |
b9faaae1 | 28 | |
19dc16f7 | 29 | # ifdef _WIN32 |
b9faaae1 MS |
30 | # include <io.h> |
31 | # include <sys/locking.h> | |
19dc16f7 | 32 | # endif /* _WIN32 */ |
b9faaae1 MS |
33 | |
34 | ||
35 | /* | |
36 | * Some operating systems support large files via open flag O_LARGEFILE... | |
37 | */ | |
38 | ||
39 | # ifndef O_LARGEFILE | |
40 | # define O_LARGEFILE 0 | |
41 | # endif /* !O_LARGEFILE */ | |
42 | ||
43 | ||
44 | /* | |
45 | * Some operating systems don't define O_BINARY, which is used by Microsoft | |
46 | * and IBM to flag binary files... | |
47 | */ | |
48 | ||
49 | # ifndef O_BINARY | |
50 | # define O_BINARY 0 | |
51 | # endif /* !O_BINARY */ | |
52 | ||
53 | ||
22c9029b MS |
54 | # ifdef __cplusplus |
55 | extern "C" { | |
56 | # endif /* __cplusplus */ | |
57 | ||
58 | ||
b9faaae1 MS |
59 | /* |
60 | * Types and structures... | |
61 | */ | |
62 | ||
22c9029b MS |
63 | typedef enum /**** _cupsFileCheck return values ****/ |
64 | { | |
65 | _CUPS_FILE_CHECK_OK = 0, /* Everything OK */ | |
66 | _CUPS_FILE_CHECK_MISSING = 1, /* File is missing */ | |
67 | _CUPS_FILE_CHECK_PERMISSIONS = 2, /* File (or parent dir) has bad perms */ | |
88f9aafc MS |
68 | _CUPS_FILE_CHECK_WRONG_TYPE = 3, /* File has wrong type */ |
69 | _CUPS_FILE_CHECK_RELATIVE_PATH = 4 /* File contains a relative path */ | |
22c9029b MS |
70 | } _cups_fc_result_t; |
71 | ||
72 | typedef enum /**** _cupsFileCheck file type values ****/ | |
73 | { | |
74 | _CUPS_FILE_CHECK_FILE = 0, /* Check the file and parent directory */ | |
75 | _CUPS_FILE_CHECK_PROGRAM = 1, /* Check the program and parent directory */ | |
76 | _CUPS_FILE_CHECK_FILE_ONLY = 2, /* Check the file only */ | |
77 | _CUPS_FILE_CHECK_DIRECTORY = 3 /* Check the directory */ | |
78 | } _cups_fc_filetype_t; | |
79 | ||
80 | typedef void (*_cups_fc_func_t)(void *context, _cups_fc_result_t result, | |
81 | const char *message); | |
82 | ||
22c9029b MS |
83 | /* |
84 | * Prototypes... | |
85 | */ | |
86 | ||
5a855d85 MS |
87 | extern _cups_fc_result_t _cupsFileCheck(const char *filename, _cups_fc_filetype_t filetype, int dorootchecks, _cups_fc_func_t cb, void *context) _CUPS_PRIVATE; |
88 | extern void _cupsFileCheckFilter(void *context, _cups_fc_result_t result, const char *message) _CUPS_PRIVATE; | |
89 | extern int _cupsFilePeekAhead(cups_file_t *fp, int ch); | |
22c9029b MS |
90 | |
91 | # ifdef __cplusplus | |
92 | } | |
93 | # endif /* __cplusplus */ | |
94 | ||
b9faaae1 | 95 | #endif /* !_CUPS_FILE_PRIVATE_H_ */ |