| 1 | ?RCS: $Id: d_strchr.U 1 2006-08-24 12:32:52Z rmanfredi $ |
| 2 | ?RCS: |
| 3 | ?RCS: Copyright (c) 1991-1997, 2004-2006, 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 4.0. |
| 10 | ?RCS: |
| 11 | ?RCS: $Log: d_strchr.U,v $ |
| 12 | ?RCS: Revision 3.0.1.2 1993/10/16 13:49:20 ram |
| 13 | ?RCS: patch12: added support for HAS_INDEX |
| 14 | ?RCS: patch12: added magic for index() and rindex() |
| 15 | ?RCS: |
| 16 | ?RCS: Revision 3.0.1.1 1993/09/13 16:05:26 ram |
| 17 | ?RCS: patch10: now only defines HAS_STRCHR, no macro remap of index (WAD) |
| 18 | ?RCS: |
| 19 | ?RCS: Revision 3.0 1993/08/18 12:07:32 ram |
| 20 | ?RCS: Baseline for dist 3.0 netwide release. |
| 21 | ?RCS: |
| 22 | ?MAKE:d_strchr d_index: contains strings Setvar Myread Oldconfig Csym |
| 23 | ?MAKE: -pick add $@ %< |
| 24 | ?S:d_strchr: |
| 25 | ?S: This variable conditionally defines HAS_STRCHR if strchr() and |
| 26 | ?S: strrchr() are available for string searching. |
| 27 | ?S:. |
| 28 | ?S:d_index: |
| 29 | ?S: This variable conditionally defines HAS_INDEX if index() and |
| 30 | ?S: rindex() are available for string searching. |
| 31 | ?S:. |
| 32 | ?C:HAS_STRCHR: |
| 33 | ?C: This symbol is defined to indicate that the strchr()/strrchr() |
| 34 | ?C: functions are available for string searching. If not, try the |
| 35 | ?C: index()/rindex() pair. |
| 36 | ?C:. |
| 37 | ?C:HAS_INDEX: |
| 38 | ?C: This symbol is defined to indicate that the index()/rindex() |
| 39 | ?C: functions are available for string searching. |
| 40 | ?C:. |
| 41 | ?H:#$d_strchr HAS_STRCHR /**/ |
| 42 | ?H:#$d_index HAS_INDEX /**/ |
| 43 | ?H:. |
| 44 | ?M:index: HAS_INDEX |
| 45 | ?M:#ifndef HAS_INDEX |
| 46 | ?M:#ifndef index |
| 47 | ?M:#define index strchr |
| 48 | ?M:#endif |
| 49 | ?M:#endif |
| 50 | ?M:. |
| 51 | ?M:rindex: HAS_INDEX |
| 52 | ?M:#ifndef HAS_INDEX |
| 53 | ?M:#ifndef rindex |
| 54 | ?M:#define rindex strrchr |
| 55 | ?M:#endif |
| 56 | ?M:#endif |
| 57 | ?M:. |
| 58 | ?T:vali |
| 59 | ?LINT:set d_strchr d_index |
| 60 | : index or strchr |
| 61 | echo " " |
| 62 | if set index val -f; eval $csym; $val; then |
| 63 | if set strchr val -f d_strchr; eval $csym; $val; then |
| 64 | if $contains strchr "$strings" >/dev/null 2>&1 ; then |
| 65 | ?X: has index, strchr, and strchr in string header |
| 66 | val="$define" |
| 67 | vali="$undef" |
| 68 | echo "strchr() found." >&4 |
| 69 | else |
| 70 | ?X: has index, strchr, and no strchr in string header |
| 71 | val="$undef" |
| 72 | vali="$define" |
| 73 | echo "index() found." >&4 |
| 74 | fi |
| 75 | else |
| 76 | ?X: has only index, no strchr, string header is a moot point |
| 77 | val="$undef" |
| 78 | vali="$define" |
| 79 | echo "index() found." >&4 |
| 80 | fi |
| 81 | else |
| 82 | if set strchr val -f d_strchr; eval $csym; $val; then |
| 83 | val="$define" |
| 84 | vali="$undef" |
| 85 | echo "strchr() found." >&4 |
| 86 | else |
| 87 | echo "No index() or strchr() found!" >&4 |
| 88 | val="$undef" |
| 89 | vali="$undef" |
| 90 | fi |
| 91 | fi |
| 92 | set d_strchr; eval $setvar |
| 93 | val="$vali" |
| 94 | set d_index; eval $setvar |
| 95 | |