OSDN Git Service

Make touch work reliably when file doesn't exist and clean up headers a bit.
[android-x86/external-toybox.git] / toys.h
1 /* vi: set ts=4 :*/
2 /* Toybox infrastructure.
3  *
4  * Copyright 2006 Rob Landley <rob@landley.net>
5  *
6  * Licensed under GPL version 2, see file LICENSE in this tarball for details.
7  */
8
9 #include "gen_config.h"
10
11 #include "lib/portability.h"
12
13 #include <ctype.h>
14 #include <dirent.h>
15 #include <errno.h>
16 #include <fcntl.h>
17 #include <grp.h>
18 #include <inttypes.h>
19 #include <limits.h>
20 #include <pwd.h>
21 #include <setjmp.h>
22 #include <stdarg.h>
23 #include <stdint.h>
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #include <sys/ioctl.h>
28 #include <sys/mman.h>
29 #include <sys/mount.h>
30 #include <sys/stat.h>
31 #include <sys/statvfs.h>
32 #include <sys/types.h>
33 #include <sys/wait.h>
34 #include <unistd.h>
35 #include <utime.h>
36
37 #define _XOPEN_SOURCE 600
38 #include <time.h>
39
40 #include "lib/lib.h"
41 #include "toys/e2fs.h"
42 #include "toys/toylist.h"
43
44 // These live in main.c
45
46 struct toy_list *toy_find(char *name);
47 void toy_init(struct toy_list *which, char *argv[]);
48 void toy_exec(char *argv[]);
49
50 // Global context for any applet.
51
52 extern struct toy_context {
53         struct toy_list *which;  // Which entry in toy_list is this one?
54         int exitval;             // Value error_exit feeds to exit()
55         char **argv;             // Original command line arguments
56         unsigned optflags;       // Command line option flags from get_optflags()
57         char **optargs;          // Arguments left over from get_optflags()
58         int exithelp;            // Should error_exit print a usage message first?  (Option parsing.)
59 } toys;
60
61 // One big temporary buffer, for use by applets (not library functions).
62
63 extern char toybuf[4096];