diff --git a/src/main.c b/src/main.c
index 520fb4bb..8bd5df56 100644
--- a/src/main.c
+++ b/src/main.c
@@ -19,30 +19,46 @@
* along with Profanity. If not, see .
*
*/
+#include
#include
#include
+#include
+
#include "profanity.h"
+static gboolean disable_tls = FALSE;
+static gboolean version = FALSE;
+
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
- if (argc > 2) {
- printf("Usage: profanity [-notls]\n");
+ context = g_option_context_new(NULL);
+ g_option_context_add_main_entries(context, entries, NULL);
+ //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;
+ }
- // argument is not -notls
- } else if (argc == 2) {
- char *arg1 = argv[1];
- if (strcmp(arg1, "-notls") != 0) {
- printf("Usage: profanity [-notls]\n");
- return 1;
- } else {
- disable_tls = 1;
- }
+ if (version == TRUE) {
+ g_print("Profanity, version %s\n", PACKAGE_VERSION);
+ g_print("Copyright (C) 2012 James Booth <%s>.\n", PACKAGE_BUGREPORT);
+ g_print("License GPLv3+: GNU GPL version 3 or later \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;
}
profanity_init(disable_tls);
diff --git a/src/windows.c b/src/windows.c
index 5a0b12d7..b5378069 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -474,7 +474,21 @@ static void _create_windows(void)
if (prefs_get_showsplash()) {
_print_splash_logo(_cons_win);
} 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 \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);