Commit Graph

1687 Commits

Author SHA1 Message Date
Stephen Heumann
f88111e789 Do newline conversion in the "echo" builtin. 2015-01-08 17:23:39 -06:00
Stephen Heumann
b4a362ef71 Make test report EXEC files (shell scripts) as executable. 2014-12-04 13:41:21 -06:00
Stephen Heumann
a549af27ca Fix test to account for GNO stat() giving only "owner" permission bits. 2014-12-04 12:22:52 -06:00
Stephen Heumann
72634b98b9 In redirection operations, map fds 0/1/2 to 1/2/3 so they work as stdin/stdout/stderr, preserving compatibility with Unix shell scripts.
Also do a similar mapping for fds passed to "read -u" and "test -t".
2014-11-20 23:12:01 -06:00
Stephen Heumann
b3a419646b Changes to handle the use of \r as newline on the IIgs. 2014-11-08 19:58:11 -06:00
Stephen Heumann
7e5a584f0c Use alternative code (also from BusyBox) for checking if the user is in a group, avoiding a call to getgroups(), which isn't supported.
This could actually be further simplified, since GNO doesn't really have group-based file permissions, but I'll leave that until later.
2014-11-04 16:24:41 -06:00
Stephen Heumann
036b92595c Address some link errors with various small changes.
The most significant change is to at use malloc instead of alloca in the code to evaluate shell arithmetic expressions in shell/math.c.
2014-11-03 23:29:34 -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
97e65e3480 Remove C99isms from coreutils/test.c.
It now compiles successfully with ORCA/C.
2014-11-02 00:39:21 -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
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
Denys Vlasenko
054f5a5b0d install: fix help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-24 22:16:24 +02:00
Aaro Koskinen
0f78d616cb install: implement -t DIR
Some packages want to install themselves using "-t" to specify
the directory (as supported by GNU coreutils). Add support for the option
for compatibility reasons.

function                                             old     new   delta
install_longopts                                      76      95     +19
install_main                                         769     777      +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 27/0)               Total: 27 bytes

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-24 02:52:08 +02:00
Ari Sundholm
fbdc167f27 df: fix -T option when ENABLE_FEATURE_HUMAN_READABLE=0
Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-20 18:55:17 +02:00
Ari Sundholm
d0cdacafa9 df: implement -T option
function                                             old     new   delta
df_main                                              863     998    +135
packed_usage                                       29827   29861     +34
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 169/0)             Total: 169 bytes

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-17 20:53:58 +02:00
Denys Vlasenko
98654b995b test: fix mishandling of "test '(' = '('" and similar
function                                             old     new   delta
test_main                                            246     350    +104

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-01 14:16:28 +02:00
Michael Gernoth
1b487ea8a6 stat: fix printing selinux context and null-dereference
busybox stat tries to always print the selinux context, even if it
is not requested which leads to a segmentation fault due to
dereferencing a null-pointer.

This also changes the format-string used to print the context to
so it actually produces useful output.

Signed-off-by: Michael Gernoth <michael@gernoth.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-27 14:08:29 +02:00
Isaac Dunham
ea23c25e96 unlink: new applet
function                                             old     new   delta
unlink_main                                            -      45     +45
packed_usage                                       29667   29686     +19

Signed-off-by: Isaac Dunham <ibid.ag@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-22 20:44:25 +02:00
Denys Vlasenko
17f8418ea7 Add conditional support for -v / --verbose
With FEATURE_VERBOSE off, practically no size change.
With it on:

function                                             old     new   delta
remove_file                                          493     556     +63
install_main                                         719     765     +46
bb_make_directory                                    383     419     +36
rmdir_main                                           162     191     +29
copy_file                                           1516    1544     +28
mv_main                                              502     525     +23
cmp_main                                             677     693     +16
bbconfig_config_bz2                                 5264    5279     +15
mkdir_main                                           158     168     +10
install_longopts                                      66      76     +10
rm_main                                              167     175      +8
nexpr                                                840     846      +6
scan_tree                                            275     280      +5
fsck_main                                           1807    1811      +4
ed_main                                             2541    2545      +4
expand_one_var                                      1574    1575      +1
swap_on_off_main                                     420     418      -2
parse_command                                       1443    1440      -3
redirect                                            1279    1274      -5
do_load                                              946     918     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 16/4 up/down: 304/-38)          Total: 266 bytes

Based on the patch by Igor Živković.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-19 16:23:50 +02:00
Denys Vlasenko
69f9567de2 shuf: trim help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07 14:41:53 +01:00
Denys Vlasenko
102f0d0d07 shuf: do not use strings for -i RANGE case
function                                             old     new   delta
shuf_main                                            482     496     +14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07 14:32:39 +01:00
Bartosz Golaszewski
190693ced1 shuf: improve help text
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07 14:07:35 +01:00
Bartosz Golaszewski
58adbb5505 shuf: fix a segfault on 'shuf -e'
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07 11:46:03 +01:00
Denys Vlasenko
2cdcb1082c shuf: new applet
function                                             old     new   delta
shuf_main                                              -     478    +478
packed_usage                                       29571   29719    +148
applet_names                                        2460    2465      +5
applet_main                                         1428    1432      +4
applet_nameofs                                       714     716      +2
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 4/0 up/down: 637/0)             Total: 637 bytes

