2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 1996, 1997
5 * Sleepycat Software. All rights reserved.
11 static const char sccsid[] = "@(#)getlong.c 10.2 (Sleepycat) 5/1/97";
14 #ifndef NO_SYSTEM_INCLUDES
26 * Return a long value inside of basic parameters.
28 * PUBLIC: void get_long __P((char *, long, long, long *));
31 get_long(p, min, max, storep)
33 long min, max, *storep;
39 val = strtol(p, &end, 10);
40 if ((val == LONG_MIN || val == LONG_MAX) && errno == ERANGE)
42 if (p[0] == '\0' || end[0] != '\0')
43 errx(1, "%s: Invalid numeric argument", p);
45 errx(1, "%s: Less than minimum value (%ld)", p, min);
47 errx(1, "%s: Greater than maximum value (%ld)", p, max);