MCPcopy Create free account
hub / github.com/coreboot/coreboot / check_int

Function check_int

util/post/post.c:27–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27void check_int(long val, int min, int max, int err, char *string, char *endptr,
28 char *progname)
29{
30 if (val < min || val > max) {
31 usage(progname,
32 "\nError: The value has to be between 0x%x and 0x%x\n",
33 min, max);
34 exit(EXIT_FAILURE);
35 }
36
37 if (endptr == string || *endptr != '\0') {
38 usage(progname, "\nError: An integer is required\n");
39 exit(EXIT_FAILURE);
40 }
41
42 if ((err) && (!val)) {
43 perror("strtol");
44 exit(EXIT_FAILURE);
45 }
46}
47
48int main(int argc, char *argv[])
49{

Callers 1

mainFunction · 0.85

Calls 3

exitFunction · 0.85
perrorFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected