int main(int argc, char **argv) { static GOptionEntry entries[] = { { "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Show version information", NULL }, { "disable-tls", 'd', 0, G_OPTION_ARG_NONE, &disable_tls, "Disable TLS", NULL }, { "account", 'a', 0, G_OPTION_ARG_STRING, &account_name, "Auto connect to an account on start-up" }, { "log",'l', 0, G_OPTION_ARG_STRING, &log, "Set logging levels, DEBUG, INFO (default), WARN, ERROR", "LEVEL" }, { NULL } }; GError *error = NULL; GOptionContext *context; context = g_option_context_new(NULL); g_option_context_add_main_entries(context, entries, NULL); if (!g_option_context_parse(context, &argc, &argv, &error)) { g_print("%s\n", error->message); g_option_context_free(context); return 1; } g_option_context_free(context); if (version == TRUE) { if (strcmp(PACKAGE_STATUS, "development") == 0) { #ifdef HAVE_GIT_VERSION g_print("Profanity, version %sdev.%s.%s\n", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION); #else g_print("Profanity, version %sdev\n", PACKAGE_VERSION); #endif } else { g_print("Profanity, version %s\n", PACKAGE_VERSION); } g_print("Copyright (C) 2012 - 2014 James Booth <%s>.\n", PACKAGE_BUGREPORT); g_print("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n"); g_print("\n"); g_print("This is free software; you are free to change and redistribute it.\n"); g_print("There is NO WARRANTY, to the extent permitted by law.\n"); return 0; } _init_modules(); prof_run(disable_tls, log, account_name); return 0; }
int main(int argc, char **argv) { static GOptionEntry entries[] = { { "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Show version information", NULL }, { "disable-tls", 'd', 0, G_OPTION_ARG_NONE, &disable_tls, "Disable TLS", NULL }, { "log",'l', 0, G_OPTION_ARG_STRING, &log, "Set logging levels, DEBUG, INFO (default), WARN, ERROR", "LEVEL" }, { NULL } }; GError *error = NULL; GOptionContext *context; context = g_option_context_new(NULL); g_option_context_add_main_entries(context, entries, NULL); if (!g_option_context_parse(context, &argc, &argv, &error)) { g_print("%s\n", error->message); g_option_context_free(context); return 1; } g_option_context_free(context); if (version == TRUE) { g_print("Profanity, version %s\n", PACKAGE_VERSION); g_print("Copyright (C) 2012, 2013 James Booth <%s>.\n", PACKAGE_BUGREPORT); g_print("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n"); g_print("\n"); g_print("This is free software; you are free to change and redistribute it.\n"); g_print("There is NO WARRANTY, to the extent permitted by law.\n"); return 0; } prof_run(disable_tls, log); return 0; }
int main(int argc, char **argv) { if (argc == 2 && g_strcmp0(argv[1], "docgen") == 0 && g_strcmp0(PACKAGE_STATUS, "development") == 0) { command_docgen(); return 0; } static GOptionEntry entries[] = { { "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Show version information", NULL }, { "account", 'a', 0, G_OPTION_ARG_STRING, &account_name, "Auto connect to an account on startup" }, { "log",'l', 0, G_OPTION_ARG_STRING, &log, "Set logging levels, DEBUG, INFO (default), WARN, ERROR", "LEVEL" }, { NULL } }; GError *error = NULL; GOptionContext *context; context = g_option_context_new(NULL); g_option_context_add_main_entries(context, entries, NULL); if (!g_option_context_parse(context, &argc, &argv, &error)) { g_print("%s\n", error->message); g_option_context_free(context); g_error_free(error); return 1; } g_option_context_free(context); if (version == TRUE) { if (strcmp(PACKAGE_STATUS, "development") == 0) { #ifdef HAVE_GIT_VERSION g_print("Profanity, version %sdev.%s.%s\n", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION); #else g_print("Profanity, version %sdev\n", PACKAGE_VERSION); #endif } else { g_print("Profanity, version %s\n", PACKAGE_VERSION); } g_print("Copyright (C) 2012 - 2018 James Booth <%s>.\n", PACKAGE_BUGREPORT); g_print("License GPLv3+: GNU GPL version 3 or later <https://www.gnu.org/licenses/gpl.html>\n"); g_print("\n"); g_print("This is free software; you are free to change and redistribute it.\n"); g_print("There is NO WARRANTY, to the extent permitted by law.\n"); g_print("\n"); g_print("Build information:\n"); #ifdef HAVE_LIBMESODE g_print("XMPP library: libmesode\n"); #endif #ifdef HAVE_LIBSTROPHE g_print("XMPP library: libstrophe\n"); #endif if (is_notify_enabled()) { g_print("Desktop notification support: Enabled\n"); } else { g_print("Desktop notification support: Disabled\n"); } #ifdef HAVE_LIBOTR char *otr_version = otr_libotr_version(); g_print("OTR support: Enabled (libotr %s)\n", otr_version); #else g_print("OTR support: Disabled\n"); #endif #ifdef HAVE_LIBGPGME const char *pgp_version = p_gpg_libver(); g_print("PGP support: Enabled (libgpgme %s)\n", pgp_version); #else g_print("PGP support: Disabled\n"); #endif #ifdef HAVE_C g_print("C plugins: Enabled\n"); #else g_print("C plugins: Disabled\n"); #endif #ifdef HAVE_PYTHON gchar *python_version = python_get_version_number(); g_print("Python plugins: Enabled (%s)\n", python_version); g_free(python_version); #else g_print("Python plugins: Disabled\n"); #endif #ifdef HAVE_GTK g_print("GTK icons: Enabled\n"); #else g_print("GTK icons: Disabled\n"); #endif return 0; } prof_run(log, account_name); return 0; }