tags:

views:

436

answers:

4

On a project I'm working on, I'm trying to make it accept user commands and provide history with the up arrow. I'm aiming to keep this project free of dependencies, and I don't want to have to require people to also install the readline development files just to compile my project. Does anyone know of a simple drop-in replacement for GNU Readline that provides only simple functionality?

+2  A: 

Most systems have readline installed, so I don't see that as being too much of an issue.

Secondly, I don't think there's any drop-in replacement for the GNU Readline library. You're going to have to stick with it. :(

Dan Loewenherz
Yeah, it doesn't look like I'm getting around it. I've checked the alternatives, like Editline and libtecla, but they don't satisfy the "simple" requirement. I'm just going to have to lump it.
Justin Poliey
+5  A: 

Editline. It has a BSD-style license.

EDIT: Older versions of editline were quite simple. Here's one with just two C files and a header, a total of about 1500 lines of code. We've been using it for years.

Jason Orendorff
A: 

editline(libedit) doesn't support multi-byte characters yet.

I also agree with Dan Loewenherz, the readline library is wide spread. For example, most linux distribution ships bash with readline. Most python distribution also ships with readline. If your project needs a readline-like library, it's a good idea to use GNU readline library since it's a popular choice and users may have it installed on the OS already.

weakish
+6  A: 

I found one. antirez of Redis fame has come up with linenoise, a much simpler alternative.

Justin Poliey