landley | c562150 | 2006-09-28 17:18:51 -0400 | [diff] [blame] | 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 | |
landley | 09ea7ac | 2006-10-30 01:38:00 -0500 | [diff] [blame] | 9 | #include <ctype.h> |
| 10 | #include <errno.h> |
| 11 | #include <fcntl.h> |
| 12 | #include <inttypes.h> |
landley | 4f344e3 | 2006-10-05 16:18:03 -0400 | [diff] [blame] | 13 | #include <limits.h> |
| 14 | #include <stdarg.h> |
landley | 09ea7ac | 2006-10-30 01:38:00 -0500 | [diff] [blame] | 15 | #include <stdint.h> |
landley | c562150 | 2006-09-28 17:18:51 -0400 | [diff] [blame] | 16 | #include <stdio.h> |
landley | 4f344e3 | 2006-10-05 16:18:03 -0400 | [diff] [blame] | 17 | #include <stdlib.h> |
| 18 | #include <string.h> |
landley | c562150 | 2006-09-28 17:18:51 -0400 | [diff] [blame] | 19 | #include <strings.h> |
landley | 00f87f1 | 2006-10-25 18:38:37 -0400 | [diff] [blame] | 20 | #include <sys/stat.h> |
landley | 09ea7ac | 2006-10-30 01:38:00 -0500 | [diff] [blame] | 21 | #include <sys/statvfs.h> |
| 22 | #include <sys/types.h> |
| 23 | #include <sys/wait.h> |
landley | 4f344e3 | 2006-10-05 16:18:03 -0400 | [diff] [blame] | 24 | #include <unistd.h> |
landley | c562150 | 2006-09-28 17:18:51 -0400 | [diff] [blame] | 25 | |
landley | 4f344e3 | 2006-10-05 16:18:03 -0400 | [diff] [blame] | 26 | #include "lib/lib.h" |
Rob Landley | f2311a4 | 2006-11-04 17:45:18 -0500 | [diff] [blame^] | 27 | #include "gen_config.h" |
| 28 | #include "toys/toylist.h" |
landley | c562150 | 2006-09-28 17:18:51 -0400 | [diff] [blame] | 29 | |
Rob Landley | f2311a4 | 2006-11-04 17:45:18 -0500 | [diff] [blame^] | 30 | // These live in main.c |
landley | c562150 | 2006-09-28 17:18:51 -0400 | [diff] [blame] | 31 | |
landley | 4f344e3 | 2006-10-05 16:18:03 -0400 | [diff] [blame] | 32 | struct toy_list *toy_find(char *name); |
landley | cd9dfc3 | 2006-10-18 18:38:16 -0400 | [diff] [blame] | 33 | void toy_init(struct toy_list *which, char *argv[]); |
| 34 | void toy_exec(char *argv[]); |
landley | c562150 | 2006-09-28 17:18:51 -0400 | [diff] [blame] | 35 | |
Rob Landley | f2311a4 | 2006-11-04 17:45:18 -0500 | [diff] [blame^] | 36 | // Global context for any applet. |
landley | c562150 | 2006-09-28 17:18:51 -0400 | [diff] [blame] | 37 | |
| 38 | extern struct toy_context { |
landley | 4f344e3 | 2006-10-05 16:18:03 -0400 | [diff] [blame] | 39 | struct toy_list *which; // Which entry in toy_list is this one? |
| 40 | int exitval; // Value error_exit feeds to exit() |
landley | 09ea7ac | 2006-10-30 01:38:00 -0500 | [diff] [blame] | 41 | int optflags; // Command line option flags |
| 42 | char **argv; // Command line arguments |
landley | c562150 | 2006-09-28 17:18:51 -0400 | [diff] [blame] | 43 | char buf[4096]; |
| 44 | } toys; |