]> rtime.felk.cvut.cz Git - frescor/frsh.git/commitdiff
frm_gui learned -l (--loglevel) option
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 28 May 2009 03:41:59 +0000 (05:41 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 28 May 2009 03:43:32 +0000 (05:43 +0200)
fres/frm_gui/main.cpp

index 78b5eb65586e1dcb4da3fd494e1f77b7f9534b11..8dff27e8f5432a21c9caef990b172b5714b92feb 100644 (file)
@@ -1,10 +1,38 @@
 #include <QtGui/QApplication>
 #include "dialog.h"
+#include <getopt.h>
+#include <ul_logreg.h>
+
+static struct option long_opts[] = {
+    { "loglevel", 1, 0, 'l' },
+    { 0, 0, 0, 0}
+};
+
+static void
+usage(void)
+{
+       printf("usage: frm_gui [ options ]\n");
+       printf("  -l, --loglevel <number>|<domain>=<number>,...\n");
+}
 
 int main(int argc, char *argv[])
 {
     QApplication a(argc, argv);
     Dialog w;
+    char opt;
+
+    while ((opt = getopt_long(argc, argv, "l:", &long_opts[0], NULL)) != EOF) {
+       switch (opt) {
+           case 'l':
+               ul_log_domain_arg2levels(optarg);
+               break;
+           case 'h':
+               /*default:*/
+               usage();
+               exit(opt == 'h' ? 0 : 1);
+       }
+    }
+
     w.show();
     return a.exec();
 }