What obviously came to mind was the best console lib around, GNU readline. It handles tab completition, history, command editing, all the bells and whistles.
Then I remembered that in their wisdom, they made readline GPL, because it's non-essential unlike the libc for example, so that it provides incentives to GPL your app.
No point here really, just showing how I too got in that position
