blob: 800911966d1106a8c7982b242e9b18c4c4f42926 [file] [log] [blame]
Eric Andersenc9f20d92002-12-05 08:41:41 +00001#
2# For a description of the syntax of this configuration file,
3# see scripts/kbuild/config-language.txt.
4#
5
Mike Frysinger9ac178a2005-09-24 05:49:36 +00006menu "Shells"
Eric Andersenc9f20d92002-12-05 08:41:41 +00007
Denys Vlasenkod70e0e92010-06-08 12:15:11 +02008INSERT
9
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000010config ASH
Eric Andersenc9f20d92002-12-05 08:41:41 +000011 bool "ash"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +020012 default y
Denys Vlasenko160b9ca2009-11-27 02:35:15 +010013 depends on !NOMMU
Eric Andersenc9f20d92002-12-05 08:41:41 +000014 help
Eric Andersenb287e2e2003-08-08 23:40:12 +000015 Tha 'ash' shell adds about 60k in the default configuration and is
16 the most complete and most pedantically correct shell included with
Bernhard Reutner-Fischer3e8669f2008-07-22 18:27:53 +000017 busybox. This shell is actually a derivative of the Debian 'dash'
Eric Andersen88c916b2003-10-22 09:58:56 +000018 shell (by Herbert Xu), which was created by porting the 'ash' shell
Eric Andersenc7bda1c2004-03-15 08:29:22 +000019 (written by Kenneth Almquist) from NetBSD.
Eric Andersenc9f20d92002-12-05 08:41:41 +000020
Denis Vlasenko92e13c22008-03-25 01:17:40 +000021config ASH_BASH_COMPAT
22 bool "bash-compatible extensions"
23 default y
24 depends on ASH
25 help
Bernhard Reutner-Fischer1dbc6432008-08-06 17:39:30 +000026 Enable bash-compatible extensions.
Denis Vlasenko92e13c22008-03-25 01:17:40 +000027
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000028config ASH_JOB_CONTROL
Paul Fox7ba12c62006-06-08 21:48:47 +000029 bool "Job control"
Eric Andersenc9f20d92002-12-05 08:41:41 +000030 default y
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000031 depends on ASH
Eric Andersenc9f20d92002-12-05 08:41:41 +000032 help
Eric Andersene5642112003-07-14 19:37:08 +000033 Enable job control in the ash shell.
Eric Andersenc9f20d92002-12-05 08:41:41 +000034
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000035config ASH_ALIAS
Paul Fox7ba12c62006-06-08 21:48:47 +000036 bool "alias support"
Eric Andersenc9f20d92002-12-05 08:41:41 +000037 default y
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000038 depends on ASH
Eric Andersenc9f20d92002-12-05 08:41:41 +000039 help
Eric Andersene5642112003-07-14 19:37:08 +000040 Enable alias support in the ash shell.
Eric Andersenc9f20d92002-12-05 08:41:41 +000041
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000042config ASH_GETOPTS
Paul Fox6ab03782006-06-08 21:37:26 +000043 bool "Builtin getopt to parse positional parameters"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +020044 default y
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000045 depends on ASH
Eric Andersenc9f20d92002-12-05 08:41:41 +000046 help
Glenn L McGrath53090cd2004-09-24 09:09:44 +000047 Enable getopts builtin in the ash shell.
Eric Andersenc9f20d92002-12-05 08:41:41 +000048
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000049config ASH_BUILTIN_ECHO
Paul Fox6ab03782006-06-08 21:37:26 +000050 bool "Builtin version of 'echo'"
51 default y
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000052 depends on ASH
Paul Fox6ab03782006-06-08 21:37:26 +000053 help
Bernhard Reutner-Fischereb10e172007-01-29 23:56:13 +000054 Enable support for echo, builtin to ash.
Paul Fox6ab03782006-06-08 21:37:26 +000055
Denis Vlasenkocd2663f2008-06-01 22:36:39 +000056config ASH_BUILTIN_PRINTF
57 bool "Builtin version of 'printf'"
58 default y
59 depends on ASH
60 help
61 Enable support for printf, builtin to ash.
62
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000063config ASH_BUILTIN_TEST
Paul Fox6ab03782006-06-08 21:37:26 +000064 bool "Builtin version of 'test'"
65 default y
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000066 depends on ASH
Paul Fox6ab03782006-06-08 21:37:26 +000067 help
Bernhard Reutner-Fischereb10e172007-01-29 23:56:13 +000068 Enable support for test, builtin to ash.
Paul Fox6ab03782006-06-08 21:37:26 +000069
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000070config ASH_CMDCMD
Paul Fox7ba12c62006-06-08 21:48:47 +000071 bool "'command' command to override shell builtins"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +020072 default y
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000073 depends on ASH
Eric Andersenc9f20d92002-12-05 08:41:41 +000074 help
Eric Andersen3857a182003-07-22 10:14:32 +000075 Enable support for the ash 'command' builtin, which allows
76 you to run the specified command with the specified arguments,
77 even when there is an ash builtin command with the same name.
Eric Andersenc9f20d92002-12-05 08:41:41 +000078
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000079config ASH_MAIL
Rob Landley2ec922e2006-04-13 23:22:16 +000080 bool "Check for new mail on interactive shells"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +020081 default n
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000082 depends on ASH
Eric Andersenc9f20d92002-12-05 08:41:41 +000083 help
Eric Andersene5642112003-07-14 19:37:08 +000084 Enable "check for new mail" in the ash shell.
Eric Andersenc9f20d92002-12-05 08:41:41 +000085
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000086config ASH_OPTIMIZE_FOR_SIZE
Rob Landley2ec922e2006-04-13 23:22:16 +000087 bool "Optimize for size instead of speed"
Eric Andersenc9f20d92002-12-05 08:41:41 +000088 default y
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000089 depends on ASH
Eric Andersenc9f20d92002-12-05 08:41:41 +000090 help
Rob Landley32251b42006-02-08 18:34:21 +000091 Compile ash for reduced size at the price of speed.
Eric Andersenc9f20d92002-12-05 08:41:41 +000092
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000093config ASH_RANDOM_SUPPORT
Denis Vlasenko18f2a792009-04-05 09:02:11 +000094 bool "Pseudorandom generator and $RANDOM variable"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +020095 default y
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000096 depends on ASH
Eric Andersen16767e22004-03-16 05:14:10 +000097 help
98 Enable pseudorandom generator and dynamic variable "$RANDOM".
99 Each read of "$RANDOM" will generate a new pseudorandom value.
100 You can reset the generator by using a specified start value.
Denis Vlasenko18f2a792009-04-05 09:02:11 +0000101 After "unset RANDOM" the generator will switch off and this
Eric Andersen16767e22004-03-16 05:14:10 +0000102 variable will no longer have special treatment.
103
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000104config ASH_EXPAND_PRMT
Rob Landley2ec922e2006-04-13 23:22:16 +0000105 bool "Expand prompt string"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200106 default y
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000107 depends on ASH
"Vladimir N. Oleynik"bef14d72005-09-05 13:25:11 +0000108 help
Denis Vlasenko18f2a792009-04-05 09:02:11 +0000109 "PS#" may contain volatile content, such as backquote commands.
Rob Landley32251b42006-02-08 18:34:21 +0000110 This option recreates the prompt string from the environment
111 variable each time it is displayed.
"Vladimir N. Oleynik"bef14d72005-09-05 13:25:11 +0000112
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000113config HUSH
Eric Andersenc9f20d92002-12-05 08:41:41 +0000114 bool "hush"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200115 default y
Eric Andersenc9f20d92002-12-05 08:41:41 +0000116 help
Denis Vlasenko2b2183a2009-04-13 14:23:12 +0000117 hush is a small shell (22k). It handles the normal flow control
118 constructs such as if/then/elif/else/fi, for/in/do/done, while loops,
119 case/esac. Redirections, here documents, $((arithmetic))
120 and functions are supported.
Eric Andersenc9f20d92002-12-05 08:41:41 +0000121
Denis Vlasenko18f2a792009-04-05 09:02:11 +0000122 It will compile and work on no-mmu systems.
Denis Vlasenkobe709c22008-07-28 00:01:16 +0000123
Denis Vlasenko2b2183a2009-04-13 14:23:12 +0000124 It does not handle select, aliases, brace expansion,
125 tilde expansion, &>file and >&file redirection of stdout+stderr.
Eric Andersenc9f20d92002-12-05 08:41:41 +0000126
Denys Vlasenko9ca656b2009-06-10 13:39:35 +0200127config HUSH_BASH_COMPAT
128 bool "bash-compatible extensions"
129 default y
130 depends on HUSH
131 help
132 Enable bash-compatible extensions.
133
Denis Vlasenko06810332007-05-21 23:30:54 +0000134config HUSH_HELP
135 bool "help builtin"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200136 default y
Denis Vlasenko42bffbf2007-06-08 08:02:53 +0000137 depends on HUSH
Denis Vlasenko06810332007-05-21 23:30:54 +0000138 help
139 Enable help builtin in hush. Code size + ~1 kbyte.
140
Denis Vlasenkob81b3df2007-04-28 16:48:04 +0000141config HUSH_INTERACTIVE
142 bool "Interactive mode"
143 default y
144 depends on HUSH
145 help
Denis Vlasenkoe3f2f892007-04-28 16:48:27 +0000146 Enable interactive mode (prompt and command editing).
147 Without this, hush simply reads and executes commands
Denys Vlasenkod4276892009-10-06 22:13:37 +0200148 from stdin just like a shell script from a file.
Denis Vlasenkoe3f2f892007-04-28 16:48:27 +0000149 No prompt, no PS1/PS2 magic shell variables.
150
151config HUSH_JOB
152 bool "Job control"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200153 default y
Denis Vlasenkoe3f2f892007-04-28 16:48:27 +0000154 depends on HUSH_INTERACTIVE
155 help
156 Enable job control: Ctrl-Z backgrounds, Ctrl-C interrupts current
157 command (not entire shell), fg/bg builtins work. Without this option,
158 "cmd &" still works by simply spawning a process and immediately
159 prompting for next command (or executing next command in a script),
160 but no separate process group is formed.
Denis Vlasenkob81b3df2007-04-28 16:48:04 +0000161
Denis Vlasenko14b5dd92007-05-20 21:51:38 +0000162config HUSH_TICK
163 bool "Process substitution"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200164 default y
Denis Vlasenko42bffbf2007-06-08 08:02:53 +0000165 depends on HUSH
Denis Vlasenko14b5dd92007-05-20 21:51:38 +0000166 help
167 Enable process substitution `command` and $(command) in hush.
Eric Andersenc9f20d92002-12-05 08:41:41 +0000168
Denis Vlasenko06810332007-05-21 23:30:54 +0000169config HUSH_IF
170 bool "Support if/then/elif/else/fi"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200171 default y
Denis Vlasenko42bffbf2007-06-08 08:02:53 +0000172 depends on HUSH
Denis Vlasenko06810332007-05-21 23:30:54 +0000173 help
174 Enable if/then/elif/else/fi in hush.
175
176config HUSH_LOOPS
177 bool "Support for, while and until loops"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200178 default y
Denis Vlasenko42bffbf2007-06-08 08:02:53 +0000179 depends on HUSH
Denis Vlasenko06810332007-05-21 23:30:54 +0000180 help
181 Enable for, while and until loops in hush.
Denis Vlasenkobe709c22008-07-28 00:01:16 +0000182
183config HUSH_CASE
184 bool "Support case ... esac statement"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200185 default y
Denis Vlasenkobe709c22008-07-28 00:01:16 +0000186 depends on HUSH
187 help
188 Enable case ... esac statement in hush. +400 bytes.
Denis Vlasenko06810332007-05-21 23:30:54 +0000189
Denis Vlasenko2b2183a2009-04-13 14:23:12 +0000190config HUSH_FUNCTIONS
191 bool "Support funcname() { commands; } syntax"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200192 default y
Denis Vlasenko2b2183a2009-04-13 14:23:12 +0000193 depends on HUSH
194 help
195 Enable support for shell functions in hush. +800 bytes.
196
Denys Vlasenko295fef82009-06-03 12:47:26 +0200197config HUSH_LOCAL
198 bool "Support local builtin"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200199 default y
Denys Vlasenko295fef82009-06-03 12:47:26 +0200200 depends on HUSH_FUNCTIONS
201 help
202 Enable support for local variables in functions.
203
Denis Vlasenkoad4bd052009-04-20 22:04:21 +0000204config HUSH_EXPORT_N
205 bool "Support export '-n' option"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200206 default y
Denis Vlasenkoad4bd052009-04-20 22:04:21 +0000207 depends on HUSH
208 help
209 Enable support for export '-n' option in hush. It is a bash extension.
210
Denys Vlasenko69d1f452009-10-09 22:11:30 +0200211config HUSH_RANDOM_SUPPORT
212 bool "Pseudorandom generator and $RANDOM variable"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200213 default y
Denys Vlasenko69d1f452009-10-09 22:11:30 +0200214 depends on HUSH
215 help
216 Enable pseudorandom generator and dynamic variable "$RANDOM".
217 Each read of "$RANDOM" will generate a new pseudorandom value.
218
Denys Vlasenkoc8aae0b2010-06-06 22:14:58 +0200219
220choice
221 prompt "Choose which shell is aliased to 'sh' name"
222 default FEATURE_SH_IS_ASH
223 help
224 Choose which shell you want to be executed by 'sh' alias.
225 The ash shell is the most bash compatible and full featured one.
226
Denys Vlasenko121fb952010-06-07 13:34:34 +0200227# note: cannot use "select ASH" here, it breaks "make allnoconfig"
Denys Vlasenkoc8aae0b2010-06-06 22:14:58 +0200228config FEATURE_SH_IS_ASH
229 depends on ASH
230 bool "ash"
231 depends on !NOMMU
232
233config FEATURE_SH_IS_HUSH
234 depends on HUSH
235 bool "hush"
236
237config FEATURE_SH_IS_NONE
238 bool "none"
239
240endchoice
241
242choice
243 prompt "Choose which shell is aliased to 'bash' name"
244 default FEATURE_BASH_IS_NONE
245 help
246 Choose which shell you want to be executed by 'bash' alias.
247 The ash shell is the most bash compatible and full featured one.
248
249 Note that selecting this option does not switch on any bash
250 compatibility code. It merely makes it possible to install
251 /bin/bash (sym)link and run scripts which start with
252 #!/bin/bash line.
253
254 Many systems use it in scripts which use bash-specific features,
255 even simple ones like $RANDOM. Without this option, busybox
256 can't be used for running them because it won't recongnize
257 "bash" as a supported applet name.
258
259config FEATURE_BASH_IS_ASH
260 depends on ASH
261 bool "ash"
262 depends on !NOMMU
263
264config FEATURE_BASH_IS_HUSH
265 depends on HUSH
266 bool "hush"
267
268config FEATURE_BASH_IS_NONE
269 bool "none"
270
271endchoice
272
273
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000274config LASH
Mike Frysinger70a2c8d2009-03-28 12:12:58 +0000275 bool "lash (deprecated: aliased to hush)"
Eric Andersenc9f20d92002-12-05 08:41:41 +0000276 default n
Denis Vlasenko96702ca2007-11-23 23:28:55 +0000277 select HUSH
Eric Andersenc9f20d92002-12-05 08:41:41 +0000278 help
Denis Vlasenko96702ca2007-11-23 23:28:55 +0000279 lash is deprecated and will be removed, please migrate to hush.
Eric Andersenc9f20d92002-12-05 08:41:41 +0000280
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000281config MSH
Mike Frysingerb975feb2009-03-29 00:52:41 +0000282 bool "msh (deprecated: please use hush)"
Eric Andersenc9f20d92002-12-05 08:41:41 +0000283 default n
Denys Vlasenko1cc4b132009-08-21 00:05:51 +0200284 select HUSH
Eric Andersenc9f20d92002-12-05 08:41:41 +0000285 help
Mike Frysingerb975feb2009-03-29 00:52:41 +0000286 msh is deprecated and will be removed, please migrate to hush.
287 If there is a feature msh has but hush does not, please let us know.
288
Denis Vlasenko2b2183a2009-04-13 14:23:12 +0000289# The minix shell (adds just 30k) is quite complete and handles things
290# like for/do/done, case/esac and all the things you expect a Bourne
291# shell to do. It is not always pedantically correct about Bourne
292# shell grammar (try running the shell testscript "tests/sh.testcases"
293# on it and compare vs bash) but for most things it works quite well.
294# It uses only vfork, so it can be used on uClinux systems.
295
296
Mike Frysinger98c52642009-04-02 10:02:37 +0000297config SH_MATH_SUPPORT
298 bool "POSIX math support"
299 default y
300 depends on ASH || HUSH
301 help
302 Enable math support in the shell via $((...)) syntax.
303
304config SH_MATH_SUPPORT_64
305 bool "Extend POSIX math support to 64 bit"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200306 default y
Mike Frysinger98c52642009-04-02 10:02:37 +0000307 depends on SH_MATH_SUPPORT
308 help
309 Enable 64-bit math support in the shell. This will make the shell
310 slightly larger, but will allow computation with very large numbers.
311 This is not in POSIX, so do not rely on this in portable code.
312
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000313config FEATURE_SH_EXTRA_QUIET
Glenn L McGrath3b251852004-01-03 12:07:32 +0000314 bool "Hide message on interactive shell startup"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200315 default y
316 depends on HUSH || ASH
Eric Andersenc9f20d92002-12-05 08:41:41 +0000317 help
Glenn L McGrath3b251852004-01-03 12:07:32 +0000318 Remove the busybox introduction when starting a shell.
Eric Andersenc9f20d92002-12-05 08:41:41 +0000319
Denis Vlasenko80d14be2007-04-10 23:03:30 +0000320config FEATURE_SH_STANDALONE
Eric Andersenc9f20d92002-12-05 08:41:41 +0000321 bool "Standalone shell"
322 default n
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200323 depends on (HUSH || ASH) && FEATURE_PREFER_APPLETS
Eric Andersenc9f20d92002-12-05 08:41:41 +0000324 help
Denis Vlasenko92c0b822007-05-08 17:27:17 +0000325 This option causes busybox shells to use busybox applets
Bernhard Reutner-Fischer3e8669f2008-07-22 18:27:53 +0000326 in preference to executables in the PATH whenever possible. For
Eric Andersen075dd812004-04-07 09:34:27 +0000327 example, entering the command 'ifconfig' into the shell would cause
Bernhard Reutner-Fischer3e8669f2008-07-22 18:27:53 +0000328 busybox to use the ifconfig busybox applet. Specifying the fully
Eric Andersen075dd812004-04-07 09:34:27 +0000329 qualified executable name, such as '/sbin/ifconfig' will still
Bernhard Reutner-Fischer3e8669f2008-07-22 18:27:53 +0000330 execute the /sbin/ifconfig executable on the filesystem. This option
Rob Landley06ec8cf2006-03-03 19:02:50 +0000331 is generally used when creating a statically linked version of busybox
Eric Andersen075dd812004-04-07 09:34:27 +0000332 for use as a rescue shell, in the event that you screw up your system.
Eric Andersenc9f20d92002-12-05 08:41:41 +0000333
Denis Vlasenko92c0b822007-05-08 17:27:17 +0000334 This is implemented by re-execing /proc/self/exe (typically)
335 with right parameters. Some selected applets ("NOFORK" applets)
336 can even be executed without creating new process.
337 Instead, busybox will call <applet>_main() internally.
Paul Fox6ab03782006-06-08 21:37:26 +0000338
Denis Vlasenko92c0b822007-05-08 17:27:17 +0000339 However, this causes problems in chroot jails without mounted /proc
340 and with ps/top (command name can be shown as 'exe' for applets
341 started this way).
342# untrue?
343# Note that this will *also* cause applets to take precedence
Bernhard Reutner-Fischer3e8669f2008-07-22 18:27:53 +0000344# over shell builtins of the same name. So turning this on will
Denis Vlasenko92c0b822007-05-08 17:27:17 +0000345# eliminate any performance gained by turning on the builtin "echo"
346# and "test" commands in ash.
347# untrue?
348# Note that when using this option, the shell will attempt to directly
Bernhard Reutner-Fischer3e8669f2008-07-22 18:27:53 +0000349# run '/bin/busybox'. If you do not have the busybox binary sitting in
Denis Vlasenko92c0b822007-05-08 17:27:17 +0000350# that exact location with that exact name, this option will not work at
351# all.
Eric Andersen6f8542b2004-09-24 01:25:39 +0000352
Denis Vlasenko9bc80d72008-04-12 20:07:53 +0000353config FEATURE_SH_NOFORK
354 bool "Run 'nofork' applets directly"
355 default n
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200356 depends on (HUSH || ASH) && FEATURE_PREFER_APPLETS
Denis Vlasenko9bc80d72008-04-12 20:07:53 +0000357 help
358 This option causes busybox shells [currently only ash]
359 to not execute typical fork/exec/wait sequence, but call <applet>_main
360 directly, if possible. (Sometimes it is not possible: for example,
361 this is not possible in pipes).
362
363 This will be done only for some applets (those which are marked
364 NOFORK in include/applets.h).
365
366 This may significantly speed up some shell scripts.
367
368 This feature is relatively new. Use with care.
369
Denis Vlasenko6d709972007-05-18 09:45:36 +0000370config CTTYHACK
371 bool "cttyhack"
Denys Vlasenko2f32bf82010-06-06 04:14:28 +0200372 default y
Denis Vlasenko6d709972007-05-18 09:45:36 +0000373 help
374 One common problem reported on the mailing list is "can't access tty;
375 job control turned off" error message which typically appears when
376 one tries to use shell with stdin/stdout opened to /dev/console.
377 This device is special - it cannot be a controlling tty.
378
379 Proper solution is to use correct device instead of /dev/console.
380
381 cttyhack provides "quick and dirty" solution to this problem.
382 It analyzes stdin with various ioctls, trying to determine whether
383 it is a /dev/ttyN or /dev/ttySN (virtual terminal or serial line).
384 If it detects one, it closes stdin/out/err and reopens that device.
Denys Vlasenkob367bb22010-05-15 20:43:07 +0200385 Then it executes given program. Opening the device will make
386 that device a controlling tty. This may require cttyhack
387 to be a session leader.
388
389 Example for /etc/inittab (for busybox init):
Denis Vlasenko6d709972007-05-18 09:45:36 +0000390
391 ::respawn:/bin/cttyhack /bin/sh
392
Denys Vlasenkob367bb22010-05-15 20:43:07 +0200393 Giving controlling tty to shell running with PID 1:
394
395 $ exec cttyhack sh
396
Denys Vlasenkoef215552010-05-17 09:55:13 +0200397 Starting an interactive shell from boot shell script:
Denys Vlasenkob367bb22010-05-15 20:43:07 +0200398
399 setsid cttyhack sh
400
Eric Andersenc9f20d92002-12-05 08:41:41 +0000401endmenu