void Tcl_ExitThread( int status) { Tcl_FinalizeThread(); #ifdef TCL_THREADS TclpThreadExit(status); #endif }
//--------------------------------------------------------- int main(int argc, const char **argv) { int status = 0; tclish_cookie_t *cookie; clish_startup(argc,argv); if(argc > 1) { int i = 1; while((0 == status) && argc--) { cookie = tclish_cookie_new(argv[0]); /* run the commands in the file */ status = clish_shell_spawn_from_file(&my_hooks,cookie,argv[i++]); } } else { pthread_t pthread; void *dummy; cookie = tclish_cookie_new(argv[0]); /* spawn the shell */ status = clish_shell_spawn(&pthread,NULL,&my_hooks,cookie); if(-1 != status) { pthread_join(pthread,&dummy); } } if(-1 == status) { /* something went wrong */ free(cookie); } (void)Tcl_FinalizeThread(); clish_shutdown(); return status; }