summaryrefslogtreecommitdiff
path: root/mcon/U/d_scandir.U
blob: 8f089c36a567d73ec656a505a1ed4fbd4473f5d1 (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
?RCS: $Id: d_scandir.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: $Log: d_scandir.U,v $
?RCS: Revision 3.0.1.1  1994/01/24  14:06:35  ram
?RCS: patch16: created
?RCS:
?MAKE:d_scandir: Trylink cat i_dirent
?MAKE:	-pick add $@ %<
?S:d_scandir:
?S:	This variable conditionally defines HAS_SCANDIR if scandir() is
?S:	available to scan a directory.
?S:.
?C:HAS_SCANDIR:
?C:	This symbol, if defined, indicates that the scandir routine is
?C:	available to scan a directory.
?C:.
?H:#$d_scandir HAS_SCANDIR	/**/
?H:.
?LINT:set d_scandir
: see if scandir exists
$cat >try.c <<EOC
#$i_dirent I_DIRENT
#ifdef I_DIRENT
#include <dirent.h>
#endif
int filter(const struct dirent *d)
{
	(void) d;
	return 1;
}

int compare(const struct dirent **a, const struct dirent **b)
{
	(void) a;
	(void) b;
	return 1;
}

int main(void)
{
	static struct dirent **namelist;
	static int ret;
	ret |= scandir("dir", &namelist, filter, compare);
	return ret ? 0 : 1;
}
EOC
cyn=scandir
set d_scandir
eval $trylink