mirror of
https://github.com/swaywm/sway.git
synced 2025-10-29 05:40:18 -04:00
Fix option parsing
Using 'flag' results in duplicate code paths for short and long options.
This broke the -q short option in swaymsg, because there was:
{"quiet", no_argument, &quiet, 'q'}
Which will set quiet to 'q' and return 0, not 'q'.
This commit is contained in:
parent
bf97a5ada5
commit
923c3245ac
3 changed files with 8 additions and 11 deletions
|
|
@ -24,7 +24,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
static struct option long_options[] = {
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"quiet", no_argument, &quiet, 'q'},
|
||||
{"quiet", no_argument, NULL, 'q'},
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
{"socket", required_argument, NULL, 's'},
|
||||
{"type", required_argument, NULL, 't'},
|
||||
|
|
@ -48,7 +48,8 @@ int main(int argc, char **argv) {
|
|||
break;
|
||||
}
|
||||
switch (c) {
|
||||
case 0: // Flag
|
||||
case 'q': // Quiet
|
||||
quiet = 1;
|
||||
break;
|
||||
case 's': // Socket
|
||||
socket_path = strdup(optarg);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue