diff options
| author | Paul Fox <pgf@brightstareng.com> | 2005-08-09 19:38:05 +0000 |
|---|---|---|
| committer | Paul Fox <pgf@brightstareng.com> | 2005-08-09 19:38:05 +0000 |
| commit | 0b62158475ecbfce16fb857042ec7f402d7594ec (patch) | |
| tree | d5f722c5d16a204996e46c84e8fe7923f8f40abf /shell | |
| parent | 3f11b1bf634536cb01d9913d1a3d10da5bf24541 (diff) | |
| download | busybox-w32-0b62158475ecbfce16fb857042ec7f402d7594ec.tar.gz busybox-w32-0b62158475ecbfce16fb857042ec7f402d7594ec.tar.bz2 busybox-w32-0b62158475ecbfce16fb857042ec7f402d7594ec.zip | |
implemented a builtin echo command in ash. moved the guts of the
echo applet into libbb, and now call bb_echo() from both echo.c
and ash.c
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/Config.in | 15 | ||||
| -rw-r--r-- | shell/ash.c | 52 |
2 files changed, 34 insertions, 33 deletions
diff --git a/shell/Config.in b/shell/Config.in index 0d39e5bae..813044e2c 100644 --- a/shell/Config.in +++ b/shell/Config.in | |||
| @@ -103,6 +103,21 @@ config CONFIG_ASH_CMDCMD | |||
| 103 | you to run the specified command with the specified arguments, | 103 | you to run the specified command with the specified arguments, |
| 104 | even when there is an ash builtin command with the same name. | 104 | even when there is an ash builtin command with the same name. |
| 105 | 105 | ||
| 106 | config CONFIG_ASH_BUILTIN_ECHO | ||
| 107 | bool " Enable builtin version of 'echo'" | ||
| 108 | default n | ||
| 109 | depends on CONFIG_ASH | ||
| 110 | help | ||
| 111 | Enable support for echo, built in to ash. | ||
| 112 | |||
| 113 | # this entry also appears in coreutils/Config.in, next to the echo applet | ||
| 114 | config CONFIG_FEATURE_FANCY_ECHO | ||
| 115 | bool " Enable echo options (-n and -e)" | ||
| 116 | default y | ||
| 117 | depends on CONFIG_ASH_BUILTIN_ECHO | ||
| 118 | help | ||
| 119 | This adds options (-n and -e) to echo. | ||
| 120 | |||
| 106 | config CONFIG_ASH_MAIL | 121 | config CONFIG_ASH_MAIL |
| 107 | bool " Check for new mail on interactive shells" | 122 | bool " Check for new mail on interactive shells" |
| 108 | default y | 123 | default y |
diff --git a/shell/ash.c b/shell/ash.c index 7f77594a7..9660890f9 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -1249,6 +1249,9 @@ static int commandcmd(int, char **); | |||
| 1249 | #endif | 1249 | #endif |
| 1250 | static int dotcmd(int, char **); | 1250 | static int dotcmd(int, char **); |
| 1251 | static int evalcmd(int, char **); | 1251 | static int evalcmd(int, char **); |
| 1252 | #ifdef CONFIG_ASH_BUILTIN_ECHO | ||
| 1253 | static int echocmd(int, char **); | ||
| 1254 | #endif | ||
| 1252 | static int execcmd(int, char **); | 1255 | static int execcmd(int, char **); |
| 1253 | static int exitcmd(int, char **); | 1256 | static int exitcmd(int, char **); |
| 1254 | static int exportcmd(int, char **); | 1257 | static int exportcmd(int, char **); |
| @@ -1308,39 +1311,12 @@ struct builtincmd { | |||
| 1308 | /* unsigned flags; */ | 1311 | /* unsigned flags; */ |
| 1309 | }; | 1312 | }; |
| 1310 | 1313 | ||
| 1311 | #ifdef CONFIG_ASH_CMDCMD | 1314 | |
| 1312 | # ifdef JOBS | 1315 | #define COMMANDCMD (builtincmd + 5 + \ |
| 1313 | # ifdef CONFIG_ASH_ALIAS | 1316 | ENABLE_ASH_ALIAS + ENABLE_ASH_JOB_CONTROL) |
| 1314 | # define COMMANDCMD (builtincmd + 7) | 1317 | #define EXECCMD (builtincmd + 7 + \ |
| 1315 | # define EXECCMD (builtincmd + 10) | 1318 | ENABLE_ASH_CMDCMD + ENABLE_ASH_ALIAS + \ |
| 1316 | # else | 1319 | ENABLE_ASH_BUILTIN_ECHO + ENABLE_ASH_JOB_CONTROL) |
| 1317 | # define COMMANDCMD (builtincmd + 6) | ||
| 1318 | # define EXECCMD (builtincmd + 9) | ||
| 1319 | # endif | ||
| 1320 | # else /* ! JOBS */ | ||
| 1321 | # ifdef CONFIG_ASH_ALIAS | ||
| 1322 | # define COMMANDCMD (builtincmd + 6) | ||
| 1323 | # define EXECCMD (builtincmd + 9) | ||
| 1324 | # else | ||
| 1325 | # define COMMANDCMD (builtincmd + 5) | ||
| 1326 | # define EXECCMD (builtincmd + 8) | ||
| 1327 | # endif | ||
| 1328 | # endif /* JOBS */ | ||
| 1329 | #else /* ! CONFIG_ASH_CMDCMD */ | ||
| 1330 | # ifdef JOBS | ||
| 1331 | # ifdef CONFIG_ASH_ALIAS | ||
| 1332 | # define EXECCMD (builtincmd + 9) | ||
| 1333 | # else | ||
| 1334 | # define EXECCMD (builtincmd + 8) | ||
| 1335 | # endif | ||
| 1336 | # else /* ! JOBS */ | ||
| 1337 | # ifdef CONFIG_ASH_ALIAS | ||
| 1338 | # define EXECCMD (builtincmd + 8) | ||
| 1339 | # else | ||
| 1340 | # define EXECCMD (builtincmd + 7) | ||
| 1341 | # endif | ||
| 1342 | # endif /* JOBS */ | ||
| 1343 | #endif /* CONFIG_ASH_CMDCMD */ | ||
| 1344 | 1320 | ||
| 1345 | #define BUILTIN_NOSPEC "0" | 1321 | #define BUILTIN_NOSPEC "0" |
| 1346 | #define BUILTIN_SPECIAL "1" | 1322 | #define BUILTIN_SPECIAL "1" |
| @@ -1371,6 +1347,9 @@ static const struct builtincmd builtincmd[] = { | |||
| 1371 | { BUILTIN_REGULAR "command", commandcmd }, | 1347 | { BUILTIN_REGULAR "command", commandcmd }, |
| 1372 | #endif | 1348 | #endif |
| 1373 | { BUILTIN_SPEC_REG "continue", breakcmd }, | 1349 | { BUILTIN_SPEC_REG "continue", breakcmd }, |
| 1350 | #ifdef CONFIG_ASH_BUILTIN_ECHO | ||
| 1351 | { BUILTIN_REGULAR "echo", echocmd }, | ||
| 1352 | #endif | ||
| 1374 | { BUILTIN_SPEC_REG "eval", evalcmd }, | 1353 | { BUILTIN_SPEC_REG "eval", evalcmd }, |
| 1375 | { BUILTIN_SPEC_REG "exec", execcmd }, | 1354 | { BUILTIN_SPEC_REG "exec", execcmd }, |
| 1376 | { BUILTIN_SPEC_REG "exit", exitcmd }, | 1355 | { BUILTIN_SPEC_REG "exit", exitcmd }, |
| @@ -8200,6 +8179,13 @@ exitcmd(int argc, char **argv) | |||
| 8200 | /* NOTREACHED */ | 8179 | /* NOTREACHED */ |
| 8201 | } | 8180 | } |
| 8202 | 8181 | ||
| 8182 | #ifdef CONFIG_ASH_BUILTIN_ECHO | ||
| 8183 | static int | ||
| 8184 | echocmd(int argc, char **argv) | ||
| 8185 | { | ||
| 8186 | return bb_echo(argc, argv); | ||
| 8187 | } | ||
| 8188 | #endif | ||
| 8203 | /* $NetBSD: memalloc.c,v 1.27 2003/01/22 20:36:04 dsl Exp $ */ | 8189 | /* $NetBSD: memalloc.c,v 1.27 2003/01/22 20:36:04 dsl Exp $ */ |
| 8204 | 8190 | ||
| 8205 | /* | 8191 | /* |
