charliehorse55
charliehorse55

Reputation: 1990

C library to easily create interactive shell

I want to create a program like gdb or gnuplot that has it's own command prompt. I'm looking for a library that will handle the parsing/input validation as well as provide a command history. So far googling for this topic is difficult because any search with the terms 'c' and 'shell' will only produce results for 'csh'.

Upvotes: 4

Views: 2207

Answers (2)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798456

History is usually managed by readline or libedit. Parsing is usually done with flex/bison.

Upvotes: 3

jxh
jxh

Reputation: 70362

I can recommend CLI parser. It is quite suited for your described use case.

CLI Parser provides a framework for quickly development of Cisco-like CLI commands. It provides a simple syntax to define CLI commands, a compiler to automatically convert these commands into a C parse tree and a run-time library to create CLI.

Upvotes: 2

Related Questions