]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * teststrtoul.c -- | |
3 | * | |
4 | * This file contains a simple program to detect broken versions | |
5 | * of strtoul, like those on AIX. The broken versions return an | |
6 | * incorrect terminator pointer for the string "0". This program | |
7 | * exits with a normal status if strtoul does the right thing, and | |
8 | * it exits with a non-zero status if strtoul is bogus. Unlike | |
9 | * the other test programs, this one must actually be executed to | |
10 | * be sure that it works. | |
11 | * | |
12 | * Copyright 1991 Regents of the University of California | |
13 | * Permission to use, copy, modify, and distribute this | |
14 | * software and its documentation for any purpose and without | |
15 | * fee is hereby granted, provided that this copyright | |
16 | * notice appears in all copies. The University of California | |
17 | * makes no representations about the suitability of this | |
18 | * software for any purpose. It is provided "as is" without | |
19 | * express or implied warranty. | |
20 | */ | |
21 | ||
22 | #ifndef lint | |
23 | static char rcsid[] = "$Header: /user6/ouster/tcl/compat/RCS/teststrtoul.c,v 1.2 92/01/07 10:02:56 ouster Exp $ SPRITE (Berkeley)"; | |
24 | #endif /* not lint */ | |
25 | ||
26 | extern int strtoul(); | |
27 | ||
28 | int main() | |
29 | { | |
30 | char *string = "0"; | |
31 | char *term; | |
32 | int value; | |
33 | ||
34 | value = strtoul(string, &term, 0); | |
35 | if ((value != 0) || (term != (string+1))) { | |
36 | exit(1); | |
37 | } | |
38 | exit(0); | |
39 | } |