Commit Graph

1671 Commits

Author SHA1 Message Date
Stephen Heumann
9850090331 Use STDERR_FILENO rather than 2 in debug print statements, so they'll properly go to stderr on GNO. 2014-11-03 19:20:20 -06:00
Stephen Heumann
488a238ad7 Add an implementation of poll() written in terms of select(), to work around the lack of poll() on GNO.
This is a BSD-licensed poll() implementation by Brian M. Clapper. Its performance characteristics aren't as good as a "native" poll() would be, but this shouldn't be a problem in practice.
2014-11-03 12:26:43 -06:00
Stephen Heumann
051b79efc1 Move all the source files to 15-character ProDOS-compatible file names.
Dmake gets confused if you use over-15-character file names, so they needed to be shortened to get it to work. While I was at it, I also switched _ to . in the filenames so they're fully ProDOS compatible.

The shell/hush_test directory (not needed to build the code) still uses ProDOS-incompatible file names.
2014-11-02 22:11:07 -06:00
Stephen Heumann
d4b2c3ce8b Various changes for GNO and ORCA/C compatibility. 2014-11-02 18:30:31 -06:00
Stephen Heumann
875b1bbd0e More GNO and ORCA/C compatibility fixes.
Everything in the shell directory now compiles.
2014-11-01 18:25:21 -05:00
Stephen Heumann
2464399542 Convert additional vfork calls to xvfork_and_run. 2014-11-01 16:59:17 -05:00
Stephen Heumann
d7a6168aa1 ORCA/C compat fixes. Variables must be at beginning of block. 2014-11-01 16:07:30 -05:00
Stephen Heumann
3577d48e74 Change the ARRAY_SIZE macro to work around an ORCA/C limitation. 2014-11-01 15:47:17 -05:00
Stephen Heumann
2b0d727f39 Include glob implementation from dietlibc.
GNO doesn't actually implement glob, although it has a header for it. The GNO header is from an old BSD version and is missing some constants we need, so don't use it.
2014-11-01 14:27:52 -05:00
Stephen Heumann
f6c7fdc027 GNO/ORCA compatiblity: remove final comma in enums, and appropriately define stuff that GNO doesn't have in platform.h. 2014-11-01 14:22:47 -05:00
Stephen Heumann
3709307794 Get rid of varargs macros in hush.c. 2014-11-01 11:25:19 -05:00
Stephen Heumann
8f6869ae25 Miscellaneous changes for ORCA/C and GNO compatibility, mainly removing C99isms.
At this point, ORCA/C can process the main header files, and some smaller source files compile without errors.
2014-11-01 09:46:02 -05:00
Stephen Heumann
b7676499be More removal of stuff that used long longs 2014-10-27 19:45:38 -05:00
Stephen Heumann
6c2c9d8865 Get rid of long longs in the the hush code (but not yet in the libraries) 2014-10-27 14:09:00 -05:00
Stephen Heumann
16c89af688 Change vfork calls to use vfork_and_run operation with GNO-compatible semantics 2014-10-27 13:10:11 -05:00
Stephen Heumann
e61b4040ec Make char unsigned, as busybox is designed for (and as ORCA/C does) 2014-10-27 00:48:59 -05:00
Stephen Heumann
a00ca4770f Eliminate or disable all the warnings given by clang -Wall 2014-10-26 23:30:51 -05:00
Stephen Heumann
472db3bd56 Delete the stuff that's irrelevant to hush. Also, include (a simplified version of) the autoconf-generated headers and a simple build script, so it can easily be build in the hush-only configuration. 2014-10-26 22:39:01 -05:00
Stephen Heumann
ef1a853400 Minimal changes to enable hush-only builds on OS X 2014-10-26 21:14:47 -05:00
Denys Vlasenko
07f7ea70ed ash: fix off-by-one in "jobs %4" handling. closes 7310
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-08 17:21:52 +02:00
Denys Vlasenko
2ec34969e7 ash: factor out ASH_HELP config option
It used to be aliased to !FEATURE_SH_EXTRA_QUIET for ash,
while hush had it separate from FEATURE_SH_EXTRA_QUIET.

