A Tiny Command Line Interpreter

tinycli.c
Copy and paste the code from the text area below to tinycli.c

The above is a simple command interpreter that I built in answer to a question on the comp.compilers newsgroup.

With the above program, you can execute very simple scripts like:



   # This is a tiny interpreter


   echo Hello there!


   pause


   echo This is a very simple interpreter


   pause


   echo Buh-bye!


   exit


After you've saved the above script to a file ( such as test.txt ), you can then interpret the script by invoking a line similar to the following:



   tinycli test.txt


The interpreter understands the commands echo, pause, exit, and # ( # is a comment character ). The code could be more clean and certainly needs some error-checking.


Back to Jimbo's Demented Software

Back to Jimbo's Home Page