Blame


1 5c342d05 2021-01-21 op /*
2 5c342d05 2021-01-21 op * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
3 5c342d05 2021-01-21 op *
4 5c342d05 2021-01-21 op * Permission to use, copy, modify, and distribute this software for any
5 5c342d05 2021-01-21 op * purpose with or without fee is hereby granted, provided that the above
6 5c342d05 2021-01-21 op * copyright notice and this permission notice appear in all copies.
7 5c342d05 2021-01-21 op *
8 5c342d05 2021-01-21 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 5c342d05 2021-01-21 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 5c342d05 2021-01-21 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 5c342d05 2021-01-21 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 5c342d05 2021-01-21 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 5c342d05 2021-01-21 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 5c342d05 2021-01-21 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 5c342d05 2021-01-21 op */
16 5c342d05 2021-01-21 op
17 5c342d05 2021-01-21 op #include <stdlib.h>
18 5c342d05 2021-01-21 op
19 5c342d05 2021-01-21 op int
20 5c342d05 2021-01-21 op main(void)
21 5c342d05 2021-01-21 op {
22 5c342d05 2021-01-21 op const char *str = "42", *errstr;
23 5c342d05 2021-01-21 op int res;
24 5c342d05 2021-01-21 op
25 5c342d05 2021-01-21 op res = strtonum(str, 1, 64, &errstr);
26 5c342d05 2021-01-21 op return res != 42 || errstr != NULL;
27 5c342d05 2021-01-21 op }