all repos — tint2 @ ed24d0bd4c5e1ab8e506783a05402c4433be1737

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

Fix command line argument processing (issue #516)
o9000 o9000
commit

ed24d0bd4c5e1ab8e506783a05402c4433be1737

parent

8eca71ac95c8565a657aebc9641cc0b0b594a23f

1 files changed, 24 insertions(+), 12 deletions(-)

jump to
M src/tint.csrc/tint.c

@@ -123,23 +123,35 @@ default_panel();

// read options for (i = 1; i < argc; ++i) { - if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { - printf("Usage: tint2 [-c] <config_file>\n"); + int error = 0; + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + printf("Usage: tint2 [[-c] <config_file>]\n"); exit(0); - } - if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) { + } else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0) { printf("tint2 version %s\n", VERSION_STRING); exit(0); - } - if (!strcmp(argv[i], "-c")) { - i++; - if (i < argc) + } else if (strcmp(argv[i], "-c") == 0) { + if (i+1 < argc) { + i++; config_path = strdup(argv[i]); - } - if (!strcmp(argv[i], "-s")) { - i++; - if (i < argc) + } else { + error = 1; + } + } else if (strcmp(argv[i], "-s") == 0) { + if (i+1 < argc) { + i++; snapshot_path = strdup(argv[i]); + } else { + error = 1; + } + } else if (i+1 == argc) { + config_path = strdup(argv[i]); + } else { + error = 1; + } + if (error) { + printf("Usage: tint2 [[-c] <config_file>]\n"); + exit(1); } } // Set signal handler