Skip to content

Instantly share code, notes, and snippets.

@hfm
Created December 6, 2013 07:29
Show Gist options
  • Select an option

  • Save hfm/7819923 to your computer and use it in GitHub Desktop.

Select an option

Save hfm/7819923 to your computer and use it in GitHub Desktop.
#include <stddef.h>
#include <string.h>
#include <memcopy.h>
#undef strcpy
/* Copy SRC to DEST. */
char *
strcpy (dest, src)
char *dest;
const char *src;
{
char c;
char *s = (char *) src;
const ptrdiff_t off = dest - s - 1;
do
{
c = *s++;
s[off] = c;
}
while (c != '\0');
return dest;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment