1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 23:21:22 +03:00

Merge pull request #8293 from dobyrch/master

tree-wide: fix inconsistencies in option parsing
This commit is contained in:
Lennart Poettering 2018-03-01 15:03:19 +01:00 committed by GitHub
commit 3896a17bdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 12 deletions

View File

@ -1515,7 +1515,7 @@ static int test_calendar(int argc, char *argv[], void *userdata) {
r = calendar_spec_to_string(spec, &t);
if (r < 0) {
ret = log_error_errno(r, "Failed to fomat calendar specification '%s': %m", *p);
ret = log_error_errno(r, "Failed to format calendar specification '%s': %m", *p);
continue;
}

View File

@ -494,7 +494,7 @@ static int parse_argv(int argc, char *argv[]) {
assert(argc >= 0);
assert(argv);
while ((c = getopt_long(argc, argv, "hefo:aln::qmb::kD:p:c:S:U:t:u:NF:xrM:", options, NULL)) >= 0)
while ((c = getopt_long(argc, argv, "hefo:aln::qmb::kD:p:g:c:S:U:t:u:NF:xrM:", options, NULL)) >= 0)
switch (c) {

View File

@ -7488,7 +7488,6 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
ARG_NO_ASK_PASSWORD,
ARG_FAILED,
ARG_RUNTIME,
ARG_FORCE,
ARG_PLAIN,
ARG_STATE,
ARG_JOB_MODE,
@ -7528,7 +7527,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
{ "dry-run", no_argument, NULL, ARG_DRY_RUN },
{ "quiet", no_argument, NULL, 'q' },
{ "root", required_argument, NULL, ARG_ROOT },
{ "force", no_argument, NULL, ARG_FORCE },
{ "force", no_argument, NULL, 'f' },
{ "no-reload", no_argument, NULL, ARG_NO_RELOAD },
{ "kill-who", required_argument, NULL, ARG_KILL_WHO },
{ "signal", required_argument, NULL, 's' },
@ -7743,10 +7742,6 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
arg_quiet = true;
break;
case ARG_FORCE:
arg_force++;
break;
case 'f':
arg_force++;
break;

View File

@ -372,7 +372,7 @@ int main(int argc, char *argv[]) {
return 1;
}
while ((c = getopt_long(argc, argv, "p:s:dhV", options, NULL)) >= 0)
while ((c = getopt_long(argc, argv, "p:s:dhVm", options, NULL)) >= 0)
switch (c) {
case 'p':

View File

@ -35,6 +35,7 @@
#include "efivars.h"
#include "fd-util.h"
#include "gpt.h"
#include "parse-util.h"
#include "string-util.h"
#include "udev.h"
@ -236,7 +237,7 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t
bool is_gpt = false;
static const struct option options[] = {
{ "offset", optional_argument, NULL, 'o' },
{ "offset", required_argument, NULL, 'o' },
{ "noraid", no_argument, NULL, 'R' },
{}
};
@ -244,13 +245,19 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t
for (;;) {
int option;
option = getopt_long(argc, argv, "oR", options, NULL);
option = getopt_long(argc, argv, "o:R", options, NULL);
if (option == -1)
break;
switch (option) {
case 'o':
offset = strtoull(optarg, NULL, 0);
err = safe_atoi64(optarg, &offset);
if (err < 0)
goto out;
if (offset < 0) {
err = -ERANGE;
goto out;
}
break;
case 'R':
noraid = true;