Blame


1 8951cb19 2022-07-01 op /*
2 8951cb19 2022-07-01 op * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
3 8951cb19 2022-07-01 op *
4 8951cb19 2022-07-01 op * Permission to use, copy, modify, and distribute this software for any
5 8951cb19 2022-07-01 op * purpose with or without fee is hereby granted, provided that the above
6 8951cb19 2022-07-01 op * copyright notice and this permission notice appear in all copies.
7 8951cb19 2022-07-01 op *
8 8951cb19 2022-07-01 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 8951cb19 2022-07-01 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 8951cb19 2022-07-01 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 8951cb19 2022-07-01 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 8951cb19 2022-07-01 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 8951cb19 2022-07-01 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 8951cb19 2022-07-01 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 8951cb19 2022-07-01 op */
16 8951cb19 2022-07-01 op #ifdef __NetBSD__
17 8951cb19 2022-07-01 op # define _OPENBSD_SOURCE
18 8951cb19 2022-07-01 op #endif
19 8951cb19 2022-07-01 op #include <stdlib.h>
20 8951cb19 2022-07-01 op
21 8951cb19 2022-07-01 op int
22 8951cb19 2022-07-01 op main(void)
23 8951cb19 2022-07-01 op {
24 8951cb19 2022-07-01 op const char *errstr;
25 8951cb19 2022-07-01 op
26 8951cb19 2022-07-01 op if (strtonum("1", 0, 2, &errstr) != 1)
27 8951cb19 2022-07-01 op return 1;
28 8951cb19 2022-07-01 op if (errstr != NULL)
29 8951cb19 2022-07-01 op return 2;
30 8951cb19 2022-07-01 op if (strtonum("1x", 0, 2, &errstr) != 0)
31 8951cb19 2022-07-01 op return 3;
32 8951cb19 2022-07-01 op if (errstr == NULL)
33 8951cb19 2022-07-01 op return 4;
34 8951cb19 2022-07-01 op if (strtonum("2", 0, 1, &errstr) != 0)
35 8951cb19 2022-07-01 op return 5;
36 8951cb19 2022-07-01 op if (errstr == NULL)
37 8951cb19 2022-07-01 op return 6;
38 8951cb19 2022-07-01 op if (strtonum("0", 1, 2, &errstr) != 0)
39 8951cb19 2022-07-01 op return 7;
40 8951cb19 2022-07-01 op if (errstr == NULL)
41 8951cb19 2022-07-01 op return 8;
42 8951cb19 2022-07-01 op return 0;
43 8951cb19 2022-07-01 op }