application. But linking to a GPL licensed library such as Readline requires the entire combined resulting application to be licensed under the GPL when distributed, to comply with section 5 of the GPL. This licensing was chosen by the FSF on the hopes that it would encourage software to switch to the GPL. An important example of an application changing its licensing to comply with the copyleft conditions of GNU Readline is CLISP, an implementation of Common Lisp. Originally released in 1987, it changed to the GPL license in 1992, after an email exchange between one of CLISP's original authors, Bruno Haible, and Richard Stallman, in which Stallman argued that the linking of readline in CLISP meant that Haible was required to re-license CLISP under the GPL if he wished to distribute the implementation of CLISP which used readline. Another response has been to not use this in some projects, making text input use the primitive Unix terminal driver for editing. Alternative libraries Alternative libraries have been created with other licenses so they can be used by software projects which want to implement command line editing functionality, but be released with a non-GPL license. Many BSD systems have a BSD-licensed libedit. MariaDB and PHP allow for the user to select at build time whether to link with GNU Readline or with libedit. linenoise is a tiny C library that provides line editing functions. Haskeline is a readline-like library for Haskell. It is mainly written for the Glasgow Haskell Compiler, but is available to other Haskell projects which need line-editing services as well. Sample code The following code is in C and must be linked against the readline library by passing a flag to the compiler: #include <stdlib.h> #include <stdio.h> #include <readline/readline.h> #include <readline/history.h> int main() { // Configure readline to auto-complete paths when the tab key is hit. rl_bind_key('\t', rl_complete); // Enable history using_history(); while (1) { // Display prompt and read input char* input = readline("prompt> "); // Check for EOF. if (!input) break; // Add input to readline history. add_history(input); // Do stuff... // Free buffer that was allocated by readline free(input); } return 0; } Bindings Non-C programming languages that provide language bindings for readline include Python's built-in module; Ruby's built-in module; Perl's third-party (CPAN) module, specifically for GNU ReadLine. Support for readline alternatives differ among these bindings. Notes References External links GNU readline homepage Things You