blob: 003a827c5ae2c7bb2f4319300002c20aebf997af [file] [log] [blame]
landleyc5621502006-09-28 17:18:51 -04001/* 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
landley09ea7ac2006-10-30 01:38:00 -05009#include <ctype.h>
10#include <errno.h>
11#include <fcntl.h>
12#include <inttypes.h>
landley4f344e32006-10-05 16:18:03 -040013#include <limits.h>
14#include <stdarg.h>
landley09ea7ac2006-10-30 01:38:00 -050015#include <stdint.h>
landleyc5621502006-09-28 17:18:51 -040016#include <stdio.h>
landley4f344e32006-10-05 16:18:03 -040017#include <stdlib.h>
18#include <string.h>
landleyc5621502006-09-28 17:18:51 -040019#include <strings.h>
landley00f87f12006-10-25 18:38:37 -040020#include <sys/stat.h>
landley09ea7ac2006-10-30 01:38:00 -050021#include <sys/statvfs.h>
22#include <sys/types.h>
23#include <sys/wait.h>
landley4f344e32006-10-05 16:18:03 -040024#include <unistd.h>
landleyc5621502006-09-28 17:18:51 -040025
landley4f344e32006-10-05 16:18:03 -040026#include "lib/lib.h"
Rob Landleyf2311a42006-11-04 17:45:18 -050027#include "gen_config.h"
28#include "toys/toylist.h"
landleyc5621502006-09-28 17:18:51 -040029
Rob Landleyf2311a42006-11-04 17:45:18 -050030// These live in main.c
landleyc5621502006-09-28 17:18:51 -040031
landley4f344e32006-10-05 16:18:03 -040032struct toy_list *toy_find(char *name);
landleycd9dfc32006-10-18 18:38:16 -040033void toy_init(struct toy_list *which, char *argv[]);
34void toy_exec(char *argv[]);
landleyc5621502006-09-28 17:18:51 -040035
Rob Landleyf2311a42006-11-04 17:45:18 -050036// Global context for any applet.
landleyc5621502006-09-28 17:18:51 -040037
38extern struct toy_context {
landley4f344e32006-10-05 16:18:03 -040039 struct toy_list *which; // Which entry in toy_list is this one?
40 int exitval; // Value error_exit feeds to exit()
landley09ea7ac2006-10-30 01:38:00 -050041 int optflags; // Command line option flags
42 char **argv; // Command line arguments
landleyc5621502006-09-28 17:18:51 -040043 char buf[4096];
44} toys;