aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/toybox.h
diff options
context:
space:
mode:
authoronefang2020-03-16 14:49:09 +1000
committeronefang2020-03-16 14:49:09 +1000
commitf8574e0be89e7b523e64f656c93814d6948b2a33 (patch)
tree11bd44706c54b1441e890f685a5ed6e07e75777f /src/toybox.h
parentRevert "Bitch if we can't read the OpenSim config file." (diff)
downloadopensim-SC_OLD-f8574e0be89e7b523e64f656c93814d6948b2a33.zip
opensim-SC_OLD-f8574e0be89e7b523e64f656c93814d6948b2a33.tar.gz
opensim-SC_OLD-f8574e0be89e7b523e64f656c93814d6948b2a33.tar.bz2
opensim-SC_OLD-f8574e0be89e7b523e64f656c93814d6948b2a33.tar.xz
Revert "The new sledjchisl binary, to replace the management scripts and web stuff."
This reverts commit 34c5ee4c2a489a506e93d5b303fbc80b263747f0.
Diffstat (limited to '')
-rw-r--r--src/toybox.h278
1 files changed, 0 insertions, 278 deletions
diff --git a/src/toybox.h b/src/toybox.h
deleted file mode 100644
index 1f64310..0000000
--- a/src/toybox.h
+++ /dev/null
@@ -1,278 +0,0 @@
1
2#ifdef __GNUC__
3#define printf_format __attribute__((format(printf, 1, 2)))
4#else
5#define printf_format
6#endif
7
8// General posix-2008 headers
9#include <ctype.h>
10#include <dirent.h>
11#include <errno.h>
12#include <fcntl.h>
13#include <fnmatch.h>
14#include <grp.h>
15#include <inttypes.h>
16#include <limits.h>
17#include <math.h>
18#include <paths.h>
19#include <pwd.h>
20#include <regex.h>
21#include <sched.h>
22#include <setjmp.h>
23#include <signal.h>
24#include <stdarg.h>
25#include <stddef.h>
26#include <stdint.h>
27#include <stdio.h>
28#include <stdlib.h>
29#include <string.h>
30#include <strings.h>
31#include <sys/mman.h>
32#include <sys/resource.h>
33#include <sys/stat.h>
34#include <sys/statvfs.h>
35#include <sys/time.h>
36#include <sys/times.h>
37#include <sys/utsname.h>
38#include <sys/wait.h>
39#include <syslog.h>
40#include <termios.h>
41#include <time.h>
42#include <unistd.h>
43#include <utime.h>
44
45// Posix networking
46
47#include <arpa/inet.h>
48#include <netdb.h>
49#include <net/if.h>
50#include <netinet/in.h>
51#include <netinet/tcp.h>
52#include <poll.h>
53#include <sys/socket.h>
54#include <sys/un.h>
55
56// Linux headers not listed by POSIX or LSB
57#include <sys/mount.h>
58#ifdef __linux__
59#include <sys/statfs.h>
60#include <sys/swap.h>
61#include <sys/sysinfo.h>
62#endif
63
64#define WARN_ONLY (1<<31)
65
66// xwrap.c
67//void xstrncpy(char *dest, char *src, size_t size);
68//void xstrncat(char *dest, char *src, size_t size);
69void _xexit(void) __attribute__((__noreturn__));
70void xexit(void) __attribute__((__noreturn__));
71//void *xmmap(void *addr, size_t length, int prot, int flags, int fd, off_t off);
72void *xmalloc(size_t size);
73void *xzalloc(size_t size);
74void *xrealloc(void *ptr, size_t size);
75char *xstrndup(char *s, size_t n);
76char *xstrdup(char *s);
77void *xmemdup(void *s, long len);
78char *xmprintf(char *format, ...) printf_format;
79//void xprintf(char *format, ...) printf_format;
80//void xputsl(char *s, int len);
81//void xputsn(char *s);
82//void xputs(char *s);
83//void xputc(char c);
84void xflush(int flush);
85//void xexec(char **argv);
86//pid_t xpopen_setup(char **argv, int *pipes, void (*callback)(void));
87//pid_t xpopen_both(char **argv, int *pipes);
88//int xwaitpid(pid_t pid);
89//int xpclose_both(pid_t pid, int *pipes);
90//pid_t xpopen(char **argv, int *pipe, int isstdout);
91//pid_t xpclose(pid_t pid, int pipe);
92//int xrun(char **argv);
93//int xpspawn(char **argv, int*pipes);
94//void xaccess(char *path, int flags);
95//void xunlink(char *path);
96//void xrename(char *from, char *to);
97//int xtempfile(char *name, char **tempname);
98//int xcreate(char *path, int flags, int mode);
99int xopen(char *path, int flags);
100int xcreate_stdio(char *path, int flags, int mode);
101int xopen_stdio(char *path, int flags);
102int openro(char *path, int flags);
103int xopenro(char *path);
104//void xpipe(int *pp);
105void xclose(int fd);
106int xdup(int fd);
107int notstdio(int fd);
108//FILE *xfdopen(int fd, char *mode);
109//FILE *xfopen(char *path, char *mode);
110//size_t xread(int fd, void *buf, size_t len);
111//void xreadall(int fd, void *buf, size_t len);
112//void xwrite(int fd, void *buf, size_t len);
113//off_t xlseek(int fd, off_t offset, int whence);
114//char *xreadfile(char *name, char *buf, off_t len);
115//int xioctl(int fd, int request, void *data);
116//char *xgetcwd(void);
117//void xstat(char *path, struct stat *st);
118//char *xabspath(char *path, int exact);
119//void xchdir(char *path);
120//void xchroot(char *path);
121//struct passwd *xgetpwuid(uid_t uid);
122//struct group *xgetgrgid(gid_t gid);
123//struct passwd *xgetpwnam(char *name);
124//struct group *xgetgrnam(char *name);
125//unsigned xgetuid(char *name);
126//unsigned xgetgid(char *name);
127//void xsetuser(struct passwd *pwd);
128//char *xreadlink(char *name);
129//double xstrtod(char *s);
130//long xparsetime(char *arg, long units, long *fraction);
131//long long xparsemillitime(char *arg);
132//void xpidfile(char *name);
133void xregcomp(regex_t *preg, char *rexec, int cflags);
134//char *xtzset(char *new);
135//void xsignal_flags(int signal, void *handler, int flags);
136//void xsignal(int signal, void *handler);
137//time_t xvali_date(struct tm *tm, char *str);
138//void xparsedate(char *str, time_t *t, unsigned *nano, int endian);
139//char *xgetline(FILE *fp, int *len);
140
141// lib.c
142void tb_verror_msg(char *msg, int err, va_list va);
143void tb_error_msg(char *msg, ...) printf_format;
144void tb_perror_msg(char *msg, ...) printf_format;
145void tb_error_exit(char *msg, ...) printf_format __attribute__((__noreturn__));
146void tb_perror_exit(char *msg, ...) printf_format __attribute__((__noreturn__));
147//void help_exit(char *msg, ...) printf_format __attribute__((__noreturn__));
148void tb_error_msg_raw(char *msg);
149void tb_perror_msg_raw(char *msg);
150void tb_error_exit_raw(char *msg);
151void tb_perror_exit_raw(char *msg);
152//ssize_t readall(int fd, void *buf, size_t len);
153//ssize_t writeall(int fd, void *buf, size_t len);
154//off_t lskip(int fd, off_t offset);
155//#define MKPATHAT_MKLAST 1
156//#define MKPATHAT_MAKE 2
157//#define MKPATHAT_VERBOSE 4
158//int mkpathat(int atfd, char *dir, mode_t lastmode, int flags);
159//int mkpath(char *dir);
160//struct string_list **splitpath(char *path, struct string_list **list);
161//char *readfileat(int dirfd, char *name, char *buf, off_t *len);
162//char *readfile(char *name, char *buf, off_t len);
163void msleep(long milliseconds);
164//void nanomove(struct timespec *ts, long long offset);
165//long long nanodiff(struct timespec *old, struct timespec *new);
166//int highest_bit(unsigned long l);
167//int64_t peek_le(void *ptr, unsigned size);
168//int64_t peek_be(void *ptr, unsigned size);
169//int64_t peek(void *ptr, unsigned size);
170//void poke_le(void *ptr, long long val, unsigned size);
171//void poke_be(void *ptr, long long val, unsigned size);
172//void poke(void *ptr, long long val, unsigned size);
173//struct string_list *find_in_path(char *path, char *filename);
174//long long estrtol(char *str, char **end, int base);
175//long long xstrtol(char *str, char **end, int base);
176//long long atolx(char *c);
177//long long atolx_range(char *numstr, long long low, long long high);
178//int stridx(char *haystack, char needle);
179//int utf8towc(wchar_t *wc, char *str, unsigned len);
180//char *strlower(char *s);
181//char *strafter(char *haystack, char *needle);
182//char *chomp(char *s);
183//int unescape(char c);
184//char *strend(char *str, char *suffix);
185//int strstart(char **a, char *b);
186//int strcasestart(char **a, char *b);
187//off_t fdlength(int fd);
188//void loopfiles_rw(char **argv, int flags, int permissions,
189// void (*function)(int fd, char *name));
190//void loopfiles(char **argv, void (*function)(int fd, char *name));
191//void loopfiles_lines(char **argv, void (*function)(char **pline, long len));
192//long long sendfile_len(int in, int out, long long len, long long *consumed);
193//long long xsendfile_len(int in, int out, long long len);
194//void xsendfile_pad(int in, int out, long long len);
195//long long xsendfile(int in, int out);
196//int wfchmodat(int rc, char *name, mode_t mode);
197//int copy_tempfile(int fdin, char *name, char **tempname);
198//void delete_tempfile(int fdin, int fdout, char **tempname);
199//void replace_tempfile(int fdin, int fdout, char **tempname);
200//void crc_init(unsigned int *crc_table, int little_endian);
201//void base64_init(char *p);
202//int yesno(int def);
203//int fyesno(FILE *fp, int def);
204int qstrcmp(const void *a, const void *b);
205//void tb_create_uuid(char *uuid);
206//char *tb_show_uuid(char *uuid);
207//char *next_printf(char *s, char **start);
208//struct passwd *bufgetpwuid(uid_t uid);
209//struct group *bufgetgrgid(gid_t gid);
210//int readlinkat0(int dirfd, char *path, char *buf, int len);
211//int readlink0(char *path, char *buf, int len);
212//int regexec0(regex_t *preg, char *string, long len, int nmatch,
213// regmatch_t pmatch[], int eflags);
214//char *getusername(uid_t uid);
215//char *getgroupname(gid_t gid);
216//void do_lines(int fd, char delim, void (*call)(char **pline, long len));
217//long long millitime(void);
218//char *format_iso_time(char *buf, size_t len, struct timespec *ts);
219//void reset_env(struct passwd *p, int clear);
220//void loggit(int priority, char *format, ...);
221//unsigned tar_cksum(void *data);
222//int is_tar_header(void *pkt);
223//char *elf_arch_name(int type);
224
225
226// pending.c
227char *get_line(int fd);
228
229
230// dirtree.c
231
232// Values returnable from callback function (bitfield, or them together)
233// Default with no callback is 0
234
235// Add this node to the tree
236#define TB_DIRTREE_SAVE 1
237// Recurse into children
238#define TB_DIRTREE_RECURSE 2
239// Call again after handling all children of this directory
240// (Ignored for non-directories, sets linklen = -1 before second call.)
241#define TB_DIRTREE_COMEAGAIN 4
242// Follow symlinks to directories
243#define TB_DIRTREE_SYMFOLLOW 8
244// Don't warn about failure to stat
245#define TB_DIRTREE_SHUTUP 16
246// Breadth first traversal, conserves filehandles at the expense of memory
247#define TB_DIRTREE_BREADTH 32
248// skip non-numeric entries
249#define TB_DIRTREE_PROC 64
250// Return files we can't stat
251#define TB_DIRTREE_STATLESS 128
252// Don't look at any more files in this directory.
253#define TB_DIRTREE_ABORT 256
254
255#define TB_DIRTREE_ABORTVAL ((struct tb_dirtree *)1)
256
257struct tb_dirtree {
258 struct tb_dirtree *next, *parent, *child;
259 long extra; // place for user to store their stuff (can be pointer)
260 char *symlink;
261 int dirfd;
262 struct stat st;
263 char again;
264 char name[];
265};
266
267int tb_isdotdot(char *name);
268struct tb_dirtree *tb_dirtree_add_node(struct tb_dirtree *p, char *name, int flags);
269char *tb_dirtree_path(struct tb_dirtree *node, int *plen);
270int tb_dirtree_notdotdot(struct tb_dirtree *catch);
271int tb_dirtree_parentfd(struct tb_dirtree *node);
272int tb_dirtree_recurse(struct tb_dirtree *node, int (*callback)(struct tb_dirtree *node),
273 int dirfd, int symfollow);
274
275// Rob forget to do this, but at least he didn't declare it static.
276struct tb_dirtree *tb_dirtree_handle_callback(struct tb_dirtree *new, int (*callback)(struct tb_dirtree *node));
277void tb_dirtree_free(struct tb_dirtree *new);
278