summaryrefslogtreecommitdiff
path: root/mcon/U/d_strchr.U
blob: 310b13780731b0d3fcd38f6f45b33a4c48679802 (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
?RCS: $Id: d_strchr.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_strchr.U,v $
?RCS: Revision 3.0.1.2  1993/10/16  13:49:20  ram
?RCS: patch12: added support for HAS_INDEX
?RCS: patch12: added magic for index() and rindex()
?RCS:
?RCS: Revision 3.0.1.1  1993/09/13  16:05:26  ram
?RCS: patch10: now only defines HAS_STRCHR, no macro remap of index (WAD)
?RCS:
?RCS: Revision 3.0  1993/08/18  12:07:32  ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?MAKE:d_strchr d_index: Trylink cat
?MAKE:	-pick add $@ %<
?S:d_strchr:
?S:	This variable conditionally defines HAS_STRCHR if strchr() and
?S:	strrchr() are available for string searching.
?S:.
?S:d_index:
?S:	This variable conditionally defines HAS_INDEX if index() and
?S:	rindex() are available for string searching.
?S:.
?C:HAS_STRCHR:
?C:	This symbol is defined to indicate that the strchr()/strrchr()
?C:	functions are available for string searching. If not, try the
?C:	index()/rindex() pair.
?C:.
?C:HAS_INDEX:
?C:	This symbol is defined to indicate that the index()/rindex()
?C:	functions are available for string searching.
?C:.
?H:#$d_strchr HAS_STRCHR	/**/
?H:#$d_index HAS_INDEX	/**/
?H:.
?M:index: HAS_INDEX
?M:#ifndef HAS_INDEX
?M:#ifndef index
?M:#define index strchr
?M:#endif
?M:#endif
?M:.
?M:rindex: HAS_INDEX
?M:#ifndef HAS_INDEX
?M:#ifndef rindex
?M:#define rindex strrchr
?M:#endif
?M:#endif
?M:.
?LINT:set d_strchr d_index
: index or strchr
$cat >try.c <<EOC
#include <string.h>
int main(void)
{
	static char ret;
	static int c;
	ret |= *strchr("string", c);
	return ret ? 0 : 1;
}
EOC
cyn=strchr
set d_strchr
eval $trylink

$cat >try.c <<EOC
#include <strings.h>
int main(void)
{
	static char ret;
	static int c;
	ret |= *index("string", c);
	return ret ? 0 : 1;
}
EOC
cyn=index
set d_index 
eval $trylink