Based on the code by Bartosz Golaszewski <bartekgola@gmail.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-05 18:56:20 +01:00
Denys Vlasenko
fca0ee5959 ls: make "ls -s DIR" show total too. Clases 4946
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-27 15:40:26 +01:00
Denys Vlasenko
69a12fa790 catv: suppress compiler warning
The warning was:
warning: typedef 'BUG_const_mismatch' locally defined but not used [-Wunused-local-typedefs]

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-03 03:27:53 +01:00
Mike Frysinger
29ed580668 uname: fix up usage documentation
The -i/-o options were missing, and the -r/-s/-v options were
incorrectly labeled as "OS" instead of "kernel".

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-01-31 00:28:42 -05:00
Bartosz Golaszewski
5c13ab41bb sort: check global flags on fallback sort
Sort now performs global reverse on fallback sort if -r is set. Before
only key local flags were checked.

function                                             old     new   delta
compare_keys                                         712     738     +26

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-19 09:10:14 +01:00
Bartosz Golaszewski
1a4d9f6521 sort.c: remove a magic number from compare_keys()
Use bitwise OR of proper flags instead.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-19 06:47:06 +01:00
Cristian Ionescu-Idbohrn
1bdbf26454 tail: adjust help/usage texts
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-10 16:26:15 +01:00
Denys Vlasenko
16ca379b55 chown: fix help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-09 17:52:13 +01:00
Michael Tokarev
22bb81fa85 expand: use printable_string instead of hard-coding implementation
function                                             old     new   delta
expand_main                                          709     690     -19

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-12-16 03:38:24 +01:00
Denys Vlasenko
327f550669 Use unsigned printf/scanf conversion where more appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-29 16:45:45 +01:00
Bartosz Golaszewski
64938011f3 tail compat: fix header printing for tail -f
Makes tail -f for multiple files display the header only if another (ie. not
currently displayed) file changed.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-16 15:02:50 +02:00
Denys Vlasenko
b5352078a7 touch: add conditional support for -h
Based on a patch by Andy <andy.padavan@gmail.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-11 11:58:33 +02:00
Denys Vlasenko
0ff0b320a2 dd: code shrink
function                                             old     new   delta
dd_main                                             1475    1469      -6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-20 12:49:28 +02:00
Denys Vlasenko
1b57fe108f dd: code shrink
function                                             old     new   delta
dd_main                                             1487    1475     -12

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-20 12:45:05 +02:00
Denys Vlasenko
f3114a3bd0 dd: code shrink
function                                             old     new   delta
write_and_stats                                       78      99     +21
dd_main                                             1496    1487      -9
full_write_or_warn                                    42       -     -42
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 21/-51)            Total: -30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-20 12:40:29 +02:00
Denys Vlasenko
90e9cfd218 dd: remove FIXME comment which is fixed now. No code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-20 12:27:19 +02:00
Denys Vlasenko
4502bb1f21 dd: code shrink
function                                             old     new   delta
dd_main                                             1001     961     -40

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-20 12:08:46 +02:00
Denys Vlasenko
5b9910f0a4 dd: fail if swab is attempted on odd-sized block
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-20 02:50:49 +02:00
Denys Vlasenko
8395bd3f52 dd: fix example in a comment. No code changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-19 10:30:55 +02:00
Denys Vlasenko
b941316ae5 dd: support conv=swab
function                                             old     new   delta
dd_main                                             1482    1520     +38
static.conv_words                                     28      33      +5
packed_usage                                       29377   29375      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-19 09:01:39 +02:00
Denys Vlasenko
4b1896cd2c dd: do not reuse local variables for unrelated values.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-19 09:00:08 +02:00
Denys Vlasenko
982e87f2fb Whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-30 11:52:58 +02:00
Denys Vlasenko
bfa6ed1bf4 catv: code shrink
catv_main                                            250     227     -23

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-30 11:41:58 +02:00
Bartosz Golaszewski
79c618c411 Refactor catv. Move visible() from stty to libbb.
Fixes the following TODO:

  stty's visible() function and catv's guts are identical. Merge them into
  an appropriate libbb function.

Also makes catv behave exactly like coreutils' cat -v e.g. it'll print 'M-^I'
instead of 'M-   '.

function                                             old     new   delta
visible                                                -      70     +70
do_display                                           431     379     -52
catv_main                                            306     250     -56
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 70/-108)           Total: -38 bytes

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-30 06:29:42 +02:00
Denys Vlasenko
c72b43c2f0 Commonalize typical [b,]k,m suffix struct
function                                             old     new   delta
bkm_suffixes                                           -      32     +32
static.km_suffixes                                    24       -     -24
suffixes                                              32       -     -32
static.bkm                                            32       -     -32
head_tail_suffixes                                    32       -     -32
------------------------------------------------------------------------------
(add/remove: 2/6 grow/shrink: 0/0 up/down: 72/-160)           Total: -88 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-13 23:49:45 +02:00
Denys Vlasenko
d87fcd4888 tail: code shrink
function                                             old     new   delta
tail_main                                           1548    1613     +65
tail_read                                            136      34    -102
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 65/-102)           Total: -37 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-08 02:39:51 +02:00
Cristian Ionescu-Idbohrn
4f9fc1e5f5 foo*sum: Correct syntax error
coreutils/md5_sha1_sum.c:156:3: error: expected '}' before 'else'

Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-07-04 11:33:42 +02:00