I think this was a better idea than trying to make libexpect C bindings.
libexpect
This library is developed in as close to the public domain as is legally possible; see LICENSE.md for more details.
LICENSE.md