12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- //-------------------------------------
- // clish.cpp
- //
- // A simple client for libclish
- //-------------------------------------
- #include "clish/private.h"
- static
- clish_shell_hooks_t my_hooks =
- {
- NULL, /* don't worry about init callback */
- clish_access_callback,
- NULL, /* don't worry about cmd_line callback */
- clish_script_callback,
- NULL, /* don't worry about fini callback */
- clish_config_callback,
- NULL /* don't register any builtin functions */
- };
- //---------------------------------------------------------
- int
- main(int argc, const char **argv)
- {
- int result = -1;
-
- clish_startup(argc,argv);
-
- if(argc > 1)
- {
- int i = 1;
- while(argc--)
- {
- /* run the commands in the file */
- result = clish_shell_spawn_from_file(&my_hooks,NULL,argv[i++]);
- }
- }
- else
- {
- /* spawn the shell */
- result = clish_shell_spawn_and_wait(&my_hooks,NULL);
- }
- clish_shutdown();
- return result ? 0 : -1;
- }
- //---------------------------------------------------------
|