1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#pragma once
#include <stdbool.h>
#include <stddef.h>
#ifndef ARRAY_SIZE
# define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif
struct PHYSFS_Stat;
struct physfs_serve {
int fd[16], nfds;
const char* (*content_type)(struct physfs_serve *serve, const char *path);
bool (*path_rewrite)(struct physfs_serve *serve, char buf[], const size_t bufsz, struct PHYSFS_Stat *st);
};
bool
physfs_serve_init(struct physfs_serve *serve, const unsigned int port, const char *addr);
bool
physfs_serve_event(struct physfs_serve *serve, const int index);
void
physfs_serve_free(struct physfs_serve *serve);
const char*
physfs_default_content_type(struct physfs_serve *serve, const char *path);
bool
physfs_default_path_rewrite(struct physfs_serve *serve, char buf[], const size_t bufsz, struct PHYSFS_Stat *st);
bool
physfs_ends_with(const char *str, const char *suf);
inline void
physfs_append(char buf[], const size_t bufsz, const char *str);
|