bc: fix EOF handling in bc_program_read()