2 * Private file definitions for CUPS.
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.
9 * Copyright © 2007-2018 by Apple Inc.
10 * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
12 * Licensed under Apache License v2.0. See the file "LICENSE" for more
16 #ifndef _CUPS_FILE_PRIVATE_H_
17 # define _CUPS_FILE_PRIVATE_H_
20 * Include necessary headers...
23 # include "cups-private.h"
31 # include <sys/locking.h>
36 * Some operating systems support large files via open flag O_LARGEFILE...
40 # define O_LARGEFILE 0
41 # endif /* !O_LARGEFILE */
45 * Some operating systems don't define O_BINARY, which is used by Microsoft
46 * and IBM to flag binary files...
51 # endif /* !O_BINARY */
56 # endif /* __cplusplus */
60 * Types and structures...
63 typedef enum /**** _cupsFileCheck return values ****/
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 */
68 _CUPS_FILE_CHECK_WRONG_TYPE
= 3, /* File has wrong type */
69 _CUPS_FILE_CHECK_RELATIVE_PATH
= 4 /* File contains a relative path */
72 typedef enum /**** _cupsFileCheck file type values ****/
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
;
80 typedef void (*_cups_fc_func_t
)(void *context
, _cups_fc_result_t result
,
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
);
93 # endif /* __cplusplus */
95 #endif /* !_CUPS_FILE_PRIVATE_H_ */