diff options
Diffstat (limited to 'src/modconf.c')
-rw-r--r-- | src/modconf.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/modconf.c b/src/modconf.c index 85b2582..64177c1 100644 --- a/src/modconf.c +++ b/src/modconf.c | |||
@@ -1,24 +1,41 @@ | |||
1 | /* This file is part of varnish-mib | ||
2 | Copyright (C) 2018 Sergey Poznyakoff | ||
3 | |||
4 | Varnish-mib is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 3, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | Varnish-mib is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with varnish-mib. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
1 | #include "varnish_mib.h" | 18 | #include "varnish_mib.h" |
2 | #include <ctype.h> | 19 | #include <ctype.h> |
3 | 20 | ||
4 | static int | 21 | static int |
5 | timeout_parser(const char *token, char *line, unsigned *retval) | 22 | timeout_parser(const char *token, char *line, unsigned *retval) |
6 | { | 23 | { |
7 | char *p; | 24 | char *p; |
8 | unsigned long n = strtoul(line, &p, 10); | 25 | unsigned long n = strtoul(line, &p, 10); |
9 | 26 | ||
10 | if (*p) { | 27 | if (*p) { |
11 | if (isspace(*p)) { | 28 | if (isspace(*p)) { |
12 | while (*p && isspace(*p)) | 29 | while (*p && isspace(*p)) |
13 | ++p; | 30 | ++p; |
14 | if (*p) { | 31 | if (*p) { |
15 | config_perror("too many arguments"); | 32 | config_perror("too many arguments"); |
16 | return 1; | 33 | return 1; |
17 | } | 34 | } |
18 | } else { | 35 | } else { |
19 | config_perror("invalid timeout value"); | 36 | config_perror("invalid timeout value"); |
20 | return 1; | 37 | return 1; |
21 | } | 38 | } |
22 | } | 39 | } |
23 | 40 | ||
24 | if (n > UINT_MAX) { | 41 | if (n > UINT_MAX) { |