aboutsummaryrefslogtreecommitdiff
path: root/shell/math.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* shell: fix parsing of $(( (v)++ + NUM ))Denys Vlasenko2021-09-261-22/+30
| | | | | | | function old new delta evaluate_string 988 1011 +23 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell: fix arithmentic evaluation of "++7" and such (it is + + 7, i.e. 7)Denys Vlasenko2021-09-251-8/+15
| | | | | | | function old new delta evaluate_string 945 988 +43 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell: remove FAST_FUNC from a static functionDenys Vlasenko2020-10-011-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell: better comments in BASE#nn codeDenys Vlasenko2019-10-221-10/+14
| | | | | | | function old new delta evaluate_string 932 930 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: fix BASE###nn bashism for bases 36..64Denys Vlasenko2019-09-221-3/+21
| | | | | | | function old new delta evaluate_string 876 932 +56 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: fix BASE###nn bashism to accept letter 'digits' for bases > 9Denys Vlasenko2019-09-221-2/+9
| | | | | | | function old new delta evaluate_string 873 876 +3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell: move all definitions of strto_arith_t() togetherDenys Vlasenko2019-05-261-3/+7
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell: implement optional "BASE#nnnn" numeric literalsDenys Vlasenko2019-05-191-0/+36
| | | | | | | function old new delta evaluate_string 729 851 +122 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell: handle $((NUM++...) like bash does. Closes 10706Denys Vlasenko2018-01-281-2/+17
| | | | | | | function old new delta evaluate_string 680 729 +49 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* do not use `a' quoting style in commentsDenys Vlasenko2017-08-021-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* typo fix in commentDenys Vlasenko2014-11-201-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash,hush: do not segfault on $((2**63 / -1))Denys Vlasenko2014-11-181-4/+23
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* move endofname() to libbbDenys Vlasenko2013-02-261-12/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* whitespace cleanup. no code changesDenys Vlasenko2013-01-141-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell/math: better comment. no code changesDenys Vlasenko2010-09-171-2/+2
| | | | Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* shell/math: deconvolute and explain ?: handling. Give better error messageDenys Vlasenko2010-09-161-108/+135
| | | | | | | function old new delta arith_apply 1271 1283 +12 Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* shell/math: return string error indicator, not integerDenys Vlasenko2010-09-151-41/+40
| | | | | | | | | | | | | | | | function old new delta expand_and_evaluate_arith 87 106 +19 expand_one_var 1563 1570 +7 arith 12 18 +6 evaluate_string 678 680 +2 arith_apply 1269 1271 +2 builtin_umask 133 132 -1 ash_arith 118 75 -43 expand_vars_to_list 1094 1038 -56 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/3 up/down: 36/-100) Total: -64 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* shell/math.c: stop using bss variableDenys Vlasenko2010-09-131-20/+34
| | | | | | | | | | | | | | | | function old new delta evaluate_string - 678 +678 expand_one_var 1543 1563 +20 builtin_type 114 116 +2 expand_and_evaluate_arith 89 87 -2 prev_chk_var_recursive 4 - -4 ash_arith 122 118 -4 arith_lookup_val 142 132 -10 arith 674 12 -662 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 2/4 up/down: 700/-682) Total: 18 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* shell/math.c: rename arith_eval_hooks to arith_state, put error code into itDenys Vlasenko2010-09-131-20/+18
| | | | | | | | | | | | | function old new delta expand_and_evaluate_arith 79 89 +10 arith 675 674 -1 arith_lookup_val 151 142 -9 ash_arith 135 122 -13 arith_apply 1304 1269 -35 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/4 up/down: 10/-58) Total: -48 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* shell/math.c: small code shrink; fixed incomprehensible commentsDenys Vlasenko2010-09-131-112/+113
| | | | | | | function old new delta arith_apply 1334 1304 -30 Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* shell: small code shrinkDenys Vlasenko2010-09-131-8/+9
| | | | | | | function old new delta arith 680 675 -5 Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* shell: shrink arith code; and prepare for returning text error codesDenys Vlasenko2010-09-131-61/+59
| | | | | | | function old new delta arith 701 680 -21 Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* shell: unify endofname() in hush and ashDenys Vlasenko2010-09-071-1/+13
| | | | | | | | | | | | | function old new delta builtin_umask 132 133 +1 changepath 195 194 -1 expand_and_evaluate_arith 77 69 -8 ash_arith 143 135 -8 expand_one_var 1551 1515 -36 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/4 up/down: 1/-53) Total: -52 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* *: make GNU licensing statement forms more regularDenys Vlasenko2010-08-161-1/+1
| | | | | | | This change retains "or later" state! No licensing _changes_ here, only form is adjusted (article, space between "GPL" and "v2" and so on). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: use ash's read builtinDenys Vlasenko2010-01-121-11/+8
| | | | | | | | | | | | | | | | | function old new delta shell_builtin_read - 1000 +1000 set_local_var_from_halves - 24 +24 setvar2 - 7 +7 ... popstring 140 134 -6 ash_main 1375 1368 -7 setvar 184 174 -10 arith_set_local_var 36 - -36 builtin_read 1096 185 -911 ------------------------------------------------------------------------------ (add/remove: 3/1 grow/shrink: 5/23 up/down: 1038/-1007) Total: 31 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell: split read builtin from ashDenys Vlasenko2010-01-121-8/+7
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash,hush: fix $RANDOM in children being repeatedDenys Vlasenko2009-10-121-1/+1
| | | | | | | | | | | | | | | | function old new delta next_random 46 68 +22 forkshell 248 263 +15 expand_vars_to_list 2118 2131 +13 run_pipe 1775 1782 +7 popstring 134 140 +6 builtin_umask 123 121 -2 ash_main 1356 1336 -20 get_local_var_value 125 104 -21 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/3 up/down: 63/-43) Total: 20 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: code shrink via NOINLINEDenys Vlasenko2009-10-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta expand_vars_to_list - 2118 +2118 lzo1x_optimize - 1429 +1429 run_pipe 358 1775 +1417 arith_apply - 1335 +1335 mainQSort3 - 1198 +1198 logdir_open - 1163 +1163 rewrite - 1039 +1039 dump_identity - 987 +987 do_shm - 884 +884 cpio_o - 863 +863 cpio_main 1450 560 -890 ipcs_main 3442 2523 -919 bb_dump_dump 2611 1488 -1123 process_dev 4572 3405 -1167 logdirs_reopen 1308 86 -1222 arith 2084 707 -1377 mainSort 2622 1202 -1420 do_lzo_compress 2276 799 -1477 run_list 2491 943 -1548 expand_variables 2280 135 -2145 ------------------------------------------------------------------------------ (add/remove: 9/0 grow/shrink: 1/10 up/down: 12433/-13288) Total: -855 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* printf: accept negative numbers for %x; sh: overflowed numbers are 0Denys Vlasenko2009-06-051-2/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: plug the leak of expanded heredocDenis Vlasenko2009-04-091-2/+1
|
* shell/math: randomconfig fixDenis Vlasenko2009-04-031-3/+3
|
* split math code out of ash and into a standalone library so we can use it in ↵Mike Frysinger2009-04-021-0/+701
any shell (like hush!)