summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortest-tools <test-tools>2006-10-10 16:41:32 +0000
committertest-tools <test-tools>2006-10-10 16:41:32 +0000
commitba64a1a1b4ae7a36153cce3dafaad03a44acd3db (patch)
tree4cce9d0ea078fa0f73334477c8ce46292f6bf37f /src
parentce0b5c2b490d76ea53a38a0ab3cdeef390653464 (diff)
downloadberyl-manager-ba64a1a1b4ae7a36153cce3dafaad03a44acd3db.tar.gz
beryl-manager-ba64a1a1b4ae7a36153cce3dafaad03a44acd3db.tar.bz2
beryl-manager: Added --help and --version option
Diffstat (limited to 'src')
-rw-r--r--src/main.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 6eea8be..40c4478 100644
--- a/src/main.c
+++ b/src/main.c
@@ -89,6 +89,13 @@ GtkWidget * reloadDecoratorItem;
void launchWM();
+static void
+usage (const char *programName)
+{
+ printf (_("Usage: %s "
+ "[-n] [--help] [--version]"
+ "\n"), programName);
+}
void beryl_manager_log_handler (const gchar *log_domain,
GLogLevelFlags log_level,
const gchar *message,
@@ -891,6 +898,7 @@ int main(int argc, char ** argv)
{
gint fd;
gint e;
+ gboolean daemon_mode = FALSE;
Display * d;
//Intialise error handler
@@ -907,10 +915,21 @@ int main(int argc, char ** argv)
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
- for (fd=0;fd<argc;fd++)
- if (strcmp(argv[fd],"-d")==0)
- break;
- if (fd==argc) {
+ for (fd=1;fd<argc;fd++) {
+ if (strcmp(argv[fd],"--help")==0) {
+ usage(argv[0]);
+ return 0;
+ } else if (strcmp(argv[fd],"--version")==0) {
+ printf (PACKAGE_STRING "\n");
+ return 0;
+ } else if (strcmp(argv[fd],"-d")==0) {
+ daemon_mode = TRUE;
+ } else {
+ usage(argv[0]);
+ return 1;
+ }
+ }
+ if (daemon_mode) {
daemon(1,1);
close(0);
}