2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-29 13:28:14 +00:00

Get rid of double spacing when printing DNS results.

This commit is contained in:
Ted Lemon 2000-02-03 04:38:08 +00:00
parent e721773f63
commit 2d3bd461ae

View File

@ -22,7 +22,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: print.c,v 1.36 2000/02/03 04:31:25 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; "$Id: print.c,v 1.37 2000/02/03 04:38:08 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@ -900,8 +900,6 @@ void print_dns_status (int status, ns_updque *uq)
for (u = ISC_LIST_HEAD (*uq); u; u = ISC_LIST_NEXT (u, r_link)) { for (u = ISC_LIST_HEAD (*uq); u; u = ISC_LIST_NEXT (u, r_link)) {
ttlp = 0; ttlp = 0;
if (s != &obuf [0] && s + 1 < end)
*s++ = ' ';
switch (u -> r_opcode) switch (u -> r_opcode)
{ {
@ -928,29 +926,29 @@ void print_dns_status (int status, ns_updque *uq)
break; break;
} }
if (!position) { if (!position) {
if (s != &obuf [0] && s + 1 < end)
*s++ = ' ';
if (s + strlen (op) < end) { if (s + strlen (op) < end) {
strcpy (s, op); strcpy (s, op);
s += strlen (s); s += strlen (s);
if (s + 1 < end)
*s++ = ' ';
} }
} else { } else {
if (s != obuf [0] && s + 1 < end)
*s++ = ' ';
if (s + strlen (predicate) < end) { if (s + strlen (predicate) < end) {
strcpy (s, predicate); strcpy (s, predicate);
s += strlen (s); s += strlen (s);
if (s + 1 < end)
*s++ = ' ';
} }
predicate = "and"; predicate = "and";
} }
if (ttlp) { if (ttlp) {
if (s + 1 < end)
*s++ = ' ';
/* 27 is as big as a ttl can get. */ /* 27 is as big as a ttl can get. */
if (s + 27 < end) { if (s + 27 < end) {
sprintf (s, "%lu", sprintf (s, "%lu",
(unsigned long)(u -> r_ttl)); (unsigned long)(u -> r_ttl));
s += strlen (s); s += strlen (s);
if (s + 1 < end)
*s++ = ' ';
} }
} }
switch (u -> r_class) { switch (u -> r_class) {
@ -968,10 +966,10 @@ void print_dns_status (int status, ns_updque *uq)
break; break;
} }
if (s + strlen (en) < end) { if (s + strlen (en) < end) {
strcpy (s, en);
s += strlen (en);
if (s + 1 < end) if (s + 1 < end)
*s++ = ' '; *s++ = ' ';
strcpy (s, en);
s += strlen (en);
} }
switch (u -> r_type) { switch (u -> r_type) {
case T_A: case T_A:
@ -994,20 +992,22 @@ void print_dns_status (int status, ns_updque *uq)
break; break;
} }
if (s + strlen (en) < end) { if (s + strlen (en) < end) {
strcpy (s, en);
s += strlen (en);
if (s + 1 < end) if (s + 1 < end)
*s++ = ' '; *s++ = ' ';
strcpy (s, en);
s += strlen (en);
} }
if (u -> r_dname) { if (u -> r_dname) {
if (s + 1 < end)
*s++ = ' ';
if (s + strlen (u -> r_dname) < end) { if (s + strlen (u -> r_dname) < end) {
strcpy (s, u -> r_dname); strcpy (s, u -> r_dname);
s += strlen (s); s += strlen (s);
if (s + 1 < end)
*s++ = ' ';
} }
} }
if (u -> r_data) { if (u -> r_data) {
if (s + 1 < end)
*s++ = ' ';
if (u -> r_type == T_TXT) { if (u -> r_type == T_TXT) {
if (s + 1 < end) if (s + 1 < end)
*s++ = '"'; *s++ = '"';
@ -1019,16 +1019,14 @@ void print_dns_status (int status, ns_updque *uq)
if (s + 1 < end) if (s + 1 < end)
*s++ = '"'; *s++ = '"';
} }
if (s + 1 < end)
*s++ = ' ';
} }
} }
if (position) { if (position) {
if (s + 1 < end)
*s++ = ' ';
if (s + strlen (op) < end) { if (s + strlen (op) < end) {
strcpy (s, op); strcpy (s, op);
s += strlen (s); s += strlen (s);
if (s + 1 < end)
*s++ = ' ';
} }
} }
if (u == ISC_LIST_TAIL (*uq)) if (u == ISC_LIST_TAIL (*uq))
@ -1040,6 +1038,10 @@ void print_dns_status (int status, ns_updque *uq)
} }
errorp = 1; errorp = 1;
switch (status) { switch (status) {
case -1:
en = "resolver failed";
break;
case FORMERR: case FORMERR:
en = "format error"; en = "format error";
break; break;