Bring ash in line with hush.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-08 16:52:39 +02:00
Denys Vlasenko
e9ab07c211 ash: make ${#var} unicode-aware
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-13 18:00:08 +02:00
Denys Vlasenko
841f8331d7 ash,hush: run reinit_unicode() only if makes sense
With static Unicode support, no need to check $LANG et al.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-13 10:09:49 +02:00
Denys Vlasenko
c538d5bcc3 hush: make ${#var} unicode-aware
This mimics bash

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-13 09:57:44 +02:00
Bartosz Golaszewski
5d2e409ef8 libbb: use a wrapper around sysconf(_SC_CLK_TCK) to save a few bytes
function                                             old     new   delta
bb_sc_clk_tck                                          -      10     +10
timescmd                                             118     113      -5
print_route                                         1763    1758      -5
mpstat_main                                         1288    1283      -5
iostat_main                                         1947    1942      -5
INET_setroute                                        879     871      -8
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/5 up/down: 10/-28)            Total: -18 bytes
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-22 14:01:13 +02:00
Denys Vlasenko
3fa97af7cc ash,hush: set $HOSTNAME is bash compat. Closes 7028
function                                             old     new   delta
hush_main                                           1056    1128     +72
ash_main                                            1442    1487     +45

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-15 11:43:29 +02:00
Denys Vlasenko
109ee5d336 ash: make "locak VAR" unset VAR (bash does that)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-16 18:41:11 +01:00
Denys Vlasenko
ac03a40cba ash,hush: fix a thinko about 2^64-1 factorization
function                                             old     new   delta
next_random                                          113     119      +6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-15 09:25:46 +01:00
Denys Vlasenko
2bba591991 hush: make "true" built-in
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-14 12:43:57 +01:00
Denys Vlasenko
f93187512d random: cosmetic tweaks in debug code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-13 13:03:27 +01:00
Denys Vlasenko
fb183076a3 ash,hush: improve randomness of $RANDOM, add easy-ish way to test it
function                                             old     new   delta
next_random                                           68     113     +45
change_random                                        103     121     +18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-13 12:52:43 +01:00
Denys Vlasenko
5680e98451 ash: in bash compat mode, always export $SHLVL
function                                             old     new   delta
ash_main                                            1437    1442      +5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-07 16:12:48 +01:00
Denys Vlasenko
8bd810bd27 hush: typo fixes in comments
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-28 01:50:01 +01:00
Bernhard Reutner-Fischer
80f8cdf04a ash: Set SHLVL in ASH_BASH_COMPAT
function                                             old     new   delta
ash_main                                            1456    1505     +49
.rodata                                           148488  148494      +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 55/0)               Total: 55 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-08 14:30:20 +01:00
Bernhard Reutner-Fischer
200c1c46f4 ash: Use setvar2 some more
(add/remove: 0/0 grow/shrink: 10/15 up/down: 13/-27)          Total: -14 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-08 14:12:13 +01:00
Denys Vlasenko
25ce3ee9f3 typo fix in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-14 01:23:06 +02:00
Denys Vlasenko
e95738f635 typo fix in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-08 03:13:08 +02:00
Denys Vlasenko
2301d127a2 unicode: check $LC_CTYPE too to detect Unicode mode
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-05 22:00:57 +02:00
Denys Vlasenko
3e7ecb179b unicode: check $LC_ALL to detect Unicode mode, not only $LANG
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-02 17:30:23 +02:00
Denys Vlasenko
ff463a885d hush: fix build failure if FEATURE_EDITING=y && !HUSH_INTERACTIVE
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-12 02:45:23 +02:00
Flemming Madsen
d96ffda62e ash,hush: history builtin
function                                             old     new   delta
show_history                                           -      39     +39
builtin_history                                        -      16     +16
historycmd                                             -      13     +13
bltins1                                              312     324     +12
builtintab                                           336     344      +8
popstring                                            134     140      +6
hush_main                                           1048    1046      -2
ash_main                                            1398    1396      -2
size_from_HISTFILESIZE                                44      40      -4
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 3/3 up/down: 94/-8)              Total: 86 bytes

Signed-off-by: Flemming Madsen <busybox@themadsens.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-04-07 18:47:24 +02:00
Denys Vlasenko
3beab83e4f hush: fix for "while false && true; do echo BUG; break; done". closes 6170
function                                             old     new   delta
run_list                                             959     941     -18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-04-07 18:16:58 +02:00
Denys Vlasenko
091f831424 ash: add comment about failures in source builtin. No code changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-17 14:25:22 +01:00
Denys Vlasenko
88b532d59a hush: source builtin should override $N only if it has args
function                                             old     new   delta
builtin_source                                       174     184     +10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-17 14:11:04 +01:00
Stefan Hellermann
4ef1439c59 ash: read $HOME/.profile instead of $(pwd)/.profile
ash --login should read ~/.profile instead of .profile in the current
directory. I noticed it while trying to figure out why /root/.profile
is only read sometimes.

function                                             old     new   delta
ash_main                                            1374    1398     +24

Signed-off-by: Stefan Hellermann <stefan@the2masters.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-15 02:45:50 +01:00
Stefan Hellermann
aeb717aa5e ash: move code to allow setting $HOME in /etc/profile
move HISTFILE=$HOME/.ash_history below reading /etc/profile,
so that /etc/profile can set $HOME. HOME can be unset when
directly invoking ash --login from init without going through
getty.

Signed-off-by: Stefan Hellermann <stefan@the2masters.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-15 02:37:51 +01:00
Denys Vlasenko
1961aea305 move endofname() to libbb
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-26 00:36:53 +01:00
Denys Vlasenko
7c4b13e019 ash: revert wrong "fix" for an apparent memory leak. Closes 5822
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-17 13:02:27 +01:00
Denys Vlasenko
6830ade6aa whitespace fixes. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 13:58:01 +01:00
Denys Vlasenko
60cb48ca50 whitespace cleanup. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 15:57:44 +01:00