Commit | Line | Data |
---|---|---|
959f3c4c JH |
1 | ?RCS: $Id: d_open3.U,v 3.0.1.2 1997/02/28 15:37:12 ram Exp $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1991-1993, Raphael Manfredi | |
4 | ?RCS: | |
5 | ?RCS: You may redistribute only under the terms of the Artistic Licence, | |
6 | ?RCS: as specified in the README file that comes with the distribution. | |
7 | ?RCS: You may reuse parts of this distribution only within the terms of | |
8 | ?RCS: that same Artistic Licence; a copy of which may be found at the root | |
9 | ?RCS: of the source tree for dist 3.0. | |
10 | ?RCS: | |
11 | ?RCS: $Log: d_open3.U,v $ | |
12 | ?RCS: Revision 3.0.1.2 1997/02/28 15:37:12 ram | |
13 | ?RCS: patch61: added ?F: metalint hint | |
14 | ?RCS: | |
15 | ?RCS: Revision 3.0.1.1 1995/07/25 13:58:26 ram | |
16 | ?RCS: patch56: added knowledge of the O_NONBLOCK symbol | |
17 | ?RCS: | |
18 | ?RCS: Revision 3.0 1993/08/18 12:06:44 ram | |
19 | ?RCS: Baseline for dist 3.0 netwide release. | |
20 | ?RCS: | |
21 | ?MAKE:d_open3: test +cc cat +cppflags h_fcntl h_sysfile rm Setvar Findhdr | |
22 | ?MAKE: -pick add $@ %< | |
23 | ?X: It would be easy to separate the h_O_stuff from this. | |
24 | ?X: Is there a reason to do so? -- HMS | |
25 | ?S:d_open3: | |
26 | ?S: This variable conditionally defines the HAS_OPEN3 manifest constant, | |
27 | ?S: which indicates to the C program that the 3 argument version of | |
28 | ?S: the open(2) function is available. | |
29 | ?S:. | |
30 | ?C:HAS_OPEN3 (OPEN3): | |
31 | ?C: This manifest constant lets the C program know that the three | |
32 | ?C: argument form of open(2) is available. | |
33 | ?C:. | |
34 | ?H:#$d_open3 HAS_OPEN3 /**/ | |
35 | ?H:. | |
36 | ?W:%<:O_RDONLY O_WRONLY O_RDWR O_NDELAY O_APPEND O_SYNC O_CREAT O_TRUNC | |
37 | ?W:%<:O_EXCL O_NONBLOCK | |
38 | ?F:!open3 | |
39 | ?LINT:set d_open3 | |
40 | ?LINT:change h_fcntl h_sysfile | |
41 | : Locate the flags for 'open()' | |
42 | echo " " | |
43 | $cat >open3.c <<'EOCP' | |
44 | #include <sys/types.h> | |
45 | #ifdef I_FCNTL | |
46 | #include <fcntl.h> | |
47 | #endif | |
48 | #ifdef I_SYS_FILE | |
49 | #include <sys/file.h> | |
50 | #endif | |
51 | main() { | |
52 | if(O_RDONLY); | |
53 | #ifdef O_TRUNC | |
54 | exit(0); | |
55 | #else | |
56 | exit(1); | |
57 | #endif | |
58 | } | |
59 | EOCP | |
60 | : check sys/file.h first to get FREAD on Sun | |
61 | if $test `./findhdr sys/file.h` && \ | |
62 | $cc $cppflags "-DI_SYS_FILE" -o open3 open3.c >/dev/null 2>&1 ; then | |
63 | h_sysfile=true; | |
64 | echo "<sys/file.h> defines the O_* constants..." >&4 | |
65 | if ./open3; then | |
66 | echo "and you have the 3 argument form of open()." >&4 | |
67 | val="$define" | |
68 | else | |
69 | echo "but not the 3 argument form of open(). Oh, well." >&4 | |
70 | val="$undef" | |
71 | fi | |
72 | elif $test `./findhdr fcntl.h` && \ | |
73 | $cc "-DI_FCNTL" -o open3 open3.c >/dev/null 2>&1 ; then | |
74 | h_fcntl=true; | |
75 | echo "<fcntl.h> defines the O_* constants..." >&4 | |
76 | if ./open3; then | |
77 | echo "and you have the 3 argument form of open()." >&4 | |
78 | val="$define" | |
79 | else | |
80 | echo "but not the 3 argument form of open(). Oh, well." >&4 | |
81 | val="$undef" | |
82 | fi | |
83 | else | |
84 | val="$undef" | |
85 | echo "I can't find the O_* constant definitions! You got problems." >&4 | |
86 | fi | |
87 | set d_open3 | |
88 | eval $setvar | |
89 | $rm -f open3* | |
90 |