]> git.sur5r.net Git - i3/i3/blobdiff - i3bar/src/main.c
Merge branch 'next' into master
[i3/i3] / i3bar / src / main.c
index 069803d4f944289afac72323bf15acd8d24fae03..a818dd9710eda58c3647a029f612ff5e0bf6146b 100644 (file)
@@ -44,7 +44,7 @@ void debuglog(char *fmt, ...) {
  * Glob path, i.e. expand ~
  *
  */
-char *expand_path(char *path) {
+static char *expand_path(char *path) {
     static glob_t globbuf;
     if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) < 0) {
         ELOG("glob() failed\n");
@@ -55,13 +55,14 @@ char *expand_path(char *path) {
     return result;
 }
 
-void print_usage(char *elf_name) {
+static void print_usage(char *elf_name) {
     printf("Usage: %s -b bar_id [-s sock_path] [-h] [-v]\n", elf_name);
     printf("\n");
     printf("-b, --bar_id  <bar_id>\tBar ID for which to get the configuration\n");
     printf("-s, --socket  <sock_path>\tConnect to i3 via <sock_path>\n");
     printf("-h, --help    Display this help message and exit\n");
     printf("-v, --version Display version number and exit\n");
+    printf("-V, --verbose Enable verbose mode\n");
     printf("\n");
     printf(" PLEASE NOTE that i3bar will be automatically started by i3\n"
            " as soon as there is a 'bar' configuration block in your\n"
@@ -75,7 +76,7 @@ void print_usage(char *elf_name) {
  * in main() with that
  *
  */
-void sig_cb(struct ev_loop *loop, ev_signal *watcher, int revents) {
+static void sig_cb(struct ev_loop *loop, ev_signal *watcher, int revents) {
     switch (watcher->signum) {
         case SIGTERM:
             DLOG("Got a SIGTERM, stopping\n");
@@ -106,9 +107,10 @@ int main(int argc, char **argv) {
         {"bar_id", required_argument, 0, 'b'},
         {"help", no_argument, 0, 'h'},
         {"version", no_argument, 0, 'v'},
+        {"verbose", no_argument, 0, 'V'},
         {NULL, 0, 0, 0}};
 
-    while ((opt = getopt_long(argc, argv, "b:s:hv", long_opt, &option_index)) != -1) {
+    while ((opt = getopt_long(argc, argv, "b:s:hvV", long_opt, &option_index)) != -1) {
         switch (opt) {
             case 's':
                 socket_path = expand_path(optarg);
@@ -120,6 +122,9 @@ int main(int argc, char **argv) {
             case 'b':
                 config.bar_id = sstrdup(optarg);
                 break;
+            case 'V':
+                config.verbose = true;
+                break;
             default:
                 print_usage(argv[0]);
                 exit(EXIT_SUCCESS);