]>
Commit | Line | Data |
---|---|---|
885824d3 | 1 | /* |
2 | ** test of standard library | |
3 | */ | |
4 | ||
5 | int compare (int x, int y) | |
6 | { | |
7 | x = y; | |
8 | return (3); | |
9 | } | |
10 | ||
11 | char *compare2 (int x, int y) | |
12 | { | |
13 | x = y; | |
14 | return "ok"; | |
15 | } | |
16 | ||
17 | void | |
18 | leave (int i) | |
19 | { | |
20 | exit ("hullo"); /* 1. Function exit expects arg 1 to be int gets char * */ | |
21 | exit (i); /* 2. Unreachable code */ | |
22 | } | |
23 | ||
24 | void | |
25 | print (char *s, FILE *f) | |
26 | { | |
27 | char c; | |
28 | ||
29 | fprintf (f, s); | |
30 | printf(s); | |
31 | fprintf (stderr, s); | |
32 | ||
33 | c = fgetc(f); /* 3. Assignment of int to char: c = fgetc(f) */ | |
34 | c = getc (f); /* 4. Assignment of int to char: c = getc(f) */ | |
35 | } | |
36 | ||
37 | int | |
38 | main (void) | |
39 | { | |
40 | unsigned int x; | |
41 | ||
42 | x = NULL; | |
43 | ||
44 | /*@-null@*/ /* suppress errors for passing NULL's */ | |
45 | /*@-noeffect@*/ | |
46 | (void) bsearch (NULL, NULL, sizeof(int), compare) ; /* 5, 6 */ | |
47 | (void) bsearch (NULL, NULL, sizeof(int), sizeof(int), (int (*) ()) compare) ; /* ok */ | |
48 | bsearch (NULL, NULL, sizeof(int), sizeof(int), (char (*) ()) compare2) ; /* 7, 8 */ | |
49 | /*@=noeffect@*/ | |
50 | ||
51 | qsort (NULL, x, x, (int (*)()) compare); | |
52 | qsort (x, x, x, (char (*)()) compare2); /* 9, 10. */ | |
53 | ||
54 | signal (SIGHUP, compare); /* 11. */ | |
55 | signal (SIGHUP, leave); | |
56 | ||
57 | return 23; | |
58 | } | |
59 | ||
60 |