mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Command line args and welcome message
This commit is contained in:
parent
696848bdc3
commit
7c90878062
42
src/main.c
42
src/main.c
@ -19,30 +19,46 @@
|
|||||||
* along with Profanity. If not, see <http://www.gnu.org/licenses/>.
|
* along with Profanity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
#include "profanity.h"
|
#include "profanity.h"
|
||||||
|
|
||||||
|
static gboolean disable_tls = FALSE;
|
||||||
|
static gboolean version = FALSE;
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int disable_tls = 0;
|
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 },
|
||||||
|
{ NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
GError *error = NULL;
|
||||||
|
GOptionContext *context;
|
||||||
|
|
||||||
// more than one argument
|
context = g_option_context_new(NULL);
|
||||||
if (argc > 2) {
|
g_option_context_add_main_entries(context, entries, NULL);
|
||||||
printf("Usage: profanity [-notls]\n");
|
//g_option_context_add_group(context, gtk_get_option_group (TRUE));
|
||||||
|
if (!g_option_context_parse(context, &argc, &argv, &error)) {
|
||||||
|
g_print("%s\n", error->message);
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// argument is not -notls
|
if (version == TRUE) {
|
||||||
} else if (argc == 2) {
|
g_print("Profanity, version %s\n", PACKAGE_VERSION);
|
||||||
char *arg1 = argv[1];
|
g_print("Copyright (C) 2012 James Booth <%s>.\n", PACKAGE_BUGREPORT);
|
||||||
if (strcmp(arg1, "-notls") != 0) {
|
g_print("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n");
|
||||||
printf("Usage: profanity [-notls]\n");
|
g_print("\n");
|
||||||
return 1;
|
g_print("This is free software; you are free to change and redistribute it.\n");
|
||||||
} else {
|
g_print("There is NO WARRANTY, to the extent permitted by law.\n");
|
||||||
disable_tls = 1;
|
return 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
profanity_init(disable_tls);
|
profanity_init(disable_tls);
|
||||||
|
@ -474,7 +474,21 @@ static void _create_windows(void)
|
|||||||
if (prefs_get_showsplash()) {
|
if (prefs_get_showsplash()) {
|
||||||
_print_splash_logo(_cons_win);
|
_print_splash_logo(_cons_win);
|
||||||
} else {
|
} else {
|
||||||
wprintw(_cons_win, "Welcome to Profanity.\n");
|
wprintw(_cons_win, "Welcome to Profanity, version %s\n", PACKAGE_VERSION);
|
||||||
|
_win_show_time(_cons_win);
|
||||||
|
wprintw(_cons_win, "Copyright (C) 2012 James Booth <%s>.\n", PACKAGE_BUGREPORT);
|
||||||
|
_win_show_time(_cons_win);
|
||||||
|
wprintw(_cons_win, "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n");
|
||||||
|
_win_show_time(_cons_win);
|
||||||
|
wprintw(_cons_win, "\n");
|
||||||
|
_win_show_time(_cons_win);
|
||||||
|
wprintw(_cons_win, "This is free software; you are free to change and redistribute it.\n");
|
||||||
|
_win_show_time(_cons_win);
|
||||||
|
wprintw(_cons_win, "There is NO WARRANTY, to the extent permitted by law.\n");
|
||||||
|
_win_show_time(_cons_win);
|
||||||
|
wprintw(_cons_win, "\n");
|
||||||
|
_win_show_time(_cons_win);
|
||||||
|
wprintw(_cons_win, "Type '/help' to get started.\n");
|
||||||
}
|
}
|
||||||
prefresh(_cons_win, 0, 0, 1, 0, rows-3, cols-1);
|
prefresh(_cons_win, 0, 0, 1, 0, rows-3, cols-1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user