abc/src/base
Matt Liberty 66f5d7c7a2 mainUtils: match readline behavior when ABC_USE_READLINE is undefined
The non-readline branch of Abc_UtilsGetUsersInput has three behavioral
gaps versus the readline branch that break callers driving abc as a
coprocess over a pipe (e.g. yosys's passes/techmap/abc.cc, which spawns
"abc -s" with piped stdin/stdout and uses read_until_abc_done to wait
for "abc NN> <command>" lines):

  1. The prompt is written with fprintf() and never flushed. On a pipe
     stdout is fully buffered, so the prompt never reaches the reader.
     The reader waits for the prompt, abc waits in fgets(), deadlock.

  2. There is no echo of the line read from stdin. readline() emits
     each character to its output stream; yosys's protocol depends on
     seeing "abc NN> source ...\n" in the output to advance state.
     Without an echo it waits forever.

  3. EOF on stdin is silently ignored: fgets() returns NULL but the
     function returns a stale Prompt buffer, causing a tight loop on
     pipe close. The readline branch exit(0)s on NULL.

Fix all three. Echo only when stdin is not a tty -- on a tty the kernel
already echoes typed characters during cooked input, so double-echo
would be visible to interactive users.

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
2026-06-05 06:05:32 +00:00
..
abc Initial support of multi-output gates in sizing. 2026-05-08 16:03:24 -07:00
abci Add output name permutation in &cec. 2026-06-04 21:05:04 +07:00
acb Allowing the genlib reader to skip gates larger than the given size. 2024-07-10 12:59:10 -07:00
bac Fixing some warnings by adding cast from 'int' to 'size_t' in memset, memcpy, etc. 2019-03-05 15:57:50 -08:00
cba Changing declaration of Vec_Ptr_t sorting function to satisfy some compilers. 2021-09-26 11:30:54 -07:00
cmd Improvements to command "history". 2026-03-27 20:09:54 -07:00
exor Replace `#define`s with enum constants and inline functions in `exor.h` 2024-08-02 01:07:40 +00:00
io Streamlining support for multi-output gates 2026-05-08 00:45:46 -07:00
main mainUtils: match readline behavior when ABC_USE_READLINE is undefined 2026-06-05 06:05:32 +00:00
pla Cosmetic changes after incorporating new code of 'fxch'. 2016-05-11 20:03:13 -07:00
test Updating project settings to have simpler include paths. 2012-07-07 20:14:12 -07:00
ver support primitive gates with names in Verilog netlist 2025-05-12 10:20:13 -04:00
wlc Bug fix in %blast. 2026-04-06 20:42:44 -07:00
wln Add output name permutation in &cec. 2026-06-04 21:05:04 +07:00