annotate toys.h @ 218:bc87305c391f

Make touch work reliably when file doesn't exist and clean up headers a bit.
author Rob Landley <rob@landley.net>
date Fri, 28 Dec 2007 03:29:33 -0600
parents 8affb8850366
children cd4d5630c978
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
94
884c03c29f21 Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents: 82
diff changeset
9 #include "gen_config.h"
884c03c29f21 Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents: 82
diff changeset
10
63
69efffcacd70 Add fdprintf(). Remove reread() and rewrite() which handle -EINTR, which
Rob Landley <rob@landley.net>
parents: 53
diff changeset
11 #include "lib/portability.h"
69efffcacd70 Add fdprintf(). Remove reread() and rewrite() which handle -EINTR, which
Rob Landley <rob@landley.net>
parents: 53
diff changeset
12
7
fc9c0503d5e2 Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
landley@driftwood
parents: 4
diff changeset
13 #include <ctype.h>
94
884c03c29f21 Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents: 82
diff changeset
14 #include <dirent.h>
7
fc9c0503d5e2 Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
landley@driftwood
parents: 4
diff changeset
15 #include <errno.h>
fc9c0503d5e2 Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
landley@driftwood
parents: 4
diff changeset
16 #include <fcntl.h>
114
ce6956dfc0cf Add sync and an incomplete version of mdev.
Rob Landley <rob@landley.net>
parents: 94
diff changeset
17 #include <grp.h>
7
fc9c0503d5e2 Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
landley@driftwood
parents: 4
diff changeset
18 #include <inttypes.h>
2
67b517913e56 Infrastructure, first drop of toy shell, and a bit of work on df.
landley@driftwood
parents: 1
diff changeset
19 #include <limits.h>
114
ce6956dfc0cf Add sync and an incomplete version of mdev.
Rob Landley <rob@landley.net>
parents: 94
diff changeset
20 #include <pwd.h>
37
14d27eab3acf Add my old micro-bunzip library. Needs some cleanup...
Rob Landley <rob@landley.net>
parents: 35
diff changeset
21 #include <setjmp.h>
2
67b517913e56 Infrastructure, first drop of toy shell, and a bit of work on df.
landley@driftwood
parents: 1
diff changeset
22 #include <stdarg.h>
7
fc9c0503d5e2 Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
landley@driftwood
parents: 4
diff changeset
23 #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
24 #include <stdio.h>
2
67b517913e56 Infrastructure, first drop of toy shell, and a bit of work on df.
landley@driftwood
parents: 1
diff changeset
25 #include <stdlib.h>
67b517913e56 Infrastructure, first drop of toy shell, and a bit of work on df.
landley@driftwood
parents: 1
diff changeset
26 #include <string.h>
53
41d55b5d49fd Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents: 37
diff changeset
27 #include <sys/ioctl.h>
114
ce6956dfc0cf Add sync and an incomplete version of mdev.
Rob Landley <rob@landley.net>
parents: 94
diff changeset
28 #include <sys/mman.h>
75
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents: 63
diff changeset
29 #include <sys/mount.h>
4
732b055e17f7 Add xmsprintf(), xgetcwd(), xgetcwd(), find_in_path().
landley@driftwood
parents: 3
diff changeset
30 #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
31 #include <sys/statvfs.h>
fc9c0503d5e2 Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
landley@driftwood
parents: 4
diff changeset
32 #include <sys/types.h>
fc9c0503d5e2 Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
landley@driftwood
parents: 4
diff changeset
33 #include <sys/wait.h>
218
bc87305c391f Make touch work reliably when file doesn't exist and clean up headers a bit.
Rob Landley <rob@landley.net>
parents: 145
diff changeset
34 #include <unistd.h>
bc87305c391f Make touch work reliably when file doesn't exist and clean up headers a bit.
Rob Landley <rob@landley.net>
parents: 145
diff changeset
35 #include <utime.h>
bc87305c391f Make touch work reliably when file doesn't exist and clean up headers a bit.
Rob Landley <rob@landley.net>
parents: 145
diff changeset
36
bc87305c391f Make touch work reliably when file doesn't exist and clean up headers a bit.
Rob Landley <rob@landley.net>
parents: 145
diff changeset
37 #define _XOPEN_SOURCE 600
76
e6332139adae More work on mke2fs.
Rob Landley <rob@landley.net>
parents: 75
diff changeset
38 #include <time.h>
1
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
39
2
67b517913e56 Infrastructure, first drop of toy shell, and a bit of work on df.
landley@driftwood
parents: 1
diff changeset
40 #include "lib/lib.h"
82
612c8d6c2829 More work on mke2fs.
Rob Landley <rob@landley.net>
parents: 76
diff changeset
41 #include "toys/e2fs.h"
21
6475d6c46066 Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents: 20
diff changeset
42 #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
43
21
6475d6c46066 Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents: 20
diff changeset
44 // 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
45
67b517913e56 Infrastructure, first drop of toy shell, and a bit of work on df.
landley@driftwood
parents: 1
diff changeset
46 struct toy_list *toy_find(char *name);
3
266a462ed18c Next drop of toysh, plus more infratructure.
landley@driftwood
parents: 2
diff changeset
47 void toy_init(struct toy_list *which, char *argv[]);
266a462ed18c Next drop of toysh, plus more infratructure.
landley@driftwood
parents: 2
diff changeset
48 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
49
21
6475d6c46066 Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents: 20
diff changeset
50 // 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
51
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
52 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
53 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
54 int exitval; // Value error_exit feeds to exit()
118
93da7cc220e6 Add sleep.
Rob Landley <rob@landley.net>
parents: 114
diff changeset
55 char **argv; // Original 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
56 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
57 char **optargs; // Arguments left over from get_optflags()
145
8affb8850366 Need to commit this too. :)
Rob Landley <rob@landley.net>
parents: 136
diff changeset
58 int exithelp; // Should error_exit print a usage message first? (Option parsing.)
1
59d58fab67c6 Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff changeset
59 } toys;
25
eb46bb5626cb New option parsing infrastructure (doesn't use getopt). Hook it up to
Rob Landley <rob@landley.net>
parents: 21
diff changeset
60
eb46bb5626cb New option parsing infrastructure (doesn't use getopt). Hook it up to
Rob Landley <rob@landley.net>
parents: 21
diff changeset
61 // 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
62
53
41d55b5d49fd Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents: 37
diff changeset
63 extern char toybuf[4096];