Mercurial > hg > toybox
annotate toys/toylist.h @ 234:163498bf547b
Move NEWTOY() list from end of toylist.h to generated/newtoys.h.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 19 Jan 2008 17:43:27 -0600 |
parents | 31dc682c18ad |
children | 6b292ee780ab |
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 |
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
|
14 // Still to go: "E:jJ:L:m:O:" |
99e651512aa4
Get toysh.c to start using the option parsing logic, and some minor cleanup.
Rob Landley <rob@landley.net>
parents:
139
diff
changeset
|
15 #define MKE2FS_OPTSTRING "<1>2g:Fnqm#N#i#b#" |
99e651512aa4
Get toysh.c to start using the option parsing logic, and some minor cleanup.
Rob Landley <rob@landley.net>
parents:
139
diff
changeset
|
16 |
169 | 17 struct dmesg_data { |
18 long level; | |
19 long size; | |
20 }; | |
21 | |
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
|
22 struct mke2fs_data { |
113 | 23 // 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
|
24 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
|
25 long bytes_per_inode; |
113 | 26 long inodes; // Total inodes in filesystem. |
27 long reserved_percent; // Integer precent of space to reserve for root. | |
28 char *gendir; // Where to read dirtree from. | |
29 | |
30 // Internal data. | |
31 struct dirtree *dt; // Tree of files to copy into the new filesystem. | |
32 unsigned treeblocks; // Blocks used by dt | |
33 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
|
34 |
113 | 35 unsigned blocks; // Total blocks in the filesystem. |
36 unsigned freeblocks; // Free blocks in the filesystem. | |
37 unsigned inodespg; // Inodes per group | |
38 unsigned groups; // Total number of block groups. | |
39 unsigned blockbits; // Bits per block. (Also blocks per group.) | |
40 | |
41 // For gene2fs | |
42 unsigned nextblock; // Next data block to allocate | |
43 unsigned nextgroup; // Next group we'll be allocating from | |
44 int fsfd; // File descriptor of filesystem (to output to). | |
45 | |
82 | 46 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
|
47 }; |
41d55b5d49fd
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Rob Landley <rob@landley.net>
parents:
35
diff
changeset
|
48 |
231
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
49 struct mkfifo_data { |
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
50 char *mode; |
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
51 }; |
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
52 |
189
22d22427dec6
Add first pass at netcat. Base applet, -f, and -w implemented.
Rob Landley <rob@landley.net>
parents:
187
diff
changeset
|
53 struct netcat_data { |
22d22427dec6
Add first pass at netcat. Base applet, -f, and -w implemented.
Rob Landley <rob@landley.net>
parents:
187
diff
changeset
|
54 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
|
55 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
|
56 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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 }; |
22d22427dec6
Add first pass at netcat. Base applet, -f, and -w implemented.
Rob Landley <rob@landley.net>
parents:
187
diff
changeset
|
62 |
195
9dc48c97d6f9
Add -c option to oneit, to specify console other than /dev/tty0.
Rob Landley <rob@landley.net>
parents:
191
diff
changeset
|
63 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
|
64 char *console; |
9dc48c97d6f9
Add -c option to oneit, to specify console other than /dev/tty0.
Rob Landley <rob@landley.net>
parents:
191
diff
changeset
|
65 }; |
9dc48c97d6f9
Add -c option to oneit, to specify console other than /dev/tty0.
Rob Landley <rob@landley.net>
parents:
191
diff
changeset
|
66 |
201
5d523752715a
Start of "patch" support. Writes to stdout at the moment.
Rob Landley <rob@landley.net>
parents:
195
diff
changeset
|
67 struct patch_data { |
5d523752715a
Start of "patch" support. Writes to stdout at the moment.
Rob Landley <rob@landley.net>
parents:
195
diff
changeset
|
68 char *infile; |
5d523752715a
Start of "patch" support. Writes to stdout at the moment.
Rob Landley <rob@landley.net>
parents:
195
diff
changeset
|
69 long prefix; |
5d523752715a
Start of "patch" support. Writes to stdout at the moment.
Rob Landley <rob@landley.net>
parents:
195
diff
changeset
|
70 |
5d523752715a
Start of "patch" support. Writes to stdout at the moment.
Rob Landley <rob@landley.net>
parents:
195
diff
changeset
|
71 struct double_list *plines, *flines; |
209 | 72 long oldline, oldlen, newline, newlen, linenum; |
73 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
|
74 char *tempname, *oldname; |
201
5d523752715a
Start of "patch" support. Writes to stdout at the moment.
Rob Landley <rob@landley.net>
parents:
195
diff
changeset
|
75 }; |
5d523752715a
Start of "patch" support. Writes to stdout at the moment.
Rob Landley <rob@landley.net>
parents:
195
diff
changeset
|
76 |
231
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
77 struct sed_data { |
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
78 struct arg_list *commands; |
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
79 }; |
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
80 |
118 | 81 struct sleep_data { |
82 long seconds; | |
83 }; | |
84 | |
100
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
85 struct touch_data { |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
86 char *ref_file; |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
87 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
|
88 long length; |
100
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
89 }; |
c3d1d74d5d8f
MacOS X has a defective sed with no -r.
Rob Landley <rob@landley.net>
parents:
99
diff
changeset
|
90 |
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
|
91 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
|
92 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
|
93 }; |
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
|
94 |
93
cc0a6789f92a
Trim a redundant definition that confuses older compilers. (Regression testing
Rob Landley <rob@landley.net>
parents:
92
diff
changeset
|
95 extern union toy_union { |
169 | 96 struct dmesg_data dmesg; |
21
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
97 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
|
98 struct mke2fs_data mke2fs; |
157
714f4c051594
Add initial mkfifo implementation
Charlie Shepherd <masterdriverz@gentoo.org>
parents:
147
diff
changeset
|
99 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
|
100 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
|
101 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
|
102 struct patch_data patch; |
231
31dc682c18ad
Very early stub of sed, does nothing yet.
Rob Landley <rob@landley.net>
parents:
229
diff
changeset
|
103 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
|
104 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
|
105 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
|
106 struct toysh_data toysh; |
21
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
107 } toy; |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
108 |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
109 #define TOYFLAG_USR (1<<0) |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
110 #define TOYFLAG_BIN (1<<1) |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
111 #define TOYFLAG_SBIN (1<<2) |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
112 #define TOYMASK_LOCATION ((1<<4)-1) |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
113 |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
114 #define TOYFLAG_NOFORK (1<<4) |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
115 |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
116 extern struct toy_list { |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
117 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
|
118 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
|
119 char *options; |
21
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
120 int flags; |
6475d6c46066
Add pwd. Consolidate toy list information under toylist.h.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
121 } toy_list[]; |