| 1 |
/*
|
| 2 |
* Copyright (C) 2000 Ross Combs (rocombs@cs.nmsu.edu)
|
| 3 |
*
|
| 4 |
* This program is free software; you can redistribute it and/or
|
| 5 |
* modify it under the terms of the GNU General Public License
|
| 6 |
* as published by the Free Software Foundation; either version 2
|
| 7 |
* of the License, or (at your option) any later version.
|
| 8 |
*
|
| 9 |
* This program is distributed in the hope that it will be useful,
|
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
* GNU General Public License for more details.
|
| 13 |
*
|
| 14 |
* You should have received a copy of the GNU General Public License
|
| 15 |
* along with this program; if not, write to the Free Software
|
| 16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
| 17 |
*/
|
| 18 |
#include "common/setup_before.h"
|
| 19 |
#ifndef HAVE_MEMCPY
|
| 20 |
|
| 21 |
#ifdef HAVE_STDDEF_H
|
| 22 |
# include <stddef.h>
|
| 23 |
#else
|
| 24 |
# ifndef NULL
|
| 25 |
# define NULL ((void *)0)
|
| 26 |
# endif
|
| 27 |
#endif
|
| 28 |
#ifdef HAVE_BCOPY
|
| 29 |
# ifdef HAVE_STRING_H
|
| 30 |
# include <string.h>
|
| 31 |
# endif
|
| 32 |
# ifdef HAVE_MEMORY_H
|
| 33 |
# include <memory.h>
|
| 34 |
# endif
|
| 35 |
#endif
|
| 36 |
#include "memcpy.h"
|
| 37 |
#include "common/setup_after.h"
|
| 38 |
|
| 39 |
extern void * memcpy(void * dest, void const * src, unsigned long n)
|
| 40 |
{
|
| 41 |
#ifdef HAVE_BCOPY
|
| 42 |
bcopy(src,dest,n);
|
| 43 |
return dest;
|
| 44 |
#else
|
| 45 |
/* very slow, but we don't care */
|
| 46 |
unsigned char * td=dest;
|
| 47 |
unsigned char * ts=src;
|
| 48 |
unsigned long i;
|
| 49 |
|
| 50 |
if (!td || !ts)
|
| 51 |
return NULL;
|
| 52 |
|
| 53 |
for (i=0; i<n; i++)
|
| 54 |
td[i] = ts[i];
|
| 55 |
return dest;
|
| 56 |
#endif
|
| 57 |
}
|
| 58 |
|
| 59 |
#else
|
| 60 |
typedef int filenotempty; /* make ISO standard happy */
|
| 61 |
#endif
|