blob: a8e070e15f3b29cd1e8687b631f107eee599f76e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
?RCS: $Id: d_closedir.U 167 2013-05-08 17:58:00Z rmanfredi $
?RCS:
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS:
?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?RCS: Original Author: Andy Dougherty <doughera@lafcol.lafayette.edu>
?RCS:
?RCS: $Log: d_closedir.U,v $
?RCS: Revision 3.0.1.3 1997/02/28 15:31:26 ram
?RCS: patch61: added ?F: metalint hint
?RCS:
?RCS: Revision 3.0.1.2 1994/10/29 16:11:18 ram
?RCS: patch36: added 'ldflags' to the test compile line (ADO)
?RCS:
?RCS: Revision 3.0.1.1 1994/08/29 16:07:21 ram
?RCS: patch32: created by ADO
?RCS:
?MAKE:d_closedir d_void_closedir: Trylink cat i_dirent i_sysdir i_sysndir \
cc ccflags ldflags libs Setvar rm
?MAKE: -pick add $@ %<
?S:d_closedir:
?S: This variable conditionally defines HAS_CLOSEDIR if closedir() is
?S: available.
?S:.
?C:HAS_CLOSEDIR:
?C: This symbol, if defined, indicates that the closedir() routine is
?C: available.
?C:.
?H:#$d_closedir HAS_CLOSEDIR /**/
?H:.
?S:d_void_closedir:
?S: This variable conditionally defines VOID_CLOSEDIR if closedir()
?S: does not return a value.
?S:.
?C:VOID_CLOSEDIR:
?C: This symbol, if defined, indicates that the closedir() routine
?C: does not return a value.
?C:.
?H:#$d_void_closedir VOID_CLOSEDIR /**/
?H:.
?F:!closedir
?LINT:set d_closedir d_void_closedir
: see if closedir exists
$cat >try.c <<EOC
#$i_dirent I_DIRENT
#ifdef I_DIRENT
#include <dirent.h>
#endif
int main(void)
{
static DIR *dir;
dir = opendir("path");
closedir(dir);
return 0;
}
EOC
cyn=closedir
set d_closedir
eval $trylink
@if VOID_CLOSEDIR || d_void_closedir
?X: The following contortions are designed so we can call closedir()
?X: and check whether it returns a value. The contortions are designed
?X: to portably pick up the correct directory header, for those
?X: systems that support various mutually incompatible directory functions.
?X: This is from perl5's perl.h
case "$d_closedir" in
"$define")
echo " "
echo "Checking whether closedir() returns a status..." >&4
cat > closedir.c <<EOM
#$i_dirent I_DIRENT /**/
#$i_sysdir I_SYS_DIR /**/
#$i_sysndir I_SYS_NDIR /**/
#if defined(I_DIRENT)
#include <dirent.h>
#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
#include <sys/dir.h>
#endif
#else
#ifdef I_SYS_NDIR
#include <sys/ndir.h>
#else
#ifdef I_SYS_DIR
#ifdef hp9000s500
#include <ndir.h> /* may be wrong in the future */
#else
#include <sys/dir.h>
#endif
#endif
#endif
#endif
int main() { return closedir(opendir(".")); }
EOM
if $cc $ccflags -o closedir closedir.c $ldflags $libs > /dev/null 2>&1; then
if ./closedir > /dev/null 2>&1 ; then
echo "Yes, it does."
val="$undef"
else
echo "No, it doesn't."
val="$define"
fi
else
echo "(I can't seem to compile the test program--assuming it doesn't)"
val="$define"
fi
;;
*)
val="$undef";
;;
esac
set d_void_closedir
eval $setvar
$rm -f closedir*
@end
|