OSDN Git Service

New option parsing infrastructure (doesn't use getopt). Hook it up to
[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 <ctype.h>
10 #include <errno.h>
11 #include <fcntl.h>
12 #include <inttypes.h>
13 #include <limits.h>
14 #include <stdarg.h>
15 #include <stdint.h>
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <string.h>
19 #include <strings.h>
20 #include <sys/stat.h>
21 #include <sys/statvfs.h>
22 #include <sys/types.h>
23 #include <sys/wait.h>
24 #include <unistd.h>
25
26 #include "lib/lib.h"
27 #include "gen_config.h"
28 #include "toys/toylist.h"
29
30 // These live in main.c
31
32 struct toy_list *toy_find(char *name);
33 void toy_init(struct toy_list *which, char *argv[]);
34 void toy_exec(char *argv[]);
35
36 // Global context for any applet.
37
38 extern struct toy_context {
39         struct toy_list *which;  // Which entry in toy_list is this one?
40         int exitval;             // Value error_exit feeds to exit()
41         char **argv;             // Command line arguments
42         unsigned optflags;       // Command line option flags from get_optflags()
43         char **optargs;          // Arguments left over from get_optflags()
44 } toys;
45
46 // One big temporary buffer, for use by applets (not library functions).
47
48 char buf[4096];