bc: restore printing of script name on errors
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 5 Dec 2018 15:39:22 +0000 (16:39 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 5 Dec 2018 15:39:22 +0000 (16:39 +0100)
commit0409ad36a11ad51e47813b65a97e6ad68f42d381
treeb61128113f59b02e36b82847dbcdd24727842320
parent0ad36c46c7a521760e5696ba9d6e9362a1a3777c
bc: restore printing of script name on errors

Examples:

On stdin, no file name is available:
$ echo 'print "' | busybox bc
bc: string end could not be found

When the same error is in file:
$ busybox bc FILE
bc 1.30.0.git
Copyright (c) 2018 Gavin D. Howard and contributors
Report bugs at: https://github.com/gavinhoward/bc
This is free software with ABSOLUTELY NO WARRANTY
FILE: string end could not be found
ready for more input
>>>

Line number printing to be added later...

function                                             old     new   delta
bc_error_fmt                                          38      70     +32
bc_posix_error_fmt                                    60      90     +30
bc_vm_run                                           1900    1919     +19
bc_program_read                                      338     355     +17
bc_lex_file                                           15      12      -3
bc_program_stdin_name                                  8       -      -8
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 4/1 up/down: 98/-11)             Total: 87 bytes

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