12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #include "clish/private.h"
- static
- clish_shell_hooks_t my_hooks =
- {
- NULL,
- clish_access_callback,
- NULL,
- clish_script_callback,
- NULL,
- clish_config_callback,
- NULL
- };
- int main(int argc, const char **argv)
- {
- int result = -1;
- clish_context_t * context;
- context = clish_context_new(&my_hooks, NULL, stdin, stdout);
- if (!context) {
- fprintf(stderr, "Cannot run clish.\n");
- return -1;
- }
- if(argc > 1) {
- int i = 1;
- while(argc--) {
-
- result = clish_context_spawn_from_file(context,
- NULL, argv[i++]);
- }
- } else {
-
- result = clish_context_spawn_and_wait(context, NULL);
- }
-
- clish_context_free(context);
- return result ? 0 : -1;
- }
|