diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2006-12-16 18:50:34 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2006-12-16 18:50:34 +0000 |
commit | 19d82ea2d7751a0b7ec8fa66d2a2053a369f0403 (patch) | |
tree | d91fc3a03e096ac77beaf625f8687d85b92e7b05 /usr.sbin/relayctl/parser.c | |
parent | eb9e468ffdd8750ab38d6914ccb20acb388e2102 (diff) |
- 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
Diffstat (limited to 'usr.sbin/relayctl/parser.c')
-rw-r--r-- | usr.sbin/relayctl/parser.c | 26 |
1 files changed, 16 insertions, 10 deletions
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 <pyr@spootnik.org> @@ -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; |