2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 06:55:30 +00:00

remove dead code, consolidate dupliacted code.

This commit is contained in:
Brian Wellington
2001-09-21 00:17:01 +00:00
parent 8f674b13e8
commit 39504d4517
5 changed files with 31 additions and 38 deletions

View File

@@ -17,7 +17,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: dnssec-keygen.c,v 1.53 2001/09/19 23:05:11 gson Exp $ */ /* $Id: dnssec-keygen.c,v 1.54 2001/09/21 00:16:56 bwelling Exp $ */
#include <config.h> #include <config.h>
@@ -120,7 +120,7 @@ main(int argc, char **argv) {
dns_result_register(); dns_result_register();
while ((ch = isc_commandline_parse(argc, argv, while ((ch = isc_commandline_parse(argc, argv,
"a:b:c:eg:n:t:p:s:hr:v:")) != -1) "a:b:c:eg:n:t:p:s:r:v:h")) != -1)
{ {
switch (ch) { switch (ch) {
case 'a': case 'a':
@@ -145,13 +145,9 @@ main(int argc, char **argv) {
break; break;
case 'n': case 'n':
nametype = isc_commandline_argument; nametype = isc_commandline_argument;
if (nametype == NULL)
fatal("out of memory");
break; break;
case 't': case 't':
type = isc_commandline_argument; type = isc_commandline_argument;
if (type == NULL)
fatal("out of memory");
break; break;
case 'p': case 'p':
protocol = strtol(isc_commandline_argument, &endp, 10); protocol = strtol(isc_commandline_argument, &endp, 10);
@@ -271,14 +267,7 @@ main(int argc, char **argv) {
else else
fatal("invalid nametype %s", nametype); fatal("invalid nametype %s", nametype);
if (classname != NULL) { rdclass = strtoclass(classname);
r.base = classname;
r.length = strlen(classname);
ret = dns_rdataclass_fromtext(&rdclass, &r);
if (ret != ISC_R_SUCCESS)
fatal("unknown class %s",classname);
} else
rdclass = dns_rdataclass_in;
flags |= signatory; flags |= signatory;

View File

@@ -17,7 +17,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: dnssec-signkey.c,v 1.54 2001/09/19 23:05:13 gson Exp $ */ /* $Id: dnssec-signkey.c,v 1.55 2001/09/21 00:16:57 bwelling Exp $ */
#include <config.h> #include <config.h>
@@ -173,7 +173,6 @@ main(int argc, char *argv[]) {
dns_rdata_sig_t sig; dns_rdata_sig_t sig;
isc_result_t result; isc_result_t result;
isc_buffer_t b; isc_buffer_t b;
isc_textregion_t tr;
isc_log_t *log = NULL; isc_log_t *log = NULL;
keynode_t *keynode; keynode_t *keynode;
isc_boolean_t pseudorandom = ISC_FALSE; isc_boolean_t pseudorandom = ISC_FALSE;
@@ -233,14 +232,7 @@ main(int argc, char *argv[]) {
if (argc < 2) if (argc < 2)
usage(); usage();
if (classname != NULL) { rdclass = strtoclass(classname);
tr.base = classname;
tr.length = strlen(classname);
result = dns_rdataclass_fromtext(&rdclass, &tr);
if (result != ISC_R_SUCCESS)
fatal("unknown class %s",classname);
} else
rdclass = dns_rdataclass_in;
if (ectx == NULL) if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx); setup_entropy(mctx, NULL, &ectx);

View File

@@ -17,7 +17,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: dnssec-signzone.c,v 1.144 2001/09/21 00:02:20 bwelling Exp $ */ /* $Id: dnssec-signzone.c,v 1.145 2001/09/21 00:16:59 bwelling Exp $ */
#include <config.h> #include <config.h>
@@ -1515,7 +1515,6 @@ main(int argc, char *argv[]) {
isc_boolean_t free_output = ISC_FALSE; isc_boolean_t free_output = ISC_FALSE;
int tempfilelen; int tempfilelen;
dns_rdataclass_t rdclass; dns_rdataclass_t rdclass;
isc_textregion_t r;
isc_task_t **tasks = NULL; isc_task_t **tasks = NULL;
masterstyle = &dns_master_style_explicitttl; masterstyle = &dns_master_style_explicitttl;
@@ -1628,14 +1627,7 @@ main(int argc, char *argv[]) {
ntasks = isc_os_ncpus(); ntasks = isc_os_ncpus();
vbprintf(4, "using %d cpus\n", ntasks); vbprintf(4, "using %d cpus\n", ntasks);
if (classname != NULL) { rdclass = strtoclass(classname);
r.base = classname;
r.length = strlen(classname);
result = dns_rdataclass_fromtext(&rdclass, &r);
if (result != ISC_R_SUCCESS)
fatal("unknown class %s",classname);
} else
rdclass = dns_rdataclass_in;
setup_logging(verbose, mctx, &log); setup_logging(verbose, mctx, &log);

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: dnssectool.c,v 1.34 2001/09/19 23:05:15 gson Exp $ */ /* $Id: dnssectool.c,v 1.35 2001/09/21 00:17:00 bwelling Exp $ */
#include <config.h> #include <config.h>
@@ -33,6 +33,7 @@
#include <dns/log.h> #include <dns/log.h>
#include <dns/name.h> #include <dns/name.h>
#include <dns/rdatastruct.h> #include <dns/rdatastruct.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h> #include <dns/rdatatype.h>
#include <dns/result.h> #include <dns/result.h>
#include <dns/secalg.h> #include <dns/secalg.h>
@@ -260,7 +261,7 @@ cleanup_entropy(isc_entropy_t **ectx) {
} }
isc_stdtime_t isc_stdtime_t
strtotime(char *str, isc_int64_t now, isc_int64_t base) { strtotime(const char *str, isc_int64_t now, isc_int64_t base) {
isc_int64_t val, offset; isc_int64_t val, offset;
isc_result_t result; isc_result_t result;
char *endp; char *endp;
@@ -289,3 +290,19 @@ strtotime(char *str, isc_int64_t now, isc_int64_t base) {
return ((isc_stdtime_t) val); return ((isc_stdtime_t) val);
} }
dns_rdataclass_t
strtoclass(const char *str) {
isc_consttextregion_t r;
dns_rdataclass_t rdclass;
isc_result_t ret;
if (str == NULL)
return dns_rdataclass_in;
r.base = str;
r.length = strlen(str);
ret = dns_rdataclass_fromtext(&rdclass, (isc_textregion_t *)&r);
if (ret != ISC_R_SUCCESS)
fatal("unknown class %s", str);
return (rdclass);
}

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: dnssectool.h,v 1.15 2001/08/08 22:54:16 gson Exp $ */ /* $Id: dnssectool.h,v 1.16 2001/09/21 00:17:01 bwelling Exp $ */
#ifndef DNSSECTOOL_H #ifndef DNSSECTOOL_H
#define DNSSECTOOL_H 1 #define DNSSECTOOL_H 1
@@ -68,6 +68,9 @@ void
cleanup_entropy(isc_entropy_t **ectx); cleanup_entropy(isc_entropy_t **ectx);
isc_stdtime_t isc_stdtime_t
strtotime(char *str, isc_int64_t now, isc_int64_t base); strtotime(const char *str, isc_int64_t now, isc_int64_t base);
dns_rdataclass_t
strtoclass(const char *str);
#endif /* DNSSEC_DNSSECTOOL_H */ #endif /* DNSSEC_DNSSECTOOL_H */