Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a simple alternative to Readline? [closed]

Tags:

c

readline

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?

like image 628
Justin Poliey Avatar asked Dec 10 '09 19:12

Justin Poliey


People also ask

What is lreadline?

GNU Readline is a software library that provides in-line editing and history capabilities for interactive programs with a command-line interface, such as Bash. It is currently maintained by Chet Ramey as part of the GNU Project. GNU Readline.

What is readline command?

Readline provides commands for searching through the command history for lines containing a specified string. There are two search modes: incremental and non-incremental. Incremental searches begin before the user has finished typing the search string.

What library is readline in C?

Readline is shipped as a standard library on most GNU/Linux and FreeBSD systems. It's also part of the NetBSD packages collection and the OpenBSD packages collection. The OpenPKG project makes source RPMs of readline-8.0 available for a variety of Unix and Linux systems as a base part of the current release.


2 Answers

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.

like image 197
Jason Orendorff Avatar answered Sep 28 '22 08:09

Jason Orendorff


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

like image 36
Justin Poliey Avatar answered Sep 28 '22 06:09

Justin Poliey