Commit | Line | Data |
---|---|---|
5d52f3dc JH |
1 | ?RCS: |
2 | ?RCS: Copyright (c) 1999, Jarkko Hietaniemi | |
0065f4af | 3 | ?RCS: |
5d52f3dc JH |
4 | ?RCS: You may redistribute only under the terms of the Artistic Licence, |
5 | ?RCS: as specified in the README file that comes with the distribution. | |
6 | ?RCS: You may reuse parts of this distribution only within the terms of | |
7 | ?RCS: that same Artistic Licence; a copy of which may be found at the root | |
8 | ?RCS: of the source tree for dist 3.0. | |
9 | ?RCS: | |
0f00356b | 10 | ?MAKE:gidsign: Myread Typedef gidtype Compile run |
5d52f3dc JH |
11 | ?MAKE: -pick add $@ %< |
12 | ?S:gidsign: | |
13 | ?S: This variable contains the signedness of a gidtype. | |
14 | ?S: 1 for unsigned, -1 for signed. | |
15 | ?S:. | |
c9c3891b | 16 | ?C:Gid_t_sign: |
5d52f3dc JH |
17 | ?C: This symbol holds the signedess of a Gid_t. |
18 | ?C: 1 for unsigned, -1 for signed. | |
19 | ?C:. | |
c9c3891b | 20 | ?H:#define Gid_t_sign $gidsign /* GID sign */ |
5d52f3dc | 21 | ?H:. |
67d5479e | 22 | ?T:yyy zzz |
0065f4af | 23 | ?F:!try |
0065f4af | 24 | : Check if GID is signed |
5d52f3dc | 25 | echo " " |
67d5479e JH |
26 | case "$gidtype" in |
27 | *_t) zzz="$gidtype" ;; | |
28 | *) zzz="gid" ;; | |
29 | esac | |
0065f4af | 30 | echo "Checking the sign of $zzz..." >&4 |
67d5479e | 31 | cat > try.c <<EOCP |
5d52f3dc JH |
32 | #include <sys/types.h> |
33 | #include <stdio.h> | |
34 | int main() { | |
35 | $gidtype foo = -1; | |
36 | if (foo < 0) | |
37 | printf("-1\n"); | |
38 | else | |
39 | printf("1\n"); | |
40 | } | |
41 | EOCP | |
384e0155 | 42 | set try |
5d52f3dc | 43 | if eval $compile; then |
0f00356b | 44 | yyy=`$run ./try` |
5d52f3dc JH |
45 | case "$yyy" in |
46 | '') gidsign=1 | |
47 | echo "(I can't execute the test program--guessing unsigned.)" >&4 | |
48 | ;; | |
49 | *) gidsign=$yyy | |
50 | case "$gidsign" in | |
67d5479e JH |
51 | 1) echo "Your $zzz is unsigned." ;; |
52 | -1) echo "Your $zzz is signed." ;; | |
5d52f3dc | 53 | esac |
67d5479e | 54 | ;; |
5d52f3dc JH |
55 | esac |
56 | else | |
57 | gidsign=1 | |
58 | echo "(I can't compile the test program--guessing unsigned.)" >&4 | |
59 | fi | |
60 | ||
61 |