From 19d82ea2d7751a0b7ec8fa66d2a2053a369f0403 Mon Sep 17 00:00:00 2001 From: Reyk Floeter Date: Sat, 16 Dec 2006 18:50:34 +0000 Subject: - allow to use host/service/table names instead of Ids in hostatectl. - minor change of the "hostatectl show" command output - increase the max service and tag names (max pf tag name size is 64 now!) thanks to pyr who found a bug in my initial diff --- usr.sbin/relayctl/parser.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'usr.sbin/relayctl/parser.c') diff --git a/usr.sbin/relayctl/parser.c b/usr.sbin/relayctl/parser.c index 2f535990ed9..43703a6622b 100644 --- a/usr.sbin/relayctl/parser.c +++ b/usr.sbin/relayctl/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.3 2006/12/16 17:53:03 deraadt Exp $ */ +/* $OpenBSD: parser.c,v 1.4 2006/12/16 18:50:33 reyk Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard @@ -166,23 +166,29 @@ match_token(const char *word, const struct token table[]) } break; case HOSTID: - res.id = strtonum(word, 0, UINT_MAX, &errstr); - if (errstr) - errx(1, "host id %s is %s", word, errstr); + res.id.id = strtonum(word, 0, UINT_MAX, &errstr); + if (errstr) { + strlcpy(res.id.name, word, sizeof(res.id.name)); + res.id.id = EMPTY_ID; + } t = &table[i]; match++; break; case TABLEID: - res.id = strtonum(word, 0, UINT_MAX, &errstr); - if (errstr) - errx(1, "table id %s is %s", word, errstr); + res.id.id = strtonum(word, 0, UINT_MAX, &errstr); + if (errstr) { + strlcpy(res.id.name, word, sizeof(res.id.name)); + res.id.id = EMPTY_ID; + } t = &table[i]; match++; break; case SERVICEID: - res.id = strtonum(word, 0, UINT_MAX, &errstr); - if (errstr) - errx(1, "service id %s is %s", word, errstr); + res.id.id = strtonum(word, 0, UINT_MAX, &errstr); + if (errstr) { + strlcpy(res.id.name, word, sizeof(res.id.name)); + res.id.id = EMPTY_ID; + } t = &table[i]; match++; break; -- cgit v1.2.3