commit 47b619d9e3d61a804854b1c4c67314dc7a30e19f parent 84811fca278a030be26ff5739dc6e267461fba4c Author: Naveen Narayanan <zerous@nocebo.space> Date: Sat, 18 Sep 2021 16:55:50 +0200 Parse port number Diffstat:
M | parser.c | | | 12 | ++++++++++++ |
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/parser.c b/parser.c @@ -325,6 +325,18 @@ ipaddr() static int portnum() { + int p; + + if (!word()) + return 0; + if (strcmp(token, "port")) + return 0; + if (!word()) + return 0; + if ((p = range(token, 1, 65535)) == -1) + return 0; + + printf("portnum ok: %d\n", p); return 1; }