Commit 39504d45 authored by Brian Wellington's avatar Brian Wellington
Browse files

remove dead code, consolidate dupliacted code.

parent 8f674b13
......@@ -17,7 +17,7 @@
* 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>
......@@ -120,7 +120,7 @@ main(int argc, char **argv) {
dns_result_register();
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) {
case 'a':
......@@ -145,13 +145,9 @@ main(int argc, char **argv) {
break;
case 'n':
nametype = isc_commandline_argument;
if (nametype == NULL)
fatal("out of memory");
break;
case 't':
type = isc_commandline_argument;
if (type == NULL)
fatal("out of memory");
break;
case 'p':
protocol = strtol(isc_commandline_argument, &endp, 10);
......@@ -271,14 +267,7 @@ main(int argc, char **argv) {
else
fatal("invalid nametype %s", nametype);
if (classname != NULL) {
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;
rdclass = strtoclass(classname);
flags |= signatory;
......
......@@ -17,7 +17,7 @@
* 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>
......@@ -173,7 +173,6 @@ main(int argc, char *argv[]) {
dns_rdata_sig_t sig;
isc_result_t result;
isc_buffer_t b;
isc_textregion_t tr;
isc_log_t *log = NULL;
keynode_t *keynode;
isc_boolean_t pseudorandom = ISC_FALSE;
......@@ -233,14 +232,7 @@ main(int argc, char *argv[]) {
if (argc < 2)
usage();
if (classname != NULL) {
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;
rdclass = strtoclass(classname);
if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx);
......
......@@ -17,7 +17,7 @@
* 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>
......@@ -1515,7 +1515,6 @@ main(int argc, char *argv[]) {
isc_boolean_t free_output = ISC_FALSE;
int tempfilelen;
dns_rdataclass_t rdclass;
isc_textregion_t r;
isc_task_t **tasks = NULL;
masterstyle = &dns_master_style_explicitttl;
......@@ -1628,14 +1627,7 @@ main(int argc, char *argv[]) {
ntasks = isc_os_ncpus();
vbprintf(4, "using %d cpus\n", ntasks);
if (classname != NULL) {
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;
rdclass = strtoclass(classname);
setup_logging(verbose, mctx, &log);
......
......@@ -15,7 +15,7 @@
* 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>
......@@ -33,6 +33,7 @@
#include <dns/log.h>
#include <dns/name.h>
#include <dns/rdatastruct.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
#include <dns/result.h>
#include <dns/secalg.h>
......@@ -260,7 +261,7 @@ cleanup_entropy(isc_entropy_t **ectx) {
}
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_result_t result;
char *endp;
......@@ -289,3 +290,19 @@ strtotime(char *str, isc_int64_t now, isc_int64_t base) {
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);
}
......@@ -15,7 +15,7 @@
* 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
#define DNSSECTOOL_H 1
......@@ -68,6 +68,9 @@ void
cleanup_entropy(isc_entropy_t **ectx);
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 */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment