comparison mupdf-source/thirdparty/extract/src/sys.h @ 3:2c135c81b16c

MERGE: upstream PyMuPDF 1.26.4 with MuPDF 1.26.7
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:44:09 +0200
parents b50eed0cc0ef
children
comparison
equal deleted inserted replaced
0:6015a75abc2d 3:2c135c81b16c
1 #ifndef EXTRACT_SYS_H
2 #define EXTRACT_SYS_H
3
4 #include "extract/alloc.h"
5
6 #include <stdio.h>
7
8
9 int extract_systemf(extract_alloc_t* alloc, const char* format, ...);
10 /* Like system() but takes printf-style format and args. Also, if we return +ve
11 we set errno to EIO.
12
13 On iOS we always -1:ENOTSUP because the system() function is not available. */
14
15 int extract_read_all(extract_alloc_t* alloc, FILE* in, char** o_out);
16 /* Reads until eof into zero-terminated malloc'd buffer. */
17
18 int extract_read_all_path(extract_alloc_t* alloc, const char* path, char** o_text);
19 /* Reads entire file into zero-terminated malloc'd buffer. */
20
21 int extract_write_all(const void* data, size_t data_size, const char* path);
22
23 int extract_check_path_shell_safe(const char* path);
24 /* Returns -1 with errno=EINVAL if <path> contains sequences that could make it
25 unsafe in shell commands. */
26
27 int extract_remove_directory(extract_alloc_t* alloc, const char* path);
28 /* Internally calls extract_systemf(); returns error if
29 extract_check_path_shell_safe(path) returns an error, but this is probably not
30 to be relied on. */
31
32 int extract_mkdir(const char* path, int mode);
33 /* Compatibility wrapper to cope on Windows. */
34
35 #endif