Mercurial > hg > toybox
annotate toys/toylist.h @ 236:6b292ee780ab
Minor cleanup: move mke2fs options into mke2fs.c.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 19 Jan 2008 17:55:45 -0600 |
parents | 163498bf547b |
children |
rev | line source |
---|---|
21
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 /* vi: set ts=4 :*/ |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 /* Toybox infrastructure. |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 * |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 * Copyright 2006 Rob Landley <rob@landley.net> |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 */ |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 struct df_data { |
33 | 9 struct arg_list *fstype; |
53
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
35
diff
changeset
|
10 |
21
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
11 long units; |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 }; |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 |
169 | 14 struct dmesg_data { |
15 long level; | |
16 long size; | |
17 }; | |
18 | |
53
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
35
diff
changeset
|
19 struct mke2fs_data { |
113 | 20 // Command line arguments. |
53
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
35
diff
changeset
|
21 long blocksize; |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
35
diff
changeset
|
22 long bytes_per_inode; |
113 | 23 long inodes; // Total inodes in filesystem. |
24 long reserved_percent; // Integer precent of space to reserve for root. | |
25 char *gendir; // Where to read dirtree from. | |
26 | |
27 // Internal data. | |
28 struct dirtree *dt; // Tree of files to copy into the new filesystem. | |
29 unsigned treeblocks; // Blocks used by dt | |
30 unsigned treeinodes; // Inodes used by dt | |
53
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
35
diff
changeset
|
31 |
113 | 32 unsigned blocks; // Total blocks in the filesystem. |
33 unsigned freeblocks; // Free blocks in the filesystem. | |
34 unsigned inodespg; // Inodes per group | |
35 unsigned groups; // Total number of block groups. | |
36 unsigned blockbits; // Bits per block. (Also blocks per group.) | |
37 | |
38 // For gene2fs | |
39 unsigned nextblock; // Next data block to allocate | |
40 unsigned nextgroup; // Next group we'll be allocating from | |
41 int fsfd; // File descriptor of filesystem (to output to). | |
42 | |
82 | 43 struct ext2_superblock sb; |
53
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
35
diff
changeset
|
44 }; |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
35
diff
changeset
|
45 |
231
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
46 struct mkfifo_data { |
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
47 char *mode; |
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
48 }; |
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
49 |
189
22d22427dec6
Add first pass at netcat. Base applet, -f, and -w implemented.
Rob Landley <rob@landley.net>
parents:
187
diff
changeset
|
50 struct netcat_data { |
22d22427dec6
Add first pass at netcat. Base applet, -f, and -w implemented.
Rob Landley <rob@landley.net>
parents:
187
diff
changeset
|
51 char *filename; // -f read from filename instead of network |
22d22427dec6
Add first pass at netcat. Base applet, -f, and -w implemented.
Rob Landley <rob@landley.net>
parents:
187
diff
changeset
|
52 long quit_delay; // -q Exit after EOF from stdin after # seconds. |
22d22427dec6
Add first pass at netcat. Base applet, -f, and -w implemented.
Rob Landley <rob@landley.net>
parents:
187
diff
changeset
|
53 char *source_address; // -s Bind to a specific source address. |
22d22427dec6
Add first pass at netcat. Base applet, -f, and -w implemented.
Rob Landley <rob@landley.net>
parents:
187
diff
changeset
|
54 long port; // -p Bind to a specific source port. |
22d22427dec6
Add first pass at netcat. Base applet, -f, and -w implemented.
Rob Landley <rob@landley.net>
parents:
187
diff
changeset
|
55 long listen; // -l Listen for connection instead of dialing out. |
22d22427dec6
Add first pass at netcat. Base applet, -f, and -w implemented.
Rob Landley <rob@landley.net>
parents:
187
diff
changeset
|
56 long wait; // -w Wait # seconds for a connection. |
22d22427dec6
Add first pass at netcat. Base applet, -f, and -w implemented.
Rob Landley <rob@landley.net>
parents:
187
diff
changeset
|
57 long delay; // -i delay between lines sent |
22d22427dec6
Add first pass at netcat. Base applet, -f, and -w implemented.
Rob Landley <rob@landley.net>
parents:
187
diff
changeset
|
58 }; |
22d22427dec6
Add first pass at netcat. Base applet, -f, and -w implemented.
Rob Landley <rob@landley.net>
parents:
187
diff
changeset
|
59 |
195
9dc48c97d6f9
Add -c option to oneit, to specify console other than /dev/tty0.
Rob Landley <rob@landley.net>
parents:
191
diff
changeset
|
60 struct oneit_data { |
9dc48c97d6f9
Add -c option to oneit, to specify console other than /dev/tty0.
Rob Landley <rob@landley.net>
parents:
191
diff
changeset
|
61 char *console; |
9dc48c97d6f9
Add -c option to oneit, to specify console other than /dev/tty0.
Rob Landley <rob@landley.net>
parents:
191
diff
changeset
|
62 }; |
9dc48c97d6f9
Add -c option to oneit, to specify console other than /dev/tty0.
Rob Landley <rob@landley.net>
parents:
191
diff
changeset
|
63 |
201
5d523752715a
Start of "patch" support. Writes to stdout at the moment.
Rob Landley <rob@landley.net>
parents:
195
diff
changeset
|
64 struct patch_data { |
5d523752715a
Start of "patch" support. Writes to stdout at the moment.
Rob Landley <rob@landley.net>
parents:
195
diff
changeset
|
65 char *infile; |
5d523752715a
Start of "patch" support. Writes to stdout at the moment.
Rob Landley <rob@landley.net>
parents:
195
diff
changeset
|
66 long prefix; |
5d523752715a
Start of "patch" support. Writes to stdout at the moment.
Rob Landley <rob@landley.net>
parents:
195
diff
changeset
|
67 |
5d523752715a
Start of "patch" support. Writes to stdout at the moment.
Rob Landley <rob@landley.net>
parents:
195
diff
changeset
|
68 struct double_list *plines, *flines; |
209 | 69 long oldline, oldlen, newline, newlen, linenum; |
70 int context, state, filein, fileout, filepatch; | |
214
98820d1eaa79
Upgrade patch to understand creating and deleting files.
Rob Landley <rob@landley.net>
parents:
209
diff
changeset
|
71 char *tempname, *oldname; |
201
5d523752715a
Start of "patch" support. Writes to stdout at the moment.
Rob Landley <rob@landley.net>
parents:
195
diff
changeset
|
72 }; |
5d523752715a
Start of "patch" support. Writes to stdout at the moment.
Rob Landley <rob@landley.net>
parents:
195
diff
changeset
|
73 |
231
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
74 struct sed_data { |
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
75 struct arg_list *commands; |
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
76 }; |
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
77 |
118 | 78 struct sleep_data { |
79 long seconds; | |
80 }; | |
81 | |
100
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
82 struct touch_data { |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
83 char *ref_file; |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
84 char *time; |
162
0864aec90026
Add an option to let touch extend or truncate a file and rename the err label to time_error to reduce confusion.
Charlie Shepherd <masterdriverz@gentoo.org>
parents:
157
diff
changeset
|
85 long length; |
100
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
86 }; |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
87 |
146
99e651512aa4
Get toysh.c to start using the option parsing logic, and some minor cleanup.
Rob Landley <rob@landley.net>
parents:
139
diff
changeset
|
88 struct toysh_data { |
99e651512aa4
Get toysh.c to start using the option parsing logic, and some minor cleanup.
Rob Landley <rob@landley.net>
parents:
139
diff
changeset
|
89 char *command; |
99e651512aa4
Get toysh.c to start using the option parsing logic, and some minor cleanup.
Rob Landley <rob@landley.net>
parents:
139
diff
changeset
|
90 }; |
53
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
35
diff
changeset
|
91 |
93
cc0a6789f92a
Trim a redundant definition that confuses older compilers. (Regression testing
Rob Landley <rob@landley.net>
parents:
92
diff
changeset
|
92 extern union toy_union { |
169 | 93 struct dmesg_data dmesg; |
21
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
94 struct df_data df; |
53
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
35
diff
changeset
|
95 struct mke2fs_data mke2fs; |
157
714f4c051594
Add initial mkfifo implementation
Charlie Shepherd <masterdriverz@gentoo.org>
parents:
147
diff
changeset
|
96 struct mkfifo_data mkfifo; |
189
22d22427dec6
Add first pass at netcat. Base applet, -f, and -w implemented.
Rob Landley <rob@landley.net>
parents:
187
diff
changeset
|
97 struct netcat_data netcat; |
195
9dc48c97d6f9
Add -c option to oneit, to specify console other than /dev/tty0.
Rob Landley <rob@landley.net>
parents:
191
diff
changeset
|
98 struct oneit_data oneit; |
201
5d523752715a
Start of "patch" support. Writes to stdout at the moment.
Rob Landley <rob@landley.net>
parents:
195
diff
changeset
|
99 struct patch_data patch; |
231
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
100 struct sed_data sed; |
146
99e651512aa4
Get toysh.c to start using the option parsing logic, and some minor cleanup.
Rob Landley <rob@landley.net>
parents:
139
diff
changeset
|
101 struct sleep_data sleep; |
99e651512aa4
Get toysh.c to start using the option parsing logic, and some minor cleanup.
Rob Landley <rob@landley.net>
parents:
139
diff
changeset
|
102 struct touch_data touch; |
99e651512aa4
Get toysh.c to start using the option parsing logic, and some minor cleanup.
Rob Landley <rob@landley.net>
parents:
139
diff
changeset
|
103 struct toysh_data toysh; |
21
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
104 } toy; |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
105 |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
106 #define TOYFLAG_USR (1<<0) |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
107 #define TOYFLAG_BIN (1<<1) |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
108 #define TOYFLAG_SBIN (1<<2) |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
109 #define TOYMASK_LOCATION ((1<<4)-1) |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
110 |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
111 #define TOYFLAG_NOFORK (1<<4) |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
112 |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
113 extern struct toy_list { |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
114 char *name; |
186
25447caf1b4b
Change command main() functions to return void, and exit(toys.exitval) from
Rob Landley <rob@landley.net>
parents:
179
diff
changeset
|
115 void (*toy_main)(void); |
25
eb46bb5626cb
New option parsing infrastructure (doesn't use getopt). Hook it up to
Rob Landley <rob@landley.net>
parents:
21
diff
changeset
|
116 char *options; |
21
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
117 int flags; |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
118 } toy_list[]; |