chiark
/
gitweb
/
~ianmdlvl
/
adns.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
src/addrfam.c (adns_addr2text): Don't print junk in debugging output.
[adns.git]
/
client
/
adh-opts.c
diff --git
a/client/adh-opts.c
b/client/adh-opts.c
index 46d5606d5ada55b77a7a0480843f1f34d684a16f..08310e089d19939c7672d6bd7156f73b57ec700e 100644
(file)
--- a/
client/adh-opts.c
+++ b/
client/adh-opts.c
@@
-4,12
+4,11
@@
* option handling tables etc.
*/
/*
* option handling tables etc.
*/
/*
- * This file is
- * Copyright (C) 1997-1999 Ian Jackson <ian@davenant.greenend.org.uk>
- *
- * It is part of adns, which is
- * Copyright (C) 1997-1999 Ian Jackson <ian@davenant.greenend.org.uk>
- * Copyright (C) 1999 Tony Finch <dot@dotat.at>
+ * This file is part of adns, which is
+ * Copyright (C) 1997-2000,2003,2006 Ian Jackson
+ * Copyright (C) 1999-2000,2003,2006 Tony Finch
+ * Copyright (C) 1991 Massachusetts Institute of Technology
+ * (See the file INSTALL for full details.)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-62,6
+61,10
@@
static const struct optioninfo global_options[]= {
"Vd", "debug", &ov_verbose, adns_if_debug },
{ ot_desconly, "other global options:" },
"Vd", "debug", &ov_verbose, adns_if_debug },
{ ot_desconly, "other global options:" },
+ { ot_funcarg, "Configuration to use instead of /etc/resolv.conf",
+ 0, "config", 0,0, of_config, "<config-text>" },
+ { ot_func, "Print version number",
+ 0, "version", 0,0, of_version },
{ ot_func, "Print usage information",
0, "help", 0,0, of_help },
{ ot_func, "Print usage information",
0, "help", 0,0, of_help },
@@
-74,6
+77,8
@@
static const struct optioninfo perquery_options[]= {
"t", "type", 0,0, &of_type, "type" },
{ ot_funcarg, "Do reverse query (address -> name lookup)",
"i", "ptr", 0,0, &of_ptr, "addr" },
"t", "type", 0,0, &of_type, "type" },
{ ot_funcarg, "Do reverse query (address -> name lookup)",
"i", "ptr", 0,0, &of_ptr, "addr" },
+ { ot_funcarg2, "Lookup in in-addr-like `zone' (eg MAPS RBL)",
+ 0, "reverse", 0,0, &of_reverse, "addr","zone" },
{ ot_desconly, "per-query binary options:" },
{ ot_flag, "Use the search list",
{ ot_desconly, "per-query binary options:" },
{ ot_flag, "Use the search list",
@@
-192,6
+197,15
@@
static void printusage(void) {
oip->desc);
}
break;
oip->desc);
}
break;
+ case ot_funcarg2:
+ assert(!oip->sopt);
+ l= (maxlopt + maxsopt - 2 -
+ (strlen(oip->lopt) + strlen(oip->argdesc) + strlen(oip->argdesc2)));
+ printf(" --%s <%s> <%s>%*s%s\n",
+ oip->lopt, oip->argdesc, oip->argdesc2,
+ l>2 ? l : 2, "",
+ oip->desc);
+ break;
case ot_desconly:
printf("%s\n", oip->desc);
break;
case ot_desconly:
printf("%s\n", oip->desc);
break;
@@
-248,18
+262,23
@@
static void printusage(void) {
" 11 usage problems\n"
"\n"
"Query types (see adns.h; default is addr):\n"
" 11 usage problems\n"
"\n"
"Query types (see adns.h; default is addr):\n"
- " ns soa ptr mx rp addr - enhanced versions\n"
- " cname hinfo txt - types with only one version\n"
- " a ns- soa- ptr- mx- rp- - _raw versions\n"
+ " ns soa ptr mx rp srv addr - enhanced versions\n"
+ " cname hinfo txt - types with only one version\n"
+ " a ns- soa- ptr- mx- rp- srv- - _raw versions\n"
+ " type<number> - `unknown' type, RFC3597\n"
"Default is addr, or ptr for -i/--ptr queries\n",
stdout);
if (ferror(stdout)) sysfail("write usage message",errno);
}
"Default is addr, or ptr for -i/--ptr queries\n",
stdout);
if (ferror(stdout)) sysfail("write usage message",errno);
}
-void of_help(const struct optioninfo *oi, const char *arg) {
+void of_version(const struct optioninfo *oi, const char *arg, const char *arg2) {
+ VERSION_PRINT_QUIT("adnshost");
+}
+
+void of_help(const struct optioninfo *oi, const char *arg, const char *arg2) {
printusage();
if (fclose(stdout)) sysfail("finish writing output",errno);
printusage();
if (fclose(stdout)) sysfail("finish writing output",errno);
-
exit
(0);
+
quitnow
(0);
}
typedef int comparer_type(const char **optp, const struct optioninfo *entry);
}
typedef int comparer_type(const char **optp, const struct optioninfo *entry);
@@
-316,7
+335,8
@@
static void noninvert(const struct optioninfo *oip) {
oip->lopt ? "--" : "", oip->lopt ? oip->lopt : "");
}
oip->lopt ? "--" : "", oip->lopt ? oip->lopt : "");
}
-void opt_do(const struct optioninfo *oip, const char *arg, int invert) {
+void opt_do(const struct optioninfo *oip, int invert,
+ const char *arg, const char *arg2) {
switch (oip->type) {
case ot_flag:
assert(!arg);
switch (oip->type) {
case ot_flag:
assert(!arg);
@@
-327,9
+347,9
@@
void opt_do(const struct optioninfo *oip, const char *arg, int invert) {
if (invert) noninvert(oip);
*oip->storep= oip->value;
return;
if (invert) noninvert(oip);
*oip->storep= oip->value;
return;
- case ot_func: case ot_funcarg:
+ case ot_func: case ot_funcarg:
case ot_funcarg2:
if (invert) noninvert(oip);
if (invert) noninvert(oip);
- oip->func(oip,arg);
+ oip->func(oip,arg
,arg2
);
return;
default:
abort();
return;
default:
abort();