Commit 2192b449 authored by Mark Andrews's avatar Mark Andrews

HINFO and TXT now handle quoted strings.

parent 110d1702
......@@ -65,8 +65,9 @@ main(int argc, char *argv[]) {
int debug = 0;
isc_region_t region;
int first = 1;
int raw = 0;
while ((c = getopt(argc, argv, "dqswtaz")) != -1) {
while ((c = getopt(argc, argv, "dqswtarz")) != -1) {
switch (c) {
case 'd':
debug = 1;
......@@ -91,6 +92,9 @@ main(int argc, char *argv[]) {
case 'z':
zero = 1;
break;
case 'r':
raw = 1;
break;
}
}
......@@ -178,6 +182,19 @@ main(int argc, char *argv[]) {
fflush(stdout);
continue;
}
if (raw) {
unsigned int i;
for (i = 0 ; i < rdata.length ; /* */ ) {
fprintf(stdout, "%02x", rdata.data[i]);
if ((++i % 20) == 0)
fputs("\n", stdout);
else
if (i == rdata.length)
fputs("\n", stdout);
else
fputs(" ", stdout);
}
}
/* Convert to wire and back? */
if (wire) {
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: rdata.c,v 1.11 1999/01/22 01:21:02 explorer Exp $ */
/* $Id: rdata.c,v 1.12 1999/01/22 01:27:29 marka Exp $ */
#include <config.h>
......@@ -607,6 +607,8 @@ gettoken(isc_lex_t *lexer, isc_token_t *token, isc_tokentype_t expect,
isc_boolean_t eol) {
unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF;
if (expect == isc_tokentype_qstring)
options |= ISC_LEXOPT_QSTRING;
if (expect == isc_tokentype_number)
options |= ISC_LEXOPT_NUMBER;
if (isc_lex_gettoken(lexer, options, token) != ISC_R_SUCCESS)
......@@ -614,6 +616,9 @@ gettoken(isc_lex_t *lexer, isc_token_t *token, isc_tokentype_t expect,
if (eol && ((token->type == isc_tokentype_eol) ||
(token->type == isc_tokentype_eof)))
return (DNS_R_SUCCESS);
if (token->type == isc_tokentype_string &&
expect == isc_tokentype_qstring)
return (DNS_R_SUCCESS);
if (token->type != expect) {
isc_lex_ungettoken(lexer, token);
if (token->type == isc_tokentype_eol ||
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: hinfo_13.c,v 1.6 1999/01/22 00:36:55 marka Exp $ */
/* $Id: hinfo_13.c,v 1.7 1999/01/22 01:27:30 marka Exp $ */
#ifndef RDATA_GENERIC_HINFO_13_H
#define RDATA_GENERIC_HINFO_13_H
......@@ -34,7 +34,7 @@ fromtext_hinfo(dns_rdataclass_t class, dns_rdatatype_t type,
downcase = downcase; /*unused*/
for (i = 0; i < 2 ; i++) {
RETERR(gettoken(lexer, &token, isc_tokentype_string,
RETERR(gettoken(lexer, &token, isc_tokentype_qstring,
ISC_FALSE));
RETERR(txt_fromtext(&token.value.as_textregion, target));
}
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: hinfo_13.h,v 1.6 1999/01/22 00:36:55 marka Exp $ */
/* $Id: hinfo_13.h,v 1.7 1999/01/22 01:27:30 marka Exp $ */
#ifndef RDATA_GENERIC_HINFO_13_H
#define RDATA_GENERIC_HINFO_13_H
......@@ -34,7 +34,7 @@ fromtext_hinfo(dns_rdataclass_t class, dns_rdatatype_t type,
downcase = downcase; /*unused*/
for (i = 0; i < 2 ; i++) {
RETERR(gettoken(lexer, &token, isc_tokentype_string,
RETERR(gettoken(lexer, &token, isc_tokentype_qstring,
ISC_FALSE));
RETERR(txt_fromtext(&token.value.as_textregion, target));
}
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: txt_16.c,v 1.6 1999/01/22 00:36:58 marka Exp $ */
/* $Id: txt_16.c,v 1.7 1999/01/22 01:27:30 marka Exp $ */
#ifndef RDATA_GENERIC_TXT_16_H
#define RDATA_GENERIC_TXT_16_H
......@@ -33,9 +33,10 @@ fromtext_txt(dns_rdataclass_t class, dns_rdatatype_t type,
downcase = downcase; /*unused*/
while (1) {
RETERR(gettoken(lexer, &token, isc_tokentype_string,
RETERR(gettoken(lexer, &token, isc_tokentype_qstring,
ISC_TRUE));
if (token.type != isc_tokentype_string)
if (token.type != isc_tokentype_qstring &&
token.type != isc_tokentype_string)
break;
RETERR(txt_fromtext(&token.value.as_textregion, target));
}
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: txt_16.h,v 1.6 1999/01/22 00:36:58 marka Exp $ */
/* $Id: txt_16.h,v 1.7 1999/01/22 01:27:30 marka Exp $ */
#ifndef RDATA_GENERIC_TXT_16_H
#define RDATA_GENERIC_TXT_16_H
......@@ -33,9 +33,10 @@ fromtext_txt(dns_rdataclass_t class, dns_rdatatype_t type,
downcase = downcase; /*unused*/
while (1) {
RETERR(gettoken(lexer, &token, isc_tokentype_string,
RETERR(gettoken(lexer, &token, isc_tokentype_qstring,
ISC_TRUE));
if (token.type != isc_tokentype_string)
if (token.type != isc_tokentype_qstring &&
token.type != isc_tokentype_string)
break;
RETERR(txt_fromtext(&token.value.as_textregion, target));
}
......
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