summaryrefslogtreecommitdiff
path: root/U/d_safemcpy.U
diff options
context:
space:
mode:
Diffstat (limited to 'U/d_safemcpy.U')
-rw-r--r--U/d_safemcpy.U82
1 files changed, 0 insertions, 82 deletions
diff --git a/U/d_safemcpy.U b/U/d_safemcpy.U
deleted file mode 100644
index 2f32680709..0000000000
--- a/U/d_safemcpy.U
+++ /dev/null
@@ -1,82 +0,0 @@
-?RCS: $Id: d_safemcpy.U,v 3.0 1993/08/18 12:06:58 ram Exp $
-?RCS:
-?RCS: Copyright (c) 1991-1993, Raphael Manfredi
-?RCS:
-?RCS: You may redistribute only under the terms of the Artistic Licence,
-?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 Licence; a copy of which may be found at the root
-?RCS: of the source tree for dist 3.0.
-?RCS:
-?RCS: $Log: d_safemcpy.U,v $
-?RCS:
-?RCS: Copy "abcde..." string to char abc[] so that
-?RCS: gcc doesn't try to store the string in read-only memory.
-?RCS:
-?RCS: Revision 3.0 1993/08/18 12:06:58 ram
-?RCS: Baseline for dist 3.0 netwide release.
-?RCS:
-?MAKE:d_safemcpy: cat d_memcpy +cc +ccflags +libs rm Oldconfig Setvar
-?MAKE: -pick add $@ %<
-?S:d_safemcpy:
-?S: This variable conditionally defines the HAS_SAFE_MEMCPY symbol if
-?S: the memcpy() routine can do overlapping copies.
-?S:.
-?C:HAS_SAFE_MEMCPY (SAFE_MEMCPY):
-?C: This symbol, if defined, indicates that the memcpy routine is available
-?C: to copy potentially overlapping memory blocks. Otherwise you should
-?C: probably use memmove() or memcpy(). If neither is defined, roll your
-?C: own version.
-?C:.
-?H:#$d_safemcpy HAS_SAFE_MEMCPY /**/
-?H:.
-?LINT: set d_safemcpy
-: can memcpy handle overlapping blocks?
-?X: assume the worst
-val="$undef"
-case "$d_memcpy" in
-"$define")
- echo " "
- echo "Checking to see if your memcpy() can do overlapping copies..." >&4
- $cat >foo.c <<'EOCP'
-main()
-{
-char buf[128], abc[128];
-char *b;
-int len;
-int off;
-int align;
-
-memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
-
-for (align = 7; align >= 0; align--) {
- for (len = 36; len; len--) {
- b = buf+align;
- memcpy(abc, b, len);
- for (off = 1; off <= len; off++) {
- memcpy(b, b+off, len);
- memcpy(b+off, b, len);
- if (memcmp(b, abc, len))
- exit(1);
- }
- }
-}
-exit(0);
-}
-EOCP
- if $cc foo.c -o safemcpy $ccflags $libs >/dev/null 2>&1 ; then
- if ./safemcpy 2>/dev/null; then
- echo "Yes, it can."
- val="$define"
- else
- echo "It can't, sorry."
- fi
- else
- echo "(I can't compile the test program, so we'll assume not...)"
- fi
- ;;
-esac
-$rm -f foo.* safemcpy core
-set d_safemcpy
-eval $setvar
-