#include <glib.h>
+#include <stdlib.h>
#include "tilda.h"
#include "tilda-window.h"
}
}
+static void
+tilda_parse_command_line (gint argc, gchar *argv[])
+{
+ debug_enter ();
+
+ gboolean version = FALSE;
+
+ /* All of the various command-line options */
+ const GOptionEntry cl_opts[] = {
+ { "version", 'V', 0, G_OPTION_ARG_NONE, &version, N_("Show version information"), NULL },
+ { NULL },
+ };
+
+ /* Set up the command-line parser */
+ GError *error = NULL;
+ GOptionContext *context = g_option_context_new (NULL);
+ g_option_context_add_main_entries (context, cl_opts, NULL);
+ g_option_context_add_group (context, gtk_get_option_group (TRUE));
+ g_option_context_parse (context, &argc, &argv, &error);
+ g_option_context_free (context);
+
+ /* Check for unknown options, and give a nice message if there are some */
+ if (error)
+ {
+ g_printerr (_("Error parsing command-line options: %s\n"), error->message);
+ g_printerr (_("The command \"tilda --help\" will show all possible options\n"));
+ g_error_free (error);
+ exit (EXIT_FAILURE);
+ }
+
+ /* If we need to show the version, show it then exit normally */
+ if (version)
+ {
+ g_print ("%s\n\n", TILDA_VERSION);
+
+ g_print ("Copyright (c) 2005-2008 Tristan Sloughter (sloutri@iit.edu)\n");
+ g_print ("Copyright (c) 2005-2008 Ira W. Snyder (tilda@irasnyder.com)\n\n");
+
+ g_print ("This program comes with ABSOLUTELY NO WARRANTY.\n");
+ g_print ("This is free software, and you are welcome to redistribute it\n");
+ g_print ("under certain conditions. See the file COPYING for details.\n");
+
+ exit (EXIT_SUCCESS);
+ }
+}
+
int main (int argc, char *argv[])
{
debug_enter ();
textdomain (PACKAGE);
#endif
+ /* Parse the command-line options */
+ tilda_parse_command_line (argc, argv);
+
/* Initialize GTK+ (and the GObject system) */
gtk_init (&argc, &argv);