CLI source code?

Hi,

Does anyone know of any open source code for a Command Line Interpreter that I can use for an embedded linux system I'm currently working on. I can't that people keep writing this from scratch.

Thanks in advance!

Dave M.

Reply to
David Medeiros
Loading thread data ...

Lots of people do write them from scratch: it's pretty easy. A loop full of if(strcmp()) statements over a strtok() loop is OK for many simple tasks. Or there's yacc/bison parsers if you need to get a bit fancier.

If you want something pretty fleshed out, though, tcl, several scheme interpreters (eg guile) and several forth or forth-like languages (eg ficl) or lua, or even something really meaty like python or javascript have all been used. All have open-source implementations available. Several may already be there in your embedded linux system.

How fancy do you want to get?

Cheers,

--
Andrew
Reply to
Andrew Reilly

AFAIK, the system already separates the parameters of the command line when starting a program. I seem to remember that it even tries to assign handles to the files that are denoted by the first two parameters.

But maybe I'm wrong.

-Michael

Reply to
Michael Schnell

What exactly do you mean by command line interpreter -- a shell?

If so, look at busybox:

formatting link

HTH

Rob

--
Robert Kaiser                     email: rkaiser AT sysgo DOT com
SYSGO AG                          http://www.elinos.com
Klein-Winternheim / Germany       http://www.sysgo.com
Reply to
Robert Kaiser

It's the shell that does that.

--

formatting link

Reply to
ellis

I suppose that would help David. So he needs to find out how the shell provides this information (an array of pointers ?) to to program that is started.

-Michael

Reply to
Michael Schnell

It is on the manpage:

man 3 exec

and, remember that the sub-process startup is on two phases in UNIX-like systems: fork() and exec().

--

Tauno Voipio
tauno voipio (at) iki fi
Reply to
Tauno Voipio

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.