ndb/dnsquery, ndb/csquery: handle long lines
This commit is contained in:
parent
94018b2130
commit
fc3c91d91f
|
@ -16,7 +16,7 @@ usage(void)
|
||||||
void
|
void
|
||||||
query(char *addr)
|
query(char *addr)
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[8192];
|
||||||
int fd, n;
|
int fd, n;
|
||||||
|
|
||||||
fd = open(server, ORDWR);
|
fd = open(server, ORDWR);
|
||||||
|
@ -31,10 +31,9 @@ query(char *addr)
|
||||||
}
|
}
|
||||||
if(!statusonly){
|
if(!statusonly){
|
||||||
seek(fd, 0, 0);
|
seek(fd, 0, 0);
|
||||||
while((n = read(fd, buf, sizeof(buf)-1)) > 0){
|
while((n = read(fd, buf, sizeof(buf))) > 0)
|
||||||
buf[n] = 0;
|
write(1, buf, n);
|
||||||
print("%s\n", buf);
|
write(1, "\n", 1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ setup(int argc, char **argv)
|
||||||
static void
|
static void
|
||||||
querydns(int fd, char *line, int n)
|
querydns(int fd, char *line, int n)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[8192+1];
|
||||||
|
|
||||||
seek(fd, 0, 0);
|
seek(fd, 0, 0);
|
||||||
if(write(fd, line, n) != n) {
|
if(write(fd, line, n) != n) {
|
||||||
|
@ -46,10 +46,9 @@ querydns(int fd, char *line, int n)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
seek(fd, 0, 0);
|
seek(fd, 0, 0);
|
||||||
buf[0] = '\0';
|
while((n = read(fd, buf, sizeof(buf)-1)) > 0){
|
||||||
while((n = read(fd, buf, sizeof(buf))) > 0){
|
buf[n++] = '\n';
|
||||||
buf[n] = '\0';
|
write(1, buf, n);
|
||||||
print("%s\n", buf);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue