summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpctl
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2007-03-03 14:56:44 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2007-03-03 14:56:44 +0000
commit49a7e6a323545e9f1f5e8211e59186614edfc1aa (patch)
tree743fd615a111f08ad933f585d367b3a4333b0c07 /usr.sbin/bgpctl
parent4a77156b9c5b1a78084c325c79794bed77dc7011 (diff)
make parse_response (and thus whois) return 0 for no object found, and n+1
for object found with n matched attributes. this way we can distinguish between no object found and object without relevant attributes
Diffstat (limited to 'usr.sbin/bgpctl')
-rw-r--r--usr.sbin/bgpctl/irr_parser.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/bgpctl/irr_parser.c b/usr.sbin/bgpctl/irr_parser.c
index 8d9e34a9e45..f2ea0f48c85 100644
--- a/usr.sbin/bgpctl/irr_parser.c
+++ b/usr.sbin/bgpctl/irr_parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: irr_parser.c,v 1.1 2007/03/03 11:45:30 henning Exp $ */
+/* $OpenBSD: irr_parser.c,v 1.2 2007/03/03 14:56:43 henning Exp $ */
/*
* Copyright (c) 2007 Henning Brauer <henning@openbsd.org>
@@ -39,6 +39,12 @@ int policy_additem(char *, struct policy_item *);
int parse_asset(char *, char *);
int parse_route(char *, char *);
+/*
+ * parse_response() return values:
+ * -1 error
+ * 0 object not found
+ * >0 number of lines matched plus 1
+ */
int
parse_response(FILE *f, enum qtype qtype)
{
@@ -46,7 +52,7 @@ parse_response(FILE *f, enum qtype qtype)
int cnt, n;
lineno = 1;
- cnt = 0;
+ cnt = 1;
while ((val = irr_getln(f)) != NULL) {
if (!strncmp(val, "%ERROR:101:", 11)) /* no entries found */
return (0);