wire_test.c revision 9c3531d72aeaad6c5f01efe6a1c82023e1379e4d
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
/* $Id: wire_test.c,v 1.50 2000/06/22 21:50:58 tale Exp $ */
#include <config.h>
#include <stdlib.h>
#include "printmsg.h"
static inline void
if (result != ISC_R_SUCCESS) {
exit(1);
}
}
static int
fromhex(char c) {
if (c >= '0' && c <= '9')
return (c - '0');
else if (c >= 'a' && c <= 'f')
return (c - 'a' + 10);
else if (c >= 'A' && c <= 'F')
return (c - 'A' + 10);
printf("bad input format: %02x\n", c);
exit(3);
/* NOTREACHED */
}
int
unsigned char *bp;
int n;
FILE *f;
unsigned char b[1000];
char s[1000];
if (argc > 1) {
if (f == NULL) {
printf("fopen failed\n");
exit(1);
}
} else
f = stdin;
bp = b;
rp = s;
wp = s;
len = 0;
while (*rp != '\0') {
if (*rp == '#')
break;
len++;
}
rp++;
}
if (len == 0)
break;
if (len % 2 != 0) {
exit(1);
}
if (len > (sizeof b) * 2) {
printf("input too long\n");
exit(2);
}
rp = s;
for (i = 0; i < len; i += 2) {
n *= 16;
*bp++ = n;
}
}
if (need_close)
fclose(f);
isc_buffer_init(&source, b, sizeof(b));
/*
* XXXMLG
* Changing this here is a hack, and should not be done in reasonable
* application code, ever.
*/
memset(b, 0, sizeof(b));
for (i = 0 ; i < DNS_SECTION_MAX ; i++)
printf("Message rendered.\n");
return (0);
}