chiark / gitweb /
journalctl: remove unexpected behavior of journalctl -b
authorDave Reisner <dreisner@archlinux.org>
Wed, 25 Dec 2013 17:24:19 +0000 (12:24 -0500)
committerDave Reisner <dreisner@archlinux.org>
Wed, 25 Dec 2013 17:39:47 +0000 (12:39 -0500)
This flag shouldn't try and consume the following argument. It should
behave like every other flag which takes an optional argument when
parsed by getopt_long.

src/journal/journalctl.c

index cb252eb..b347dfa 100644 (file)
@@ -371,18 +371,7 @@ static int parse_argv(int argc, char *argv[]) {
 
                 case 'b':
                         arg_boot = true;
-
-                        if (optarg)
-                                arg_boot_descriptor = optarg;
-                        else if (optind < argc) {
-                                int boot;
-
-                                if (argv[optind][0] != '-' ||
-                                    safe_atoi(argv[optind], &boot) >= 0) {
-                                        arg_boot_descriptor = argv[optind];
-                                        optind++;
-                                }
-                        }
+                        arg_boot_descriptor = optarg;
 
                         break;