Blob

Date:
Fri Jul 1 19:42:55 2022 UTC
Message:
switch to kristaps@' oconfigure It's a bit ugly to depend _only_ on the OpenBSD make infrastructure; it's better when things are portable! Making mymenu-portable would be more effort than what it's worth it, so just make the main version portable (again). kristaps@' oconfigure (used also by mandoc-portable and mymenu) is a lightweight configure system that's really nice to use. see GitHub issue #1

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