- the commandline interpreter (cli) used was developed specifically for this application, but it is made not in any way dependant on any other thing than c.
 
- programming with libcli
 
  
	- adding commands and variables
 
	  
		- adding a command to the interpreter is done by issuing the macro
 
		- cli_add_command("commandname", callback, "description");
 
		- where callback is a function of the form 
 
		- int callback(char *params);
 
		- the string passed to the callback is the string remaining when the command is chopped of the commandline
 
		- variables can be added with either
 
		- cli_add_int("variablename", &integer_variable, "description");
 
		- cli_add_string("variablename", &string_variable, "description");
 
		- or by calling the real add function
 
		- cli_add_item("variablename", &integerdata, &stringdata, callback, "description");
 
		- the callback will be issued whenever the variable is set, a variable can have both integer and string attached at the same time
 
	  
	- running commands
 
	  
		- when issuing cli_docmd("commandline") the interpreter will run the commandline and return with the value given to the callback function assosicated
 
		- this function is usually wrapped up in a macro making it possible to use printf style formatting
 
		- #define docmdf(args...) \
 
		  
			- do{ char buf[100];\
 
			- snprintf (buf, 99, args);\
 
			- cli_docmd(buf);\
 
			- }while(0)
 
		  
	  
	- commandline completion
 
	  
		- char *cli_complete(const char *commandline);
 
		- returns a completion fo the given commandline.
 
		- the string returned is statically allocated
 
		- if there is no match a message is printed on the output
 
		- if there is multiple matches the matches are listed on the output, and the commandline is expanded in such a manner that it rquals the first characters
 
	  
	- customisation
 
	  
		- by default cli outputs to standard output, when embedding it in an application this is often not what you want.
 
		- cli_outfun can be assigned a void functino that takes a string as parameter
 
		- cli_width should be assigned the width in characters of the output device
 
		- cli_precmd can be assigned a void function taking the commandline as a parameter to be executed before each command
 
		- cli_postcmd can be assigned a void function taking the commandline as a parameter to be executed after each command
 
	  
	- history
 
	  
		- libcli also provides a simple history facility
 
		- if you call cli_history_add("commandline"); for every function you execute,
 
		- char *cli_historyprev();
 
		- and
 
		- char *cli_historynext();
 
		- will allow you to page back and forward in the history