chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
resolve-host: properly align long arguments in help text
[elogind.git]
/
src
/
resolve-host
/
resolve-host.c
diff --git
a/src/resolve-host/resolve-host.c
b/src/resolve-host/resolve-host.c
index 80ce9cb237c7d7b87defa6fd964565dbe57147ce..3709268dd2d168e9a78ce0285b1628c8212e6704 100644
(file)
--- a/
src/resolve-host/resolve-host.c
+++ b/
src/resolve-host/resolve-host.c
@@
-37,7
+37,7
@@
static int arg_family = AF_UNSPEC;
static int arg_ifindex = 0;
static int arg_family = AF_UNSPEC;
static int arg_ifindex = 0;
-static
uint16_
t arg_type = 0;
+static
in
t arg_type = 0;
static uint16_t arg_class = 0;
static bool arg_legend = true;
static uint16_t arg_class = 0;
static bool arg_legend = true;
@@
-316,6
+316,7
@@
static int resolve_record(sd_bus *bus, const char *name) {
if (r < 0)
return bus_log_create_error(r);
if (r < 0)
return bus_log_create_error(r);
+ assert((uint16_t) arg_type == arg_type);
r = sd_bus_message_append(req, "sqq", name, arg_class, arg_type);
if (r < 0)
return bus_log_create_error(r);
r = sd_bus_message_append(req, "sqq", name, arg_class, arg_type);
if (r < 0)
return bus_log_create_error(r);
@@
-424,7
+425,7
@@
static void help(void) {
" -i INTERFACE Filter by interface\n"
" -t --type=TYPE Query RR with DNS type\n"
" -c --class=CLASS Query RR with DNS class\n"
" -i INTERFACE Filter by interface\n"
" -t --type=TYPE Query RR with DNS type\n"
" -c --class=CLASS Query RR with DNS class\n"
- "
--no-legend
Do not print column headers\n"
+ "
--no-legend
Do not print column headers\n"
, program_invocation_short_name);
}
, program_invocation_short_name);
}
@@
-448,7
+449,7
@@
static int parse_argv(int argc, char *argv[]) {
assert(argc >= 0);
assert(argv);
assert(argc >= 0);
assert(argv);
- while ((c = getopt_long(argc, argv, "h46i:t:c:", options, NULL)) >= 0)
{
+ while ((c = getopt_long(argc, argv, "h46i:t:c:", options, NULL)) >= 0)
switch(c) {
case 'h':
switch(c) {
case 'h':
@@
-482,11
+483,12
@@
static int parse_argv(int argc, char *argv[]) {
return 0;
}
return 0;
}
-
r = dns_type_from_string(optarg, &arg_type
);
- if (
r
< 0) {
+
arg_type = dns_type_from_string(optarg
);
+ if (
arg_type
< 0) {
log_error("Failed to parse RR record type %s", optarg);
log_error("Failed to parse RR record type %s", optarg);
- return
r
;
+ return
arg_type
;
}
}
+ assert(arg_type > 0 && (uint16_t) arg_type == arg_type);
break;
break;
@@
-514,7
+516,6
@@
static int parse_argv(int argc, char *argv[]) {
default:
assert_not_reached("Unhandled option");
}
default:
assert_not_reached("Unhandled option");
}
- }
if (arg_type == 0 && arg_class != 0) {
log_error("--class= may only be used in conjunction with --type=");
if (arg_type == 0 && arg_class != 0) {
log_error("--class= may only be used in conjunction with --type=");
@@
-528,7
+529,7
@@
static int parse_argv(int argc, char *argv[]) {
}
int main(int argc, char **argv) {
}
int main(int argc, char **argv) {
- _cleanup_bus_unref_ sd_bus *bus = NULL;
+ _cleanup_bus_
close_
unref_ sd_bus *bus = NULL;
int r;
log_parse_environment();
int r;
log_parse_environment();