bc: simplify ^C handling
authorDenys Vlasenko <vda.linux@googlemail.com>
Sun, 2 Dec 2018 15:32:36 +0000 (16:32 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 5 Dec 2018 14:43:35 +0000 (15:43 +0100)
commitab3c568fd869e84a7862f3450a4690d3d7b60704
tree01090c4a6808a7e65515fb026c235c54a99e2155
parent6d9146ab56018b232a178b8fa463338cf731a832
bc: simplify ^C handling

It's still buggy: if SIGINT would interrupt e.g. output write(),
the result would not be as intended:

>>> while ( 1 ) print 1
...
11111111111111111111111111111111111111111111111111111111111111111111\
11111111111111111111111111111111111111111111111111111111111111111111\
^Cready for more input

interrupt (type "quit" to exit)
>>> bc: output error

function                                             old     new   delta
dc_parse_parse                                        58      53      -5
bc_parse_parse                                       476     471      -5
bc_num_d                                             609     604      -5
bc_num_cmp                                           299     294      -5
bc_num_compare                                        90      84      -6
bc_parse_expr                                       2222    2215      -7
bc_num_subArrays                                      82      74      -8
dc_main                                               72      62     -10
bc_main                                               72      62     -10
bc_program_exec                                     4413    4401     -12
bc_num_a                                             491     474     -17
bc_read_line                                         364     344     -20
bc_num_p                                             540     518     -22
bc_program_reset                                     192     168     -24
bc_num_k                                            1031    1005     -26
bc_vm_run                                           2382    2317     -65
bc_vm_sig                                             97       -     -97
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/16 up/down: 0/-344)          Total: -344 bytes
   text    data     bss     dec     hex filename
 989372     485    7296  997153   f3721 busybox_old
 989028     485    7296  996809   f35c9 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
miscutils/bc.c