int main(int argc, char **argv) { check_files(); #ifdef HAVE_SOCKS SOCKSinit(argv[0]); #endif #ifdef ENABLE_NLS /* initialize the i18n stuff */ bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); #endif textui_init(); args_execute(argc, argv); if (!init_screen()) g_error(_("Can't initialize screen handling, quitting.\n")); textui_finish_init(); main_loop = g_main_new(TRUE); g_main_run(main_loop); g_main_destroy(main_loop); textui_deinit(); #ifdef MEM_DEBUG ig_mem_profile(); #endif return 0; }
int main(int argc, char **argv) { core_init_paths(argc, argv); #ifdef HAVE_SOCKS SOCKSinit(argv[0]); #endif noui_init(); args_execute(argc, argv); if (autoload_module == NULL) autoload_module = "bot"; do { reload = FALSE; module_load(autoload_module, NULL); main_loop = g_main_new(TRUE); g_main_run(main_loop); g_main_destroy(main_loop); } while (reload); noui_deinit(); return 0; }
int FTPInitLibrary(const FTPLIPtr lip) { struct servent *ftp; if (lip == NULL) return (kErrBadParameter); (void) memset(lip, 0, sizeof(FTPLibraryInfo)); if ((ftp = getservbyname("ftp", "tcp")) == NULL) lip->defaultPort = (unsigned int) kDefaultFTPPort; else lip->defaultPort = (unsigned int) ntohs(ftp->s_port); lip->init = 1; (void) STRNCPY(lip->magic, kLibraryMagic); /* We'll initialize the defaultAnonPassword field * later when we try the first anon ftp connection. */ #ifdef HAVE_LIBSOCKS SOCKSinit("libncftp"); lip->socksInit = 1; #endif return (kNoErr); } /* FTPInitLibrary */
int main(int argc, char **argv) { static GOptionEntry options[] = { { "load", 'l', 0, G_OPTION_ARG_STRING, &autoload_module, "Module to load (default = bot)", "MODULE" }, { NULL } }; autoload_module = NULL; core_register_options(); args_register(options); args_execute(argc, argv); core_preinit(argv[0]); #ifdef HAVE_SOCKS SOCKSinit(argv[0]); #endif noui_init(); if (autoload_module == NULL) autoload_module = "bot"; do { reload = FALSE; module_load(autoload_module, NULL); main_loop = g_main_new(TRUE); g_main_run(main_loop); g_main_destroy(main_loop); } while (reload); noui_deinit(); return 0; }
int main (int argc, char *argv[]) { #ifdef SOCKS SOCKSinit (argv[0]); #endif if (!fe_args (argc, argv)) return 0; load_config (); fe_init (); xchat_init (); fe_main (); #ifdef USE_OPENSSL if (ctx) _SSL_context_free (ctx); #endif #ifdef USE_DEBUG xchat_mem_list (); #endif #ifdef WIN32 WSACleanup (); #endif return 0; }
int main(int argc, char **argv) { static struct poptOption options[] = { { "dummy", 'd', POPT_ARG_NONE, &dummy, 0, "Use the dummy terminal mode", NULL }, { NULL, '\0', 0, NULL } }; dummy = FALSE; quitting = FALSE; core_init_paths(argc, argv); check_files(); #ifdef WIN32 winsock_init(); #endif #ifdef HAVE_SOCKS SOCKSinit(argv[0]); #endif #ifdef ENABLE_NLS /* initialize the i18n stuff */ bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); #endif textui_init(); args_register(options); args_execute(argc, argv); if (!dummy && !term_init()) { fprintf(stderr, "Can't initialize screen handling, quitting.\n"); fprintf(stderr, "You can still use the dummy mode with -d parameter\n"); return 1; } textui_finish_init(); main_loop = g_main_new(TRUE); /* Does the same as g_main_run(main_loop), except we can call our dirty-checker after each iteration */ while (!quitting) { g_main_iteration(TRUE); if (reload_config) { /* SIGHUP received, do /RELOAD */ reload_config = FALSE; signal_emit("command reload", 1, ""); } dirty_check(); } g_main_destroy(main_loop); textui_deinit(); session_upgrade(); /* if we /UPGRADEd, start the new process */ return 0; }
/* * call-seq: * SOCKSSocket.new(host, serv) => socket * * Opens a SOCKS connection to +host+ via the SOCKS server +serv+. * */ static VALUE socks_init(VALUE sock, VALUE host, VALUE serv) { static int init = 0; if (init == 0) { SOCKSinit("ruby"); init = 1; } return rsock_init_inetsock(sock, host, serv, Qnil, Qnil, INET_SOCKS); }
int ne_sock_init(void) { #ifdef WIN32 WORD wVersionRequested; WSADATA wsaData; int err; #endif if (init_state > 0) { init_state++; return 0; } else if (init_state < 0) { return -1; } #ifdef WIN32 wVersionRequested = MAKEWORD(2, 2); err = WSAStartup(wVersionRequested, &wsaData); if (err != 0) { return init_state = -1; } #ifdef HAVE_SSPI if (ne_sspi_init() < 0) { return init_state = -1; } #endif #endif #ifdef NE_HAVE_SOCKS SOCKSinit("neon"); #endif #if defined(HAVE_SIGNAL) && defined(SIGPIPE) (void) signal(SIGPIPE, SIG_IGN); #endif #ifdef USE_CHECK_IPV6 init_ipv6(); #endif #ifdef NE_HAVE_SSL if (ne__ssl_init()) { return init_state = -1; } #endif init_state = 1; return 0; }
int main (int argc, char *argv[]) { int ret; srand (time (0)); /* CL: do this only once! */ #ifdef SOCKS SOCKSinit (argv[0]); #endif ret = fe_args (argc, argv); if (ret != -1) return ret; #ifdef USE_DBUS xchat_remote (); #endif load_config (); #ifdef USE_LIBPROXY libproxy_factory = px_proxy_factory_new(); #endif fe_init (); xchat_init (); fe_main (); #ifdef USE_LIBPROXY px_proxy_factory_free(libproxy_factory); #endif #ifdef USE_OPENSSL if (ctx) _SSL_context_free (ctx); #endif #ifdef USE_DEBUG xchat_mem_list (); #endif #ifdef WIN32 WSACleanup (); #endif return 0; }
int ne_sock_init(void) { #ifdef WIN32 WORD wVersionRequested; WSADATA wsaData; int err; #endif if (init_result > 0) return 0; else if (init_result < 0) return -1; #ifdef WIN32 wVersionRequested = MAKEWORD(2, 2); err = WSAStartup(wVersionRequested, &wsaData); if (err != 0) { init_result = -1; return -1; } #endif #ifdef NEON_SOCKS SOCKSinit("neon"); #endif #if defined(HAVE_SIGNAL) && defined(SIGPIPE) (void) signal(SIGPIPE, SIG_IGN); #endif #ifdef USE_GETADDRINFO init_ipv6(); #endif #ifdef NEON_SSL if (init_ssl()) { NE_DEBUG(NE_DBG_SOCKET, "SSL initialization failed; lacking PRNG?\n"); init_result = -1; return -1; } prng_seeded = 1; #endif init_result = 1; return 0; }
int main (int argc, char *argv[]) { int ret; g_thread_init(NULL); mowgli_init(); #ifdef _WIN32 conspire_init_winsock(); #endif #ifdef GNUTLS gnutls_global_init (); #endif srand (time (0)); /* CL: do this only once! */ #ifdef SOCKS SOCKSinit (argv[0]); #endif ret = fe_args (argc, argv); if (ret != -1) return ret; load_config (); fe_init (); xchat_init (); fe_main (); #ifdef GNUTLS gnutls_global_deinit (); #endif #ifdef USE_DEBUG xchat_mem_list (); #endif return 0; }
int main(int argc, const char *argv[]) { int ret; #ifdef SOCKS SOCKSinit(argv[0]); #endif cmdargParse(argv); if (!pre_init_modemu()) return 0; init_modemu(); do { ret = run_modemu(); usleep(10000); } while (ret == 2); return ret; }
int main (int argc, char *argv[]) { int ret; srand (time (0)); /* CL: do this only once! */ #ifdef SOCKS SOCKSinit (argv[0]); #endif ret = fe_args (argc, argv); if (ret != -1) return ret; #ifdef USE_DBUS xchat_remote (); #endif load_config (); fe_init (); xchat_init (); fe_main (); #ifdef USE_OPENSSL if (ctx) _SSL_context_free (ctx); #endif #ifdef USE_DEBUG xchat_mem_list (); #endif return 0; }
int main(int argc, char **argv) { #ifdef HAVE_SOCKS SOCKSinit(argv[0]); #endif textui_init(); args_execute(argc, argv); if (!init_screen()) g_error(_("Can't initialize screen handling, quitting.\n")); textui_finish_init(); main_loop = g_main_new(TRUE); g_main_run(main_loop); g_main_destroy(main_loop); textui_deinit(); #ifdef MEM_DEBUG ig_mem_profile(); #endif return 0; }
int main (int argc, char *argv[]) { int ret; #ifdef WIN32 char hexchat_lang[13]; /* LC_ALL= plus 5 chars of gui_lang and trailing \0 */ HANDLE mutex; #endif srand (time (0)); /* CL: do this only once! */ load_config (); #ifdef WIN32 /* we MUST do this after load_config () AND before fe_init (thus gtk_init) otherwise it will fail */ strcpy (hexchat_lang, "LC_ALL="); switch (prefs.gui_lang) { case 0: strcat (hexchat_lang, "sq"); break; case 1: strcat (hexchat_lang, "am"); break; case 2: strcat (hexchat_lang, "az"); break; case 3: strcat (hexchat_lang, "eu"); break; case 4: strcat (hexchat_lang, "be"); break; case 5: strcat (hexchat_lang, "bg"); break; case 6: strcat (hexchat_lang, "ca"); break; case 7: strcat (hexchat_lang, "zh_CN"); break; case 8: strcat (hexchat_lang, "zh_TW"); break; case 9: strcat (hexchat_lang, "cs"); break; case 10: strcat (hexchat_lang, "nl"); break; case 11: strcat (hexchat_lang, "en_GB"); break; case 12: strcat (hexchat_lang, "en_US"); break; case 13: strcat (hexchat_lang, "et"); break; case 14: strcat (hexchat_lang, "fi"); break; case 15: strcat (hexchat_lang, "fr"); break; case 16: strcat (hexchat_lang, "gl"); break; case 17: strcat (hexchat_lang, "de"); break; case 18: strcat (hexchat_lang, "el"); break; case 19: strcat (hexchat_lang, "hi"); break; case 20: strcat (hexchat_lang, "hu_HU"); break; case 21: strcat (hexchat_lang, "it"); break; case 22: strcat (hexchat_lang, "ja"); break; case 23: strcat (hexchat_lang, "kn"); break; case 24: strcat (hexchat_lang, "ko"); break; case 25: strcat (hexchat_lang, "lv"); break; case 26: strcat (hexchat_lang, "lt"); break; case 27: strcat (hexchat_lang, "mk"); break; case 28: strcat (hexchat_lang, "ms"); break; case 29: strcat (hexchat_lang, "nb"); break; case 30: strcat (hexchat_lang, "no"); break; case 31: strcat (hexchat_lang, "pl"); break; case 32: strcat (hexchat_lang, "pt"); break; case 33: strcat (hexchat_lang, "pt_BR"); break; case 34: strcat (hexchat_lang, "pa"); break; case 35: strcat (hexchat_lang, "ru"); break; case 36: strcat (hexchat_lang, "sr"); break; case 37: strcat (hexchat_lang, "sk"); break; case 38: strcat (hexchat_lang, "sl"); break; case 39: strcat (hexchat_lang, "es"); break; case 40: strcat (hexchat_lang, "sv"); break; case 41: strcat (hexchat_lang, "th"); break; case 42: strcat (hexchat_lang, "uk"); break; case 43: strcat (hexchat_lang, "vi"); break; case 44: strcat (hexchat_lang, "wa"); break; default: strcat (hexchat_lang, "en_US"); break; } putenv (hexchat_lang); if (prefs.gui_one_instance && !portable_mode ()) { DWORD error; mutex = CreateMutex (NULL, TRUE, "Local\\hexchat"); error = GetLastError (); if (error == ERROR_ALREADY_EXISTS || mutex == NULL) { /* restoring the XChat window from the tray via the taskbar icon * only works correctly when X-Tray is used, but it's not a big deal * since you can only minimize XChat to tray via the taskbar if you * use X-Tray*/ if (hextray_mode ()) { /* FindWindow() doesn't support wildcards so we check all the open windows */ EnumWindows (enum_windows_impl, NULL); return 0; } else { return 1; } } } #endif #ifdef SOCKS SOCKSinit (argv[0]); #endif ret = fe_args (argc, argv); if (ret != -1) return ret; #ifdef USE_DBUS xchat_remote (); #endif #ifdef USE_LIBPROXY libproxy_factory = px_proxy_factory_new(); #endif fe_init (); xchat_init (); fe_main (); #ifdef USE_LIBPROXY px_proxy_factory_free(libproxy_factory); #endif #ifdef USE_OPENSSL if (ctx) _SSL_context_free (ctx); #endif #ifdef USE_DEBUG xchat_mem_list (); #endif #ifdef WIN32 WSACleanup (); if (prefs.gui_one_instance && !portable_mode ()) { ReleaseMutex (mutex); CloseHandle (mutex); } #endif return 0; }
int main (int argc, char *argv[]) { int i; int ret; srand (time (0)); /* CL: do this only once! */ /* We must check for the config dir parameter, otherwise load_config() will behave incorrectly. * load_config() must come before fe_args() because fe_args() calls gtk_init() which needs to * know the language which is set in the config. The code below is copy-pasted from fe_args() * for the most part. */ if (argc >= 3) { for (i = 1; i < argc - 1; i++) { if (strcmp (argv[i], "-d") == 0) { if (xdir) { g_free (xdir); } xdir = strdup (argv[i + 1]); if (xdir[strlen (xdir) - 1] == G_DIR_SEPARATOR) { xdir[strlen (xdir) - 1] = 0; } } } } #if ! GLIB_CHECK_VERSION (2, 36, 0) g_type_init (); #endif if (check_config_dir () == 0) { if (load_config () != 0) load_default_config (); } else { /* this is probably the first run */ load_default_config (); make_config_dirs (); make_dcc_dirs (); } /* we MUST do this after load_config () AND before fe_init (thus gtk_init) otherwise it will fail */ set_locale (); #ifdef SOCKS SOCKSinit (argv[0]); #endif ret = fe_args (argc, argv); if (ret != -1) return ret; #ifdef USE_DBUS hexchat_remote (); #endif #ifdef USE_LIBPROXY libproxy_factory = px_proxy_factory_new(); #endif fe_init (); /* This is done here because cfgfiles.c is too early in * the startup process to use gtk functions. */ if (g_access (get_xdir (), W_OK) != 0) { char buf[2048]; g_snprintf (buf, sizeof(buf), _("You do not have write access to %s. Nothing from this session can be saved."), get_xdir ()); fe_message (buf, FE_MSG_ERROR); } #ifndef WIN32 #ifndef __EMX__ /* OS/2 uses UID 0 all the time */ if (getuid () == 0) fe_message (_("* Running IRC as root is stupid! You should\n" " create a User Account and use that to login.\n"), FE_MSG_WARN|FE_MSG_WAIT); #endif #endif /* !WIN32 */ xchat_init (); fe_main (); #ifdef USE_LIBPROXY px_proxy_factory_free(libproxy_factory); #endif #ifdef WIN32 WSACleanup (); #endif return 0; }
int main (int argc, char *argv[]) { int i; int ret; srand (time (0)); /* CL: do this only once! */ /* We must check for the config dir parameter, otherwise load_config() will behave incorrectly. * load_config() must come before fe_args() because fe_args() calls gtk_init() which needs to * know the language which is set in the config. The code below is copy-pasted from fe_args() * for the most part. */ if (argc >= 3) { for (i = 1; i < argc - 1; i++) { if (strcmp (argv[i], "-d") == 0) { if (xdir) { g_free (xdir); } xdir = strdup (argv[i + 1]); if (xdir[strlen (xdir) - 1] == G_DIR_SEPARATOR) { xdir[strlen (xdir) - 1] = 0; } } } } #if ! GLIB_CHECK_VERSION (2, 36, 0) g_type_init (); #endif if (check_config_dir () == 0) { if (load_config () != 0) load_default_config (); } else { /* this is probably the first run */ load_default_config (); make_config_dirs (); /* FIXME: if this fail display an error (?) */ make_dcc_dirs (); } /* we MUST do this after load_config () AND before fe_init (thus gtk_init) otherwise it will fail */ set_locale (); #ifdef SOCKS SOCKSinit (argv[0]); #endif ret = fe_args (argc, argv); if (ret != -1) return ret; #ifdef USE_DBUS hexchat_remote (); #endif #ifdef USE_LIBPROXY libproxy_factory = px_proxy_factory_new(); #endif fe_init (); #ifndef WIN32 #ifndef __EMX__ /* OS/2 uses UID 0 all the time */ if (getuid () == 0) fe_message (_("* Running IRC as root is stupid! You should\n" " create a User Account and use that to login.\n"), FE_MSG_WARN|FE_MSG_WAIT); #endif #endif /* !WIN32 */ xchat_init (); fe_main (); #ifdef USE_LIBPROXY px_proxy_factory_free(libproxy_factory); #endif #ifdef USE_OPENSSL if (ctx) _SSL_context_free (ctx); #endif #ifdef USE_DEBUG hexchat_mem_list (); #endif #ifdef WIN32 WSACleanup (); #endif return 0; }
int whois_main(int argc, char *argv[]) { const char *country, *host; char *qnichost; int ch, flags, use_qnichost; #ifdef SOCKS SOCKSinit(argv[0]); #endif country = host = qnichost = NULL; flags = use_qnichost = 0; optind = 1; // initialize for getopt while ((ch = getopt(argc, argv, "aAbc:dgh:iIlmp:QrR6")) != -1) { switch (ch) { case 'a': host = ANICHOST; break; case 'A': host = PNICHOST; break; case 'b': host = ABUSEHOST; break; case 'c': country = optarg; break; case 'd': host = DNICHOST; break; case 'g': host = GNICHOST; break; case 'h': host = optarg; break; case 'i': host = INICHOST; break; case 'I': host = IANAHOST; break; case 'l': host = LNICHOST; break; case 'm': host = MNICHOST; break; case 'p': port = optarg; break; case 'Q': flags |= WHOIS_QUICK; break; case 'r': host = RNICHOST; break; case 'R': warnx("-R is deprecated; use '-c ru' instead"); country = "ru"; break; case '6': host = SNICHOST; break; case '?': default: usage(); /* NOTREACHED */ } } argc -= optind; argv += optind; if (!argc || (country != NULL && host != NULL)) usage(); /* * If no host or country is specified determine the top level domain * from the query. If the TLD is a number, query ARIN. Otherwise, use * TLD.whois-server.net. If the domain does not contain '.', fall * back to NICHOST. */ if (host == NULL && country == NULL) { use_qnichost = 1; host = NICHOST; if (!(flags & WHOIS_QUICK)) flags |= WHOIS_RECURSE; } while (argc-- > 0) { if (country != NULL) { s_asprintf(&qnichost, "%s%s", country, QNICHOST_TAIL); whois(*argv, qnichost, flags); } else if (use_qnichost) if ((qnichost = choose_server(*argv)) != NULL) whois(*argv, qnichost, flags); if (qnichost == NULL) whois(*argv, host, flags); free(qnichost); qnichost = NULL; argv++; } exit(0); return 0; }
int main(int argc, char *argv[]) { const char *country, *host; int ch, flags; #ifdef SOCKS SOCKSinit(argv[0]); #endif country = host = NULL; flags = 0; while ((ch = getopt(argc, argv, "aAbc:fgh:iIklmp:PQrRS")) != -1) { switch (ch) { case 'a': host = ANICHOST; break; case 'A': host = PNICHOST; break; case 'b': host = ABUSEHOST; break; case 'c': country = optarg; break; case 'f': host = FNICHOST; break; case 'g': host = GNICHOST; break; case 'h': host = optarg; break; case 'i': host = INICHOST; break; case 'I': host = IANAHOST; break; case 'k': host = KNICHOST; break; case 'l': host = LNICHOST; break; case 'm': host = MNICHOST; break; case 'p': port = optarg; break; case 'P': host = PDBHOST; break; case 'Q': flags |= WHOIS_QUICK; break; case 'r': host = RNICHOST; break; case 'R': flags |= WHOIS_RECURSE; break; case 'S': flags |= WHOIS_SPAM_ME; break; case '?': default: usage(); /* NOTREACHED */ } } argc -= optind; argv += optind; if (!argc || (country != NULL && host != NULL)) usage(); /* * If no host or country is specified, rely on referrals from IANA. */ if (host == NULL && country == NULL) { if ((host = getenv("WHOIS_SERVER")) == NULL && (host = getenv("RA_SERVER")) == NULL) { if (!(flags & WHOIS_QUICK)) flags |= WHOIS_RECURSE; } } while (argc-- > 0) { if (country != NULL) { char *qnichost; s_asprintf(&qnichost, "%s%s", country, QNICHOST_TAIL); whois(*argv, qnichost, flags); free(qnichost); } else whois(*argv, host != NULL ? host : choose_server(*argv), flags); argv++; } exit(0); }
int main(int argc, char **argv) { int greeting = TRUE; #ifdef SOCKS SOCKSinit(argv[0]); #endif if (signal(SIGTERM, trap_handler) == BADSIG) { syserr("signal SIGTERM"); } if (signal(SIGSEGV, trap_handler) == BADSIG) { syserr("signal SIGSEGV"); } if (signal(SIGHUP, trap_handler) == BADSIG) { syserr("signal SIGHUP"); } if (signal(SIGABRT, abort_handler) == BADSIG) { syserr("signal SIGTERM"); } if (signal(SIGINT, abort_handler) == BADSIG) { syserr("signal SIGINT"); } if (signal(SIGTSTP, suspend_handler) == BADSIG) { syserr("signal SIGSTOP"); } if (signal(SIGPIPE, pipe_handler) == BADSIG) { syserr("signal SIGPIPE"); } if (signal(SIGWINCH, winch_handler) == BADSIG) { syserr("signal SIGWINCH"); } /* if (getenv("HOME") != NULL) { char filename[256]; sprintf(filename, "%s/%s", getenv("HOME"), HISTORY_FILE); read_history(gts, filename); } */ srand(time(NULL)); if (argc > 1) { int c; while ((c = getopt(argc, argv, "e: G h r: s: t: v")) != EOF) { if (c == 'G') { greeting = FALSE; } } optind = 1; } init_tintin(greeting); if (argc > 1) { int c; optind = 1; while ((c = getopt(argc, argv, "e: G h r: s: t: v")) != EOF) { switch (c) { case 'e': gtd->ses = script_driver(gtd->ses, -1, optarg); break; case 'G': break; case 'h': tintin_printf(NULL, "Usage: %s [OPTION]... [FILE]...", argv[0]); tintin_printf(NULL, ""); tintin_printf(NULL, " -e Execute given command."); tintin_printf(NULL, " -G Don't show the greeting screen."); tintin_printf(NULL, " -h This help section."); tintin_printf(NULL, " -r Read given file."); tintin_printf(NULL, " -t Set given title."); tintin_printf(NULL, " -v Enable verbose mode."); restore_terminal(); exit(1); break; case 'r': gtd->ses = do_read(gtd->ses, optarg); break; case 't': printf("\033]0;%s\007", optarg); break; case 's': srand((unsigned int) atoll(optarg)); break; case 'v': do_configure(gtd->ses, "{VERBOSE} {ON}"); break; default: tintin_printf(NULL, "Unknown option '%c'.", c); break; } } if (argv[optind] != NULL) { gtd->ses = do_read(gtd->ses, argv[optind]); } } check_all_events(gts, SUB_ARG|SUB_SEC, 0, 2, "PROGRAM START", CLIENT_NAME, CLIENT_VERSION); check_all_events(gts, SUB_ARG|SUB_SEC, 0, 2, "SCREEN RESIZE", ntos(gts->cols), ntos(gts->rows)); mainloop(); return 0; }
int main (int argc, char *argv[]) { int i; int ret; #ifdef WIN32 char hexchat_lang[13]; /* LC_ALL= plus 5 chars of hex_gui_lang and trailing \0 */ #endif srand (time (0)); /* CL: do this only once! */ /* We must check for the config dir parameter, otherwise load_config() will behave incorrectly. * load_config() must come before fe_args() because fe_args() calls gtk_init() which needs to * know the language which is set in the config. The code below is copy-pasted from fe_args() * for the most part. */ if (argc >= 3) { for (i = 1; i < argc - 1; i++) { if (strcmp (argv[i], "-d") == 0) { if (xdir) { g_free (xdir); } xdir = strdup (argv[i + 1]); if (xdir[strlen (xdir) - 1] == G_DIR_SEPARATOR) { xdir[strlen (xdir) - 1] = 0; } } } } #if ! GLIB_CHECK_VERSION (2, 36, 0) g_type_init (); #endif load_config (); #ifdef WIN32 /* we MUST do this after load_config () AND before fe_init (thus gtk_init) otherwise it will fail */ strcpy (hexchat_lang, "LC_ALL="); /* this must be ordered EXACTLY as langsmenu[] */ switch (prefs.hex_gui_lang) { case 0: strcat (hexchat_lang, "af"); break; case 1: strcat (hexchat_lang, "sq"); break; case 2: strcat (hexchat_lang, "am"); break; case 3: strcat (hexchat_lang, "ast"); break; case 4: strcat (hexchat_lang, "az"); break; case 5: strcat (hexchat_lang, "eu"); break; case 6: strcat (hexchat_lang, "be"); break; case 7: strcat (hexchat_lang, "bg"); break; case 8: strcat (hexchat_lang, "ca"); break; case 9: strcat (hexchat_lang, "zh_CN"); break; case 10: strcat (hexchat_lang, "zh_TW"); break; case 11: strcat (hexchat_lang, "cs"); break; case 12: strcat (hexchat_lang, "da"); break; case 13: strcat (hexchat_lang, "nl"); break; case 14: strcat (hexchat_lang, "en_GB"); break; case 15: strcat (hexchat_lang, "en"); break; case 16: strcat (hexchat_lang, "et"); break; case 17: strcat (hexchat_lang, "fi"); break; case 18: strcat (hexchat_lang, "fr"); break; case 19: strcat (hexchat_lang, "gl"); break; case 20: strcat (hexchat_lang, "de"); break; case 21: strcat (hexchat_lang, "el"); break; case 22: strcat (hexchat_lang, "gu"); break; case 23: strcat (hexchat_lang, "hi"); break; case 24: strcat (hexchat_lang, "hu"); break; case 25: strcat (hexchat_lang, "id"); break; case 26: strcat (hexchat_lang, "it"); break; case 27: strcat (hexchat_lang, "ja"); break; case 28: strcat (hexchat_lang, "kn"); break; case 29: strcat (hexchat_lang, "rw"); break; case 30: strcat (hexchat_lang, "ko"); break; case 31: strcat (hexchat_lang, "lv"); break; case 32: strcat (hexchat_lang, "lt"); break; case 33: strcat (hexchat_lang, "mk"); break; case 34: strcat (hexchat_lang, "ml"); break; case 35: strcat (hexchat_lang, "ms"); break; case 36: strcat (hexchat_lang, "nb"); break; case 37: strcat (hexchat_lang, "no"); break; case 38: strcat (hexchat_lang, "pl"); break; case 39: strcat (hexchat_lang, "pt"); break; case 40: strcat (hexchat_lang, "pt_BR"); break; case 41: strcat (hexchat_lang, "pa"); break; case 42: strcat (hexchat_lang, "ru"); break; case 43: strcat (hexchat_lang, "sr"); break; case 44: strcat (hexchat_lang, "sk"); break; case 45: strcat (hexchat_lang, "sl"); break; case 46: strcat (hexchat_lang, "es"); break; case 47: strcat (hexchat_lang, "sv"); break; case 48: strcat (hexchat_lang, "th"); break; case 49: strcat (hexchat_lang, "uk"); break; case 50: strcat (hexchat_lang, "vi"); break; case 51: strcat (hexchat_lang, "wa"); break; default: strcat (hexchat_lang, "en"); break; } putenv (hexchat_lang); #endif #ifdef SOCKS SOCKSinit (argv[0]); #endif ret = fe_args (argc, argv); if (ret != -1) return ret; #ifdef USE_DBUS hexchat_remote (); #endif #ifdef USE_LIBPROXY libproxy_factory = px_proxy_factory_new(); #endif fe_init (); xchat_init (); fe_main (); #ifdef USE_LIBPROXY px_proxy_factory_free(libproxy_factory); #endif #ifdef USE_OPENSSL if (ctx) _SSL_context_free (ctx); #endif #ifdef USE_DEBUG hexchat_mem_list (); #endif #ifdef WIN32 WSACleanup (); #endif return 0; }
int main(int argc, char **argv) { static int version = 0; static GOptionEntry options[] = { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, "Use the dummy terminal mode", NULL }, { "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Display irssi version", NULL }, { NULL } }; #ifdef USE_GC g_mem_set_vtable(&gc_mem_table); #endif core_register_options(); fe_common_core_register_options(); args_register(options); args_execute(argc, argv); if (version) { printf(PACKAGE_TARNAME" " PACKAGE_VERSION" (%d %04d)\n", IRSSI_VERSION_DATE, IRSSI_VERSION_TIME); return 0; } srand(time(NULL)); dummy = FALSE; quitting = FALSE; core_preinit(argv[0]); check_files(); #ifdef WIN32 winsock_init(); #endif #ifdef HAVE_SOCKS SOCKSinit(argv[0]); #endif /* setlocale() must be called at the beginning before any calls that affect it, especially regexps seem to break if they're generated before this call. locales aren't actually used for anything else than autodetection of UTF-8 currently.. furthermore to get the users's charset with g_get_charset() properly you have to call setlocale(LC_ALL, "") */ setlocale(LC_ALL, ""); textui_init(); if (!dummy && !term_init()) { fprintf(stderr, "Can't initialize screen handling, quitting.\n"); fprintf(stderr, "You can still use the dummy mode with -d parameter\n"); return 1; } textui_finish_init(); main_loop = g_main_new(TRUE); /* Does the same as g_main_run(main_loop), except we can call our dirty-checker after each iteration */ while (!quitting) { #ifdef USE_GC GC_collect_a_little(); #endif if (!dummy) term_refresh_freeze(); g_main_iteration(TRUE); if (!dummy) term_refresh_thaw(); if (reload_config) { /* SIGHUP received, do /RELOAD */ reload_config = FALSE; signal_emit("command reload", 1, ""); } dirty_check(); } g_main_destroy(main_loop); textui_deinit(); session_upgrade(); /* if we /UPGRADEd, start the new process */ return 0; }
int main(int argc, char **argv) { static struct poptOption options[] = { { "dummy", 'd', POPT_ARG_NONE, &dummy, 0, "Use the dummy terminal mode", NULL }, { NULL, '\0', 0, NULL } }; dummy = FALSE; quitting = FALSE; core_init_paths(argc, argv); check_files(); #ifdef WIN32 winsock_init(); #endif #ifdef HAVE_SOCKS SOCKSinit(argv[0]); #endif #ifdef ENABLE_NLS /* initialize the i18n stuff */ bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); #endif /* setlocale() must be called at the beginning before any calls that affect it, especially regexps seem to break if they're generated before t his call. locales aren't actually used for anything else than autodetection of UTF-8 currently.. */ setlocale(LC_CTYPE, ""); textui_init(); args_register(options); args_execute(argc, argv); if (!dummy && !term_init()) { fprintf(stderr, "Can't initialize screen handling, quitting.\n"); fprintf(stderr, "You can still use the dummy mode with -d parameter\n"); return 1; } textui_finish_init(); main_loop = g_main_new(TRUE); /* Does the same as g_main_run(main_loop), except we can call our dirty-checker after each iteration */ while (!quitting) { if (!dummy) term_refresh_freeze(); g_main_iteration(TRUE); if (!dummy) term_refresh_thaw(); if (reload_config) { /* SIGHUP received, do /RELOAD */ reload_config = FALSE; signal_emit("command reload", 1, ""); } dirty_check(); } g_main_destroy(main_loop); textui_deinit(); session_upgrade(); /* if we /UPGRADEd, start the new process */ return 0; }
int main(int argc, char **argv) { static int version = 0; static GOptionEntry options[] = { { "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Display Irssi version", NULL }, { NULL } }; int loglev; core_register_options(); fe_common_core_register_options(); args_register(options); args_execute(argc, argv); if (version) { printf(PACKAGE_TARNAME" " PACKAGE_VERSION" (%d %04d)\n", IRSSI_VERSION_DATE, IRSSI_VERSION_TIME); return 0; } srand(time(NULL)); quitting = FALSE; core_preinit(argv[0]); check_files(); #ifdef HAVE_SOCKS SOCKSinit(argv[0]); #endif /* setlocale() must be called at the beginning before any calls that affect it, especially regexps seem to break if they're generated before this call. locales aren't actually used for anything else than autodetection of UTF-8 currently.. furthermore to get the users's charset with g_get_charset() properly you have to call setlocale(LC_ALL, "") */ setlocale(LC_ALL, ""); /* Temporarily raise the fatal level to abort on config errors. */ loglev = g_log_set_always_fatal(G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL); textui_init(); if (!term_init()) { fprintf(stderr, "Can't initialize screen handling.\n"); return 1; } g_log_set_always_fatal(loglev); textui_finish_init(); main_loop = g_main_new(TRUE); /* Does the same as g_main_run(main_loop), except we can call our dirty-checker after each iteration */ while (!quitting) { if (reload_config) { /* SIGHUP received, do /RELOAD */ reload_config = FALSE; signal_emit("command reload", 1, ""); } dirty_check(); term_refresh_freeze(); g_main_iteration(TRUE); term_refresh_thaw(); } g_main_destroy(main_loop); textui_deinit(); session_upgrade(); /* if we /UPGRADEd, start the new process */ return 0; }