diff options
Diffstat (limited to 'src/sysdep.c')
| -rw-r--r-- | src/sysdep.c | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index d32ba6d4de8..cfa0efa7e87 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -623,7 +623,7 @@ sys_subshell (void) dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil); str = (unsigned char *) alloca (SCHARS (dir) + 2); len = SCHARS (dir); - bcopy (SDATA (dir), str, len); + memcpy (str, SDATA (dir), len); if (str[len - 1] != '/') str[len++] = '/'; str[len] = 0; xyzzy: @@ -855,7 +855,7 @@ emacs_get_tty (int fd, struct emacs_tty *settings) /* Retrieve the primary parameters - baud rate, character size, etcetera. */ #ifdef HAVE_TCATTR /* We have those nifty POSIX tcmumbleattr functions. */ - bzero (&settings->main, sizeof (settings->main)); + memset (&settings->main, 0, sizeof (settings->main)); if (tcgetattr (fd, &settings->main) < 0) return -1; @@ -922,7 +922,7 @@ emacs_set_tty (int fd, struct emacs_tty *settings, int flushp) { struct termios new; - bzero (&new, sizeof (new)); + memset (&new, 0, sizeof (new)); /* Get the current settings, and see if they're what we asked for. */ tcgetattr (fd, &new); /* We cannot use memcmp on the whole structure here because under @@ -2715,6 +2715,59 @@ rmdir (char *dpath) #endif /* !HAVE_RMDIR */ +#ifndef HAVE_MEMSET +void * +memset (void *b, int n, size_t length) +{ + unsigned char *p = b; + while (length-- > 0) + *p++ = n; + return b; +} +#endif /* !HAVE_MEMSET */ + +#ifndef HAVE_MEMCPY +void * +memcpy (void *b1, void *b2, size_t length) +{ + unsigned char *p1 = b1, *p2 = b2; + while (length-- > 0) + *p1++ = *p2++; + return b1; +} +#endif /* !HAVE_MEMCPY */ + +#ifndef HAVE_MEMMOVE +void * +memmove (void *b1, void *b2, size_t length) +{ + unsigned char *p1 = b1, *p2 = b2; + if (p1 < p2 || p1 >= p2 + length) + while (length-- > 0) + *p1++ = *p2++; + else + { + p1 += length; + p2 += length; + while (length-- > 0) + *--p1 = *--p2; + } + return b1; +} +#endif /* !HAVE_MEMCPY */ + +#ifndef HAVE_MEMCMP +int +memcmp (void *b1, void *b2, size_t length) +{ + unsigned char *p1 = b1, *p2 = b2; + while (length-- > 0) + if (*p1++ != *p2++) + return p1[-1] < p2[-1] ? -1 : 1; + return 0; +} +#endif /* !HAVE_MEMCMP */ + #ifndef HAVE_STRSIGNAL char * strsignal (int code) |
