[cheese] add --version command line flag



commit 9c8c348c0c568fc876104dae40ae520a1b84dcbc
Author: daniel g. siegel <dgsiegel gnome org>
Date:   Tue Jul 28 13:32:52 2009 +0200

    add --version command line flag

 src/cheese.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/cheese.c b/src/cheese.c
index 04879b5..0b5adcf 100644
--- a/src/cheese.c
+++ b/src/cheese.c
@@ -37,6 +37,7 @@ struct _CheeseOptions
 {
   gboolean verbose;
   char *hal_device_id;
+  gboolean version;
 } CheeseOptions;
 
 void
@@ -157,8 +158,13 @@ main (int argc, char **argv)
   GError         *error = NULL;
 
   GOptionEntry options[] = {
-    {"verbose",    'v', 0,                    G_OPTION_ARG_NONE,   &CheeseOptions.verbose,       _("Be verbose"), NULL},
-    {"hal-device", 'd', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &CheeseOptions.hal_device_id, NULL,            NULL},
+    {"verbose",    'v',    0,                    G_OPTION_ARG_NONE,                    &CheeseOptions.verbose,
+     _("Be verbose"),
+     NULL},
+    {"hal-device", 'd', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &CheeseOptions.hal_device_id, NULL,
+     NULL},
+    {"version",    0,   0,                    G_OPTION_ARG_NONE,   &CheeseOptions.version,
+     _("output version information and exit"), NULL},
     {NULL}
   };
 
@@ -190,6 +196,12 @@ main (int argc, char **argv)
   }
   g_option_context_free (context);
 
+  if (CheeseOptions.version)
+  {
+    g_print ("Cheese " VERSION " \n");
+    return 0;
+  }
+
   dbus_server = cheese_dbus_new ();
   if (dbus_server == NULL)
   {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]