annotate toys.h @ 29:5566beb17d5a

Fix a half-dozen bugs in argument parsing. More seems to work than not now.
author Rob Landley <rob@landley.net>
date Fri, 24 Nov 2006 00:15:21 -0500
parents eb46bb5626cb
children f2c7f0799ebe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
1 /* vi: set ts=4 :*/
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
2 /* Toybox infrastructure.
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
3 *
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
4 * Copyright 2006 Rob Landley <rob@landley.net>
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
5 *
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
6 * Licensed under GPL version 2, see file LICENSE in this tarball for details.
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
7 */
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
8
7
fc9c0503d5e2 Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
landley@driftwood
parents: 4
diff changeset
9 #include <ctype.h>
fc9c0503d5e2 Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
landley@driftwood
parents: 4
diff changeset
10 #include <errno.h>
fc9c0503d5e2 Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
landley@driftwood
parents: 4
diff changeset
11 #include <fcntl.h>
fc9c0503d5e2 Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
landley@driftwood
parents: 4
diff changeset
12 #include <inttypes.h>
2
67b517913e56 Infrastructure, first drop of toy shell, and a bit of work on df.
landley@driftwood
parents: 1
diff changeset
13 #include <limits.h>
67b517913e56 Infrastructure, first drop of toy shell, and a bit of work on df.
landley@driftwood
parents: 1
diff changeset
14 #include <stdarg.h>
7
fc9c0503d5e2 Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
landley@driftwood
parents: 4
diff changeset
15 #include <stdint.h>
1
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
16 #include <stdio.h>
2
67b517913e56 Infrastructure, first drop of toy shell, and a bit of work on df.
landley@driftwood
parents: 1
diff changeset
17 #include <stdlib.h>
67b517913e56 Infrastructure, first drop of toy shell, and a bit of work on df.
landley@driftwood
parents: 1
diff changeset
18 #include <string.h>
1
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
19 #include <strings.h>
4
732b055e17f7 Add xmsprintf(), xgetcwd(), xgetcwd(), find_in_path().
landley@driftwood
parents: 3
diff changeset
20 #include <sys/stat.h>
7
fc9c0503d5e2 Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
landley@driftwood
parents: 4
diff changeset
21 #include <sys/statvfs.h>
fc9c0503d5e2 Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
landley@driftwood
parents: 4
diff changeset
22 #include <sys/types.h>
fc9c0503d5e2 Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
landley@driftwood
parents: 4
diff changeset
23 #include <sys/wait.h>
2
67b517913e56 Infrastructure, first drop of toy shell, and a bit of work on df.
landley@driftwood
parents: 1
diff changeset
24 #include <unistd.h>
1
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
25
2
67b517913e56 Infrastructure, first drop of toy shell, and a bit of work on df.
landley@driftwood
parents: 1
diff changeset
26 #include "lib/lib.h"
21
6475d6c46066 Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents: 20
diff changeset
27 #include "gen_config.h"
6475d6c46066 Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents: 20
diff changeset
28 #include "toys/toylist.h"
1
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
29
21
6475d6c46066 Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents: 20
diff changeset
30 // These live in main.c
2
67b517913e56 Infrastructure, first drop of toy shell, and a bit of work on df.
landley@driftwood
parents: 1
diff changeset
31
67b517913e56 Infrastructure, first drop of toy shell, and a bit of work on df.
landley@driftwood
parents: 1
diff changeset
32 struct toy_list *toy_find(char *name);
3
266a462ed18c Next drop of toysh, plus more infratructure.
landley@driftwood
parents: 2
diff changeset
33 void toy_init(struct toy_list *which, char *argv[]);
266a462ed18c Next drop of toysh, plus more infratructure.
landley@driftwood
parents: 2
diff changeset
34 void toy_exec(char *argv[]);
1
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
35
21
6475d6c46066 Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents: 20
diff changeset
36 // Global context for any applet.
1
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
37
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
38 extern struct toy_context {
2
67b517913e56 Infrastructure, first drop of toy shell, and a bit of work on df.
landley@driftwood
parents: 1
diff changeset
39 struct toy_list *which; // Which entry in toy_list is this one?
67b517913e56 Infrastructure, first drop of toy shell, and a bit of work on df.
landley@driftwood
parents: 1
diff changeset
40 int exitval; // Value error_exit feeds to exit()
7
fc9c0503d5e2 Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
landley@driftwood
parents: 4
diff changeset
41 char **argv; // Command line arguments
25
eb46bb5626cb New option parsing infrastructure (doesn't use getopt). Hook it up to
Rob Landley <rob@landley.net>
parents: 21
diff changeset
42 unsigned optflags; // Command line option flags from get_optflags()
eb46bb5626cb New option parsing infrastructure (doesn't use getopt). Hook it up to
Rob Landley <rob@landley.net>
parents: 21
diff changeset
43 char **optargs; // Arguments left over from get_optflags()
1
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
44 } toys;
25
eb46bb5626cb New option parsing infrastructure (doesn't use getopt). Hook it up to
Rob Landley <rob@landley.net>
parents: 21
diff changeset
45
eb46bb5626cb New option parsing infrastructure (doesn't use getopt). Hook it up to
Rob Landley <rob@landley.net>
parents: 21
diff changeset
46 // One big temporary buffer, for use by applets (not library functions).
eb46bb5626cb New option parsing infrastructure (doesn't use getopt). Hook it up to
Rob Landley <rob@landley.net>
parents: 21
diff changeset
47
eb46bb5626cb New option parsing infrastructure (doesn't use getopt). Hook it up to
Rob Landley <rob@landley.net>
parents: 21
diff changeset
48 char buf[4096];