comparison toys/toysh.c @ 233:d4176f3f3835

Zap toys/Config.in and instead create generated/Config.in from contents of toys/*.c. Move relevant info into comment at the top of each toys/*.c. Also convert more of Makefile into a thin wrapper around shell scripts that actually do the work. (Makefile is only still there for the user interface.)
author Rob Landley <rob@landley.net>
date Sat, 19 Jan 2008 17:08:39 -0600
parents 3227c5316260
children 163498bf547b
comparison
equal deleted inserted replaced
232:cd4d5630c978 233:d4176f3f3835
11 * There are also specs for: 11 * There are also specs for:
12 * http://www.opengroup.org/onlinepubs/009695399/utilities/cd.html 12 * http://www.opengroup.org/onlinepubs/009695399/utilities/cd.html
13 * http://www.opengroup.org/onlinepubs/009695399/utilities/exit.html 13 * http://www.opengroup.org/onlinepubs/009695399/utilities/exit.html
14 * 14 *
15 * Things like the bash man page are good to read too. 15 * Things like the bash man page are good to read too.
16 */ 16 *
17 17 * TODO: // Handle embedded NUL bytes in the command line.
18 // Handle embedded NUL bytes in the command line. 18
19 config TOYSH
20 bool "sh (toysh)"
21 default y
22 help
23 usage: sh [-c command] [script]
24
25 The toybox command shell. Runs a shell script, or else reads input
26 interactively and responds to it.
27
28 -c command line to execute
29
30 config TOYSH_TTY
31 bool "Interactive shell (terminal control)"
32 default n
33 depends on TOYSH
34 help
35 Add terminal control to toysh. This is necessary for interactive use,
36 so the shell isn't killed by CTRL-C.
37
38 config TOYSH_PROFILE
39 bool "Profile support"
40 default n
41 depends on TOYSH_TTY
42 help
43 Read /etc/profile and ~/.profile when running interactively.
44
45 Also enables the built-in command "source".
46
47 config TOYSH_JOBCTL
48 bool "Job Control (fg, bg, jobs)"
49 default n
50 depends on TOYSH_TTY
51 help
52 Add job control to toysh. This lets toysh handle CTRL-Z, and enables
53 the built-in commands "fg", "bg", and "jobs".
54
55 With pipe support, enable use of "&" to run background processes.
56
57 config TOYSH_FLOWCTL
58 bool "Flow control (if, while, for, functions)"
59 default n
60 depends on TOYSH
61 help
62 Add flow control to toysh. This enables the if/then/else/fi,
63 while/do/done, and for/do/done constructs.
64
65 With pipe support, this enables the ability to define functions
66 using the "function name" or "name()" syntax, plus curly brackets
67 "{ }" to group commands.
68
69 config TOYSH_QUOTES
70 bool "Smarter argument parsing (quotes)"
71 default n
72 depends on TOYSH
73 help
74 Add support for parsing "" and '' style quotes to the toysh command
75 parser, with lets arguments have spaces in them.
76
77 config TOYSH_WILDCARDS
78 bool "Wildcards ( ?*{,} )"
79 default n
80 depends on TOYSH_QUOTES
81 help
82 Expand wildcards in argument names, ala "ls -l *.t?z" and
83 "rm subdir/{one,two,three}.txt".
84
85 config TOYSH_PROCARGS
86 bool "Executable arguments ( `` and $() )"
87 default n
88 depends on TOYSH_QUOTES
89 help
90 Add support for executing arguments contianing $() and ``, using
91 the output of the command as the new argument value(s).
92
93 (Bash calls this "command substitution".)
94
95 config TOYSH_ENVVARS
96 bool "Environment variable support"
97 default n
98 depends on TOYSH_QUOTES
99 help
100 Substitute environment variable values for $VARNAME or ${VARNAME},
101 and enable the built-in command "export".
102
103 config TOYSH_LOCALS
104 bool "Local variables"
105 default n
106 depends on TOYSH_ENVVARS
107 help
108 Support for local variables, fancy prompts ($PS1), the "set" command,
109 and $?.
110
111 config TOYSH_ARRAYS
112 bool "Array variables"
113 default n
114 depends on TOYSH_LOCALS
115 help
116 Support for ${blah[blah]} style array variables.
117
118 config TOYSH_PIPES
119 bool "Pipes and redirects ( | > >> < << & && | || () ; )"
120 default n
121 depends on TOYSH
122 help
123 Support multiple commands on the same command line. This includes
124 | pipes, > >> < redirects, << here documents, || && conditional
125 execution, () subshells, ; sequential execution, and (with job
126 control) & background processes.
127
128 config TOYSH_BUILTINS
129 bool "Builtin commands"
130 default n
131 depends on TOYSH
132 help
133 Adds the commands exec, fg, bg, help, jobs, pwd, export, source, set,
134 unset, read, alias.
135
136 config EXIT
137 bool
138 default n
139 depends on TOYSH
140 help
141 usage: exit [status]
142
143 Exit shell. If no return value supplied on command line, use value
144 of most recent command, or 0 if none.
145
146 config CD
147 bool
148 default n
149 depends on TOYSH
150 help
151 usage: cd [path]
152
153 Change current directory. With no arguments, go to $HOME.
154
155 config CD_P
156 bool # "-P support for cd"
157 default n
158 depends on TOYSH
159 help
160 usage: cd [-PL]
161
162 -P Physical path: resolve symlinks in path.
163 -L Cancel previous -P and restore default behavior.
164 */
19 165
20 #include "toys.h" 166 #include "toys.h"
21 167
22 #define TT toy.toysh 168 #define TT toy.toysh
23 169