int main(int argc, char **argv) { #if defined (Q_OS_UNIX) && ! defined (Q_OS_MAC) // Do an early check for --nofork. We need to do this here, before // creating a QApplication, since QCommandLineParser requires one bool nofork = false; for (int i=1; i<argc; i++) { if (QString::compare("--", argv[i]) == 0) { break; } else if (QString::compare("--spawn", argv[i]) == 0) { break; } else if (QString::compare("--embed", argv[i]) == 0) { // Due to https://github.com/equalsraf/neovim-qt/issues/276 --embed // implies --nofork nofork = true; } else if (QString::compare("--nofork", argv[i]) == 0) { nofork = true; } } if (nofork) { return ui_main(argc, argv); } else { return cli_main(argc, argv); } #else return ui_main(argc, argv); #endif }
int main(int argc, char ** argv) { char * progname; if (argc > 0) { /* figure which form we're being called as */ progname = basename(argv[0]); #ifdef DBMULTI_dropbear if (strcmp(progname, "dropbear") == 0) { return dropbear_main(argc, argv); } #endif #ifdef DBMULTI_dbclient if (strcmp(progname, "dbclient") == 0 || strcmp(progname, "ssh") == 0) { return cli_main(argc, argv); } #endif #ifdef DBMULTI_dropbearkey if (strcmp(progname, "dropbearkey") == 0) { return dropbearkey_main(argc, argv); } #endif #ifdef DBMULTI_dropbearconvert if (strcmp(progname, "dropbearconvert") == 0) { return dropbearconvert_main(argc, argv); } #endif #ifdef DBMULTI_scp if (strcmp(progname, "scp") == 0) { return scp_main(argc, argv); } #endif } fprintf(stderr, "Dropbear SSH multi-purpose v%s\n" "Make a symlink pointing at this binary with one of the following names:\n" #ifdef DBMULTI_dropbear "'dropbear' - the Dropbear server\n" #endif #ifdef DBMULTI_dbclient "'dbclient' or 'ssh' - the Dropbear client\n" #endif #ifdef DBMULTI_dropbearkey "'dropbearkey' - the key generator\n" #endif #ifdef DBMULTI_dropbearconvert "'dropbearconvert' - the key converter\n" #endif #ifdef DBMULTI_scp "'scp' - secure copy\n" #endif , DROPBEAR_VERSION); exit(1); }
int main() { /* Driver initial */ system_init(); cli_main(); while(1); return 0; }
int main(int argc, char** argv) { /* -- * start the low-level network subsystem * * Note: sr recognizes the following command * line args (in getopt format) * "hs:v:p:c:t:r:l:" and doesn't * clean argv * -- */ int port = sr_init_low_level_subystem(argc, argv); /* start the command-line interface (blocks until the router terminates) */ if( cli_main( port ) == CLI_ERROR ) fprintf( stderr, "Error: unable to setup the command-line interface server\n" ); return 0; } /* -- main -- */
void cli_console() { cli_server_t server; cli_int32 s = 0, x = 0; FILE * in; FILE * out; cli_init_console_server(&server); s = server.init(); x = server.client_accept(s); server.open_stream(x,&in,&out); /*use the os to create thread*/ cli_main(CLI_SESSION_CONSOLE,in,out); server.close_stream(x,&in,&out); }
int main(int argc, char* argv[]) { struct timeval tv; int lastarg; gettimeofday(&tv, 0); srandom(tv.tv_usec ^ tv.tv_sec); set_argv0(argv[0]); lastarg = parse_args(argc, argv); if(do_show_usage) usage(0, 0); argc -= lastarg; argv += lastarg; if(argc < cli_args_min) usage(1, "Too few command-line arguments"); if(cli_args_max >= cli_args_min && argc > cli_args_max) usage(1, "Too many command-line arguments"); return cli_main(argc, argv); }
void cli_telnetd_loop(void * data) { cli_telnet_ctrl_t * t = (cli_telnet_ctrl_t*)data; FILE * in; FILE * out; CLI_ASSERT(data != NULL); if(CLI_OK == t->server->open_stream(t->socket,&in,&out)){ t->out_fd = out; cli_main(CLI_SESSION_TELNET,in,out); #ifdef CLI_OS_LINUX pthread_mutex_lock(&g_telnet_lock); #endif t->out_fd = NULL; t->valid = 0; t->server->close_stream(t->socket,&in,&out); #ifdef CLI_OS_LINUX pthread_mutex_unlock(&g_telnet_lock); #endif } }
int main( int argc, char * argv[] ) { int ret; int bindFd; char * php_ini_path = NULL; char * php_bind = NULL; int n; int climode = 0; struct timeval tv_req_begin; struct timeval tv_req_end; int slow_script_msec = 0; char time_buf[40]; #ifdef HAVE_SIGNAL_H #if defined(SIGPIPE) && defined(SIG_IGN) signal(SIGPIPE, SIG_IGN); #endif #endif #ifdef ZTS tsrm_startup(1, 1, 0, NULL); #endif zend_signal_startup(); if (argc > 1 ) { if ( parse_opt( argc, argv, &climode, &php_ini_path, &php_bind ) == -1 ) { return 1; } } if ( climode ) { lsapi_sapi_module.phpinfo_as_text = 1; } else { setArgv0(argc, argv ); } sapi_startup(&lsapi_sapi_module); #ifdef ZTS compiler_globals = ts_resource(compiler_globals_id); executor_globals = ts_resource(executor_globals_id); core_globals = ts_resource(core_globals_id); sapi_globals = ts_resource(sapi_globals_id); tsrm_ls = ts_resource(0); SG(request_info).path_translated = NULL; #endif lsapi_sapi_module.executable_location = argv[0]; /* Initialize from environment variables before processing command-line * options: the latter override the former. */ init_sapi_from_env(&lsapi_sapi_module); if ( ignore_php_ini ) lsapi_sapi_module.php_ini_ignore = 1; if ( php_ini_path ) { lsapi_sapi_module.php_ini_path_override = php_ini_path; } lsapi_sapi_module.ini_defaults = sapi_lsapi_ini_defaults; if (php_module_startup(&lsapi_sapi_module, &litespeed_module_entry, 1) == FAILURE) { #ifdef ZTS tsrm_shutdown(); #endif return FAILURE; } if ( climode ) { return cli_main(argc, argv); } if ( php_bind ) { bindFd = LSAPI_CreateListenSock( php_bind, 10 ); if ( bindFd == -1 ) { fprintf( stderr, "Failed to bind socket [%s]: %s\n", php_bind, strerror( errno ) ); exit( 2 ); } if ( bindFd != 0 ) { dup2( bindFd, 0 ); close( bindFd ); } } LSAPI_Init(); LSAPI_Init_Env_Parameters( NULL ); lsapi_mode = 1; slow_script_msec = LSAPI_Get_Slow_Req_Msecs(); if ( php_bind ) { LSAPI_No_Check_ppid(); free( php_bind ); php_bind = NULL; } while( LSAPI_Prefork_Accept_r( &g_req ) >= 0 ) { if ( slow_script_msec ) { gettimeofday( &tv_req_begin, NULL ); } ret = processReq(); if ( slow_script_msec ) { gettimeofday( &tv_req_end, NULL ); n = ((long) tv_req_end.tv_sec - tv_req_begin.tv_sec ) * 1000 + (tv_req_end.tv_usec - tv_req_begin.tv_usec) / 1000; if ( n > slow_script_msec ) { strftime( time_buf, 30, "%d/%b/%Y:%H:%M:%S", localtime( &tv_req_end.tv_sec ) ); fprintf( stderr, "[%s] Slow PHP script: %d ms\n URL: %s %s\n Query String: %s\n Script: %s\n", time_buf, n, LSAPI_GetRequestMethod(), LSAPI_GetScriptName(), LSAPI_GetQueryString(), LSAPI_GetScriptFileName() ); } } LSAPI_Finish(); if ( ret ) { break; } } php_module_shutdown(); #ifdef ZTS tsrm_shutdown(); #endif return ret; }
int main(int argc, char **argv) { puts("Build: " __DATE__ " " __TIME__); return cli_main(argc, argv); }