changeset 109238:7be7159afb6f

Merge from mainline.
author Katsumi Yamaoka <katsumi@flagship2>
date Thu, 08 Jul 2010 11:50:25 +0000
parents 148f49fd0955 (current diff) 01e36ca71747 (diff)
children bd8a2e3fc014
files src/prefix-args.c
diffstat 123 files changed, 1470 insertions(+), 1885 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jul 07 12:15:48 2010 +0000
+++ b/ChangeLog	Thu Jul 08 11:50:25 2010 +0000
@@ -1,3 +1,15 @@
+2010-07-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* configure.in (PRE_EDIT_LDFLAGS, POST_EDIT_LDFLAGS): Remove.
+
+	* configure.in (UNEXEC_OBJ): Add comment about values for MSDOS
+	and MSWindows.
+
+2010-07-07  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* configure.in: Don't check for bcopy, bcmp, bzero.  Don't include
+	<strings.h> and don't define bcopy, bzero, BCMP in config.h.
+
 2010-07-07  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* configure.in (getenv): Remove K&R declaration.
--- a/admin/CPP-DEFINES	Wed Jul 07 12:15:48 2010 +0000
+++ b/admin/CPP-DEFINES	Thu Jul 08 11:50:25 2010 +0000
@@ -79,8 +79,6 @@
 
 AIX
 AMPERSAND_FULL_NAME
-BCOPY_DOWNWARD_SAFE
-BCOPY_UPWARD_SAFE
 BITS_PER_EMACS_INT
 BITS_PER_LONG
 BITS_PER_CHAR
@@ -118,7 +116,6 @@
 FILE_SYSTEM_CASE
 FLOAT_CHECK_DOMAIN
 FSCALE
-GAP_USE_BCOPY
 GC_LISP_OBJECT_ALIGNMENT
 GC_MARK_SECONDARY_STACK
 GC_MARK_STACK
@@ -128,8 +125,6 @@
 GNU_LINUX
 GNU_MALLOC
 HAVE_AIX_SMT_EXP
-HAVE_BCMP
-HAVE_BCOPY
 HAVE_CBRT
 HAVE_CLOSEDIR
 HAVE_DUP2
@@ -191,7 +186,6 @@
 HAVE_SYS_TIME_H
 HAVE_TCATTR
 HAVE_TERMIOS_H
-HAVE_TEXT_START
 HAVE_TIMEVAL
 HAVE_TM_ZONE
 HAVE_TZSET
@@ -267,7 +261,6 @@
 TAB3
 TABDLY
 TERM
-TEXT_START
 THIS_IS_CONFIGURE
 TIME_WITH_SYS_TIME
 TIOCSIGSEND
@@ -319,10 +312,7 @@
 abort
 access
 alloca
-bcmp
-bcopy
 brk
-bzero
 calloc
 chdir
 chmod
--- a/admin/ChangeLog	Wed Jul 07 12:15:48 2010 +0000
+++ b/admin/ChangeLog	Thu Jul 08 11:50:25 2010 +0000
@@ -1,3 +1,9 @@
+2010-07-07  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
+	(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
+	Remove.
+
 2010-06-12  Eli Zaretskii  <eliz@gnu.org>
 
 	* unidata/bidimirror.awk: New file.
--- a/configure	Wed Jul 07 12:15:48 2010 +0000
+++ b/configure	Thu Jul 08 11:50:25 2010 +0000
@@ -600,8 +600,6 @@
 MOUSE_SUPPORT
 LIB_GCC
 LINKER
-POST_EDIT_LDFLAGS
-PRE_EDIT_LDFLAGS
 LD_SWITCH_SYSTEM_TEMACS
 POST_ALLOC_OBJ
 PRE_ALLOC_OBJ
@@ -5484,6 +5482,8 @@
 
 UNEXEC_OBJ=unexelf.o
 case "$opsys" in
+  # MSDOS uses unexec.o
+  # MSWindows uses unexw32.o
   aix4-2)
    UNEXEC_OBJ=unexaix.o
    ;;
@@ -11168,12 +11168,12 @@
 
 for ac_func in gethostname getdomainname dup2 \
 rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
-random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime setsid \
+random lrand48 logb frexp fmod rint cbrt ftime setsid \
 strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
 utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \
 __fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
 sendto recvfrom getsockopt setsockopt getsockname getpeername \
-gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \
+gai_strerror mkstemp getline getdelim mremap memmove fsync sync \
 memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \
 cfmakeraw cfsetspeed isnan copysign
 do :
@@ -14161,8 +14161,6 @@
 esac
 
 
-PRE_EDIT_LDFLAGS=
-POST_EDIT_LDFLAGS=
 if test "x$ORDINARY_LINK" = "xyes"; then
 
   LINKER="\$(CC)"
@@ -14183,17 +14181,7 @@
   ## searching for libraries in its internal directories, so we have to
   ## ask GCC explicitly where to find libgcc.a (LIB_GCC below).
   LINKER="\$(CC) -nostdlib"
-  ## GCC passes any argument prefixed with -Xlinker directly to the linker.
-  ## See prefix-args.c for an explanation of why we do not do this with the
-  ## shell''s ``for'' construct.  Note that sane people do not have '.' in
-  ## their paths, so we must use ./prefix-args.
-  ## TODO either make prefix-args check ORDINARY_LINK internally,
-  ## or remove it altogether (bug#6184), removing the need for this hack.
-  PRE_EDIT_LDFLAGS='`./prefix-args -Xlinker'
-  POST_EDIT_LDFLAGS='`'
-fi
-
-
+fi
 
 test "x$LINKER" = "x" && LINKER=ld
 ## FIXME? What setting of EDIT_LDFLAGS should this have?
--- a/configure.in	Wed Jul 07 12:15:48 2010 +0000
+++ b/configure.in	Thu Jul 08 11:50:25 2010 +0000
@@ -890,6 +890,8 @@
 
 UNEXEC_OBJ=unexelf.o
 case "$opsys" in
+  # MSDOS uses unexec.o
+  # MSWindows uses unexw32.o
   aix4-2)
    UNEXEC_OBJ=unexaix.o
    ;;
@@ -2615,12 +2617,12 @@
 
 AC_CHECK_FUNCS(gethostname getdomainname dup2 \
 rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
-random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime setsid \
+random lrand48 logb frexp fmod rint cbrt ftime setsid \
 strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
 utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \
 __fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
 sendto recvfrom getsockopt setsockopt getsockname getpeername \
-gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \
+gai_strerror mkstemp getline getdelim mremap memmove fsync sync \
 memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \
 cfmakeraw cfsetspeed isnan copysign)
 
@@ -3358,8 +3360,6 @@
 esac
 
 
-PRE_EDIT_LDFLAGS=
-POST_EDIT_LDFLAGS=
 if test "x$ORDINARY_LINK" = "xyes"; then
 
   LINKER="\$(CC)"
@@ -3378,17 +3378,7 @@
   ## searching for libraries in its internal directories, so we have to
   ## ask GCC explicitly where to find libgcc.a (LIB_GCC below).
   LINKER="\$(CC) -nostdlib"
-  ## GCC passes any argument prefixed with -Xlinker directly to the linker.
-  ## See prefix-args.c for an explanation of why we do not do this with the
-  ## shell''s ``for'' construct.  Note that sane people do not have '.' in
-  ## their paths, so we must use ./prefix-args.
-  ## TODO either make prefix-args check ORDINARY_LINK internally,
-  ## or remove it altogether (bug#6184), removing the need for this hack.
-  PRE_EDIT_LDFLAGS='`./prefix-args -Xlinker'
-  POST_EDIT_LDFLAGS='`'
 fi
-AC_SUBST(PRE_EDIT_LDFLAGS)
-AC_SUBST(POST_EDIT_LDFLAGS)
 
 test "x$LINKER" = "x" && LINKER=ld
 ## FIXME? What setting of EDIT_LDFLAGS should this have?
@@ -3574,10 +3564,6 @@
 #include <string.h>
 #endif
 
-#ifdef HAVE_STRINGS_H
-#include <strings.h>  /* May be needed for bcopy & al.  */
-#endif
-
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
@@ -3619,16 +3605,6 @@
 #  endif
 #endif
 
-#ifndef HAVE_BCOPY
-#define bcopy(a,b,s) memcpy (b,a,s)
-#endif
-#ifndef HAVE_BZERO
-#define bzero(a,s) memset (a,0,s)
-#endif
-#ifndef HAVE_BCMP
-#define BCMP memcmp
-#endif
-
 #endif /* EMACS_CONFIG_H */
 
 /*
--- a/lib-src/ChangeLog	Wed Jul 07 12:15:48 2010 +0000
+++ b/lib-src/ChangeLog	Thu Jul 08 11:50:25 2010 +0000
@@ -1,3 +1,15 @@
+2010-07-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* update-game-score.c (P_): Remove macro.
+	* ebrowse.c: Remove include guards.
+	(P_): Remove macro.
+
+2010-07-07  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
+	memcpy, memmove, memset.
+	* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
+
 2010-07-06  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* movemail.c: Add MAIL_USE_POP around prototypes.
--- a/lib-src/ebrowse.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/lib-src/ebrowse.c	Thu Jul 08 11:50:25 2010 +0000
@@ -20,20 +20,14 @@
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
-
 #include <stdio.h>
 
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
 
-#ifdef HAVE_STRING_H
 #include <string.h>
-#endif
-
 #include <ctype.h>
 #include <assert.h>
 #include "getopt.h"
@@ -45,12 +39,6 @@
 
 /* Conditionalize function prototypes.  */
 
-#ifdef PROTOTYPES		/* From config.h.  */
-#define P_(x) x
-#else
-#define P_(x) ()
-#endif
-
 /* Value is non-zero if strings X and Y compare equal.  */
 
 #define streq(X, Y) (*(X) == *(Y) && strcmp ((X) + 1, (Y) + 1) == 0)
@@ -647,7 +635,7 @@
 	}
 
       sym = (struct sym *) xmalloc (sizeof *sym + strlen (name));
-      bzero (sym, sizeof *sym);
+      memset (sym, 0, sizeof *sym);
       strcpy (sym->name, name);
       sym->namesp = scope;
       sym->next = class_table[h];
@@ -1042,7 +1030,7 @@
 make_namespace (char *name, struct sym *context)
 {
   struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name));
-  bzero (s, sizeof *s);
+  memset (s, 0, sizeof *s);
   strcpy (s->name, name);
   s->next = all_namespaces;
   s->namesp = context;
--- a/lib-src/pop.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/lib-src/pop.c	Thu Jul 08 11:50:25 2010 +0000
@@ -612,7 +612,7 @@
 	    }
 	  ptr[cp++] = '>';
 	}
-      bcopy (fromserver, &ptr[cp], ret);
+      memcpy (&ptr[cp], fromserver, ret);
       cp += ret;
       ptr[cp++] = '\n';
     }
@@ -1020,7 +1020,7 @@
   }
 #endif
 
-  bzero ((char *) &addr, sizeof (addr));
+  memset (&addr, 0, sizeof (addr));
   addr.sin_family = AF_INET;
 
   /** "kpop" service is  never used: look for 20060515 to see why **/
@@ -1096,8 +1096,7 @@
           if (it->ai_addrlen == sizeof (addr))
             {
               struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr;
-              bcopy (&in_a->sin_addr, (char *) &addr.sin_addr,
-                     sizeof (addr.sin_addr));
+              memcpy (&addr.sin_addr, &in_a->sin_addr, sizeof (addr.sin_addr));
               if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr)))
                 break;
             }
@@ -1125,8 +1124,7 @@
 
   while (*hostent->h_addr_list)
     {
-      bcopy (*hostent->h_addr_list, (char *) &addr.sin_addr,
-	     hostent->h_length);
+      memcpy (&addr.sin_addr, *hostent->h_addr_list, hostent->h_length);
       if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr)))
 	break;
       hostent->h_addr_list++;
@@ -1318,8 +1316,8 @@
 	}
       else
 	{
-	  bcopy (server->buffer + server->buffer_index,
-		 server->buffer, server->data);
+	  memmove (server->buffer, server->buffer + server->buffer_index,
+		   server->data);
 	  /* Record the fact that we've searched the data already in
              the buffer for a CRLF, so that when we search below, we
              don't have to search the same data twice.  There's a "-
--- a/lib-src/update-game-score.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/lib-src/update-game-score.c	Thu Jul 08 11:50:25 2010 +0000
@@ -64,13 +64,6 @@
 #define MAX_SCORES 200
 #define MAX_DATA_LEN 1024
 
-/* Declare the prototype for a general external function.  */
-#if defined (PROTOTYPES) || defined (WINDOWSNT)
-#define P_(proto) proto
-#else
-#define P_(proto) ()
-#endif
-
 #ifndef HAVE_DIFFTIME
 /* OK on POSIX (time_t is arithmetic type) modulo overflow in subtraction.  */
 #define difftime(t1, t0) (double)((t1) - (t0))
--- a/lisp/ChangeLog	Wed Jul 07 12:15:48 2010 +0000
+++ b/lisp/ChangeLog	Thu Jul 08 11:50:25 2010 +0000
@@ -1,3 +1,10 @@
+2010-07-08  Daiki Ueno  <ueno@unixuser.org>
+
+	* epa-file.el (epa-file-error, epa-file--find-file-not-found-function)
+	(epa-file-insert-file-contents): Hack to prevent
+	find-file from opening empty buffer when decryptin failed
+	(bug#6568).
+
 2010-07-07  Agustín Martín  <agustin.martin@hispalinux.es>
 
 	* ispell.el (ispell-alternate-dictionary): Use file-readable-p.
--- a/lisp/epa-file.el	Wed Jul 07 12:15:48 2010 +0000
+++ b/lisp/epa-file.el	Thu Jul 08 11:50:25 2010 +0000
@@ -101,6 +101,14 @@
     (insert (epa-file--decode-coding-string string (or coding-system-for-read
 						       'undecided)))))
 
+(defvar epa-file-error nil)
+(defun epa-file--find-file-not-found-function ()
+  (let ((error epa-file-error))
+    (save-window-excursion
+      (kill-buffer))
+    (signal 'file-error
+	    (cons "Opening input file" (cdr error)))))
+
 (defvar last-coding-system-used)
 (defun epa-file-insert-file-contents (file &optional visit beg end replace)
   (barf-if-buffer-read-only)
@@ -131,6 +139,15 @@
 	    (error
 	     (if (setq entry (assoc file epa-file-passphrase-alist))
 		 (setcdr entry nil))
+	     ;; Hack to prevent find-file from opening empty buffer
+	     ;; when decryption failed (bug#6568).  See the place
+	     ;; where `find-file-not-found-functions' are called in
+	     ;; `find-file-noselect-1'.
+	     (make-local-variable 'epa-file-error)
+	     (setq epa-file-error error)
+	     (add-hook 'find-file-not-found-functions
+		       'epa-file--find-file-not-found-function
+		       nil t)
 	     (signal 'file-error
 		     (cons "Opening input file" (cdr error)))))
 	  (make-local-variable 'epa-file-encrypt-to)
--- a/lwlib/ChangeLog	Wed Jul 07 12:15:48 2010 +0000
+++ b/lwlib/ChangeLog	Thu Jul 08 11:50:25 2010 +0000
@@ -1,3 +1,74 @@
+2010-07-08  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xlwmenu.c (size_menu_item): Change from K&R to prototype.
+	Change label_width and height to int.
+	(draw_arrow, draw_shadow_rectangle, draw_shadow_rhombus)
+	(draw_separator, display_menu, fit_to_screen, motion_event_is_in_menu)
+	(map_event_to_widget_value): Reformat.
+	(display_menu_item): Change from K&R to prototype.
+
+	* lwlib.c (allocate_widget_info, lw_register_widget): Change from K&R
+	to prototype.
+	(lw_internal_update_other_instances, merge_widget_value): Reformat.
+
+	* lwlib-int.h (widget_creation_function): Fix prototype.
+
+	* lwlib-Xm.c (x_print_complete_resource_name)
+	(make_destroyed_instance, free_destroyed_instance, first_child)
+	(lw_motif_widget_p, resource_motif_string, destroy_all_children)
+	(xm_arm_callback, xm_update_label, xm_update_list)
+	(xm_update_pushbutton, xm_update_cascadebutton)
+	(xm_update_toggle, xm_update_radiobox, make_menu_in_widget)
+	(update_one_menu_entry, xm_update_menu, xm_update_text)
+	(xm_update_text_field, xm_update_one_widget)
+	(xm_update_one_value, activate_button, dialog_key_cb)
+	(make_dialog, mark_dead_instance_destroyed)
+	(find_matching_instance, recenter_widget, recycle_instance)
+	(xm_create_dialog, make_menubar, remove_grabs, make_popup_menu)
+	(make_main, xm_destroy_instance, xm_popup_menu)
+	(set_min_dialog_size, xm_pop_instance, do_call)
+	(xm_internal_update_other_instances, xm_generic_callback)
+	(xm_nosel_callback, xm_pull_down_callback, xm_pop_down_callback)
+	(xm_set_keyboard_focus, xm_set_main_areas, xm_manage_resizing): Change
+	from K&R to prototype.
+
+	* lwlib-Xlw.c (x_print_complete_resource_name): Change from K&R to
+	prototype.
+	(xlw_update_one_value): Reformat.
+
+	* lwlib-Xaw.c (xaw_generic_callback, command_reset)
+	(xaw_update_one_value): Reformat.
+	(xaw_update_one_widget): Reformat and remove dead code.
+	(xaw_scrollbar_scroll, xaw_scrollbar_jump, xaw_create_scrollbar)
+	(xaw_update_scrollbar): Remove (not used).
+	(make_dialog): Change from K&R to prototype. Remove dead code.
+	(xaw_creation_table): Remove scrollbar entry.
+
+2010-07-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* lwlib.c (allocate_widget_instance, get_widget_info)
+	(get_widget_instance, find_instance, set_one_value)
+	(update_one_widget_instance, update_all_widget_values)
+	(lw_modify_all_widgets, lw_get_widget, lw_make_widget)
+	(lw_create_widget, lw_pop_all_widgets, lw_show_busy)
+	(lw_refigure_widget, lw_allow_resizing): Remove alternative K&R
+	declarations.
+	* lwlib-Xlw.c (xlw_update_one_widget):
+	(xlw_pop_instance): Likewise.
+	* lwlib-Xaw.c (xaw_update_one_widget, xaw_pop_instance):
+	Likewise.
+	* lwlib-Xm.c (P_): Remove.
+
+2010-07-07  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
+	(malloc_widget_value, free_widget_info, allocate_widget_instance)
+	(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
+	memset, memcpy, memcmp.
+	* lwlib-utils.c (XtApplyToWidgets): Likewise.
+	* xlwmenu.c (XlwMenuInitialize): Likewise.
+	* lwlib.h (lwlib_bcopy): Remove declaration.
+
 2010-07-05  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* xlwmenu.c (XlwMenuSetValues, XlwMenuInitialize): Correct prototype.
--- a/lwlib/lwlib-Xaw.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/lwlib/lwlib-Xaw.c	Thu Jul 08 11:50:25 2010 +0000
@@ -71,7 +71,9 @@
 
 #endif
 
-static void xaw_generic_callback (Widget widget, XtPointer closure, XtPointer call_data);
+static void xaw_generic_callback (Widget widget,
+                                  XtPointer closure,
+                                  XtPointer call_data);
 
 
 Boolean
@@ -81,70 +83,6 @@
 	  XtIsSubclass (widget, dialogWidgetClass));
 }
 
-#if 0
-static void
-xaw_update_scrollbar (instance, widget, val)
-     widget_instance *instance;
-     Widget widget;
-     widget_value *val;
-{
-  if (val->scrollbar_data)
-    {
-      scrollbar_values *data = val->scrollbar_data;
-      Dimension height, width;
-      Dimension pos_x, pos_y;
-      int widget_shown, widget_topOfThumb;
-      float new_shown, new_topOfThumb;
-
-      XtVaGetValues (widget,
-		     XtNheight, &height,
-		     XtNwidth, &width,
-		     XtNx, &pos_x,
-		     XtNy, &pos_y,
-		     XtNtopOfThumb, &widget_topOfThumb,
-		     XtNshown, &widget_shown,
-		     NULL);
-
-      /*
-       * First size and position the scrollbar widget.
-       * We need to position it to second-guess the Paned widget's notion
-       * of what should happen when the WMShell gets resized.
-       */
-      if (height != data->scrollbar_height || pos_y != data->scrollbar_pos)
-	{
-	  XtConfigureWidget (widget, pos_x, data->scrollbar_pos,
-			     width, data->scrollbar_height, 0);
-
-	  XtVaSetValues (widget,
-			 XtNlength, data->scrollbar_height,
-			 XtNthickness, width,
-			 NULL);
-	}
-
-      /*
-       * Now the size the scrollbar's slider.
-       */
-      new_shown = (float) data->slider_size /
-	(float) (data->maximum - data->minimum);
-
-      new_topOfThumb = (float) (data->slider_position - data->minimum) /
-	(float) (data->maximum - data->minimum);
-
-      if (new_shown > 1.0)
-	new_shown = 1.0;
-      if (new_shown < 0)
-	new_shown = 0;
-
-      if (new_topOfThumb > 1.0)
-	new_topOfThumb = 1.0;
-      if (new_topOfThumb < 0)
-	new_topOfThumb = 0;
-
-      if (new_shown != widget_shown || new_topOfThumb != widget_topOfThumb)
-	XawScrollbarSetThumb (widget, new_topOfThumb, new_shown);
-    }
-}
-#endif
 
 #ifdef HAVE_XFT
 static void
@@ -325,9 +263,9 @@
 
 static void
 command_reset (Widget widget,
-                 XEvent* event,
-                 String *params,
-                 Cardinal *num_params)
+               XEvent* event,
+               String *params,
+               Cardinal *num_params)
 {
   struct widget_xft_data *data = find_xft_data (widget);
   if (data) 
@@ -348,23 +286,11 @@
 #endif
 
 void
-#ifdef PROTOTYPES
-xaw_update_one_widget (widget_instance *instance, Widget widget,
-		       widget_value *val, Boolean deep_p)
-#else
-xaw_update_one_widget (instance, widget, val, deep_p)
-     widget_instance *instance;
-     Widget widget;
-     widget_value *val;
-     Boolean deep_p;
-#endif
+xaw_update_one_widget (widget_instance *instance,
+                       Widget widget,
+		       widget_value *val,
+                       Boolean deep_p)
 {
-#if 0
-  if (XtIsSubclass (widget, scrollbarWidgetClass))
-    {
-      xaw_update_scrollbar (instance, widget, val);
-    }
-#endif
   if (XtIsSubclass (widget, dialogWidgetClass))
     {
 
@@ -427,7 +353,9 @@
 }
 
 void
-xaw_update_one_value (widget_instance *instance, Widget widget, widget_value *val)
+xaw_update_one_value (widget_instance *instance,
+                      Widget widget,
+                      widget_value *val)
 {
   /* This function is not used by the scrollbars and those are the only
      Athena widget implemented at the moment so do nothing. */
@@ -474,13 +402,7 @@
 }
 
 void
-#ifdef PROTOTYPES
 xaw_pop_instance (widget_instance *instance, Boolean up)
-#else
-xaw_pop_instance (instance, up)
-     widget_instance *instance;
-     Boolean up;
-#endif
 {
   Widget widget = instance->widget;
 
@@ -573,19 +495,17 @@
 #endif
 
 static Widget
-make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot,
-             radio_box, list, left_buttons, right_buttons, instance)
-     char* name;
-     Widget parent;
-     Boolean pop_up_p;
-     char* shell_title;
-     char* icon_name;
-     Boolean text_input_slot;
-     Boolean radio_box;
-     Boolean list;
-     int left_buttons;
-     int right_buttons;
-     widget_instance *instance;
+make_dialog (char* name,
+             Widget parent,
+             Boolean pop_up_p,
+             char* shell_title,
+             char* icon_name,
+             Boolean text_input_slot,
+             Boolean radio_box,
+             Boolean list,
+             int left_buttons,
+             int right_buttons,
+             widget_instance *instance)
 {
   Arg av [20];
   int ac = 0;
@@ -829,10 +749,6 @@
 
   id = instance->info->id;
 
-#if 0
-  user_data = NULL;
-  XtVaGetValues (widget, XtNuserData, &user_data, NULL);
-#else
   /* Damn!  Athena doesn't give us a way to hang our own data on the
      buttons, so we have to go find it...  I guess this assumes that
      all instances of a button have the same call data. */
@@ -848,7 +764,6 @@
     if (! val) abort ();
     user_data = val->call_data;
   }
-#endif
 
   if (instance->info->selection_cb)
     instance->info->selection_cb (widget, id, user_data);
@@ -899,106 +814,6 @@
 }
 
 
-/* Scrollbars */
-
-#if 0
-static void
-xaw_scrollbar_scroll (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
-{
-  widget_instance *instance = (widget_instance *) closure;
-  LWLIB_ID id;
-  scroll_event event_data;
-
-  if (!instance || widget->core.being_destroyed)
-    return;
-
-  id = instance->info->id;
-  event_data.slider_value = 0;
-  event_data.time = 0;
-
-  if ((int) call_data > 0)
-    event_data.action = SCROLLBAR_PAGE_DOWN;
-  else
-    event_data.action = SCROLLBAR_PAGE_UP;
-
-  if (instance->info->pre_activate_cb)
-    instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
-}
-#endif
-
-#if 0
-static void
-xaw_scrollbar_jump (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
-{
-  widget_instance *instance = (widget_instance *) closure;
-  LWLIB_ID id;
-  scroll_event event_data;
-  scrollbar_values *val =
-    (scrollbar_values *) instance->info->val->scrollbar_data;
-  float percent;
-
-  if (!instance || widget->core.being_destroyed)
-    return;
-
-  id = instance->info->id;
-
-  percent = * (float *) call_data;
-  event_data.slider_value =
-    (int) (percent * (float) (val->maximum - val->minimum)) + val->minimum;
-
-  event_data.time = 0;
-  event_data.action = SCROLLBAR_DRAG;
-
-  if (instance->info->pre_activate_cb)
-    instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
-}
-#endif
-
-static Widget
-xaw_create_scrollbar (widget_instance *instance)
-{
-#if 0
-  Arg av[20];
-  int ac = 0;
-  Dimension width;
-  Widget scrollbar;
-
-  XtVaGetValues (instance->parent, XtNwidth, &width, NULL);
-
-  XtSetArg (av[ac], XtNshowGrip, 0); ac++;
-  XtSetArg (av[ac], XtNresizeToPreferred, 1); ac++;
-  XtSetArg (av[ac], XtNallowResize, True); ac++;
-  XtSetArg (av[ac], XtNskipAdjust, True); ac++;
-  XtSetArg (av[ac], XtNwidth, width); ac++;
-  XtSetArg (av[ac], XtNmappedWhenManaged, True); ac++;
-
-  scrollbar =
-    XtCreateWidget (instance->info->name, scrollbarWidgetClass,
-		    instance->parent, av, ac);
-
-  /* We have to force the border width to be 0 otherwise the
-     geometry manager likes to start looping for awhile... */
-  XtVaSetValues (scrollbar, XtNborderWidth, 0, NULL);
-
-  XtRemoveAllCallbacks (scrollbar, "jumpProc");
-  XtRemoveAllCallbacks (scrollbar, "scrollProc");
-
-  XtAddCallback (scrollbar, "jumpProc", xaw_scrollbar_jump,
-		 (XtPointer) instance);
-  XtAddCallback (scrollbar, "scrollProc", xaw_scrollbar_scroll,
-		 (XtPointer) instance);
-
-  return scrollbar;
-#else
-  return NULL;
-#endif
-}
 
 static Widget
 xaw_create_main (widget_instance *instance)
@@ -1016,7 +831,6 @@
 widget_creation_entry
 xaw_creation_table [] =
 {
-  {"scrollbar",			xaw_create_scrollbar},
   {"main",			xaw_create_main},
   {NULL, NULL}
 };
--- a/lwlib/lwlib-Xlw.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/lwlib/lwlib-Xlw.c	Thu Jul 08 11:50:25 2010 +0000
@@ -43,8 +43,7 @@
    This is sometimes handy to have available.  */
 
 void
-x_print_complete_resource_name (widget)
-     Widget widget;
+x_print_complete_resource_name (Widget widget)
 {
   int i;
   String names[100];
@@ -210,16 +209,8 @@
 }
 
 void
-#ifdef PROTOTYPES
 xlw_update_one_widget (widget_instance* instance, Widget widget,
 		       widget_value* val, Boolean deep_p)
-#else
-xlw_update_one_widget (instance, widget, val, deep_p)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
-     Boolean deep_p;
-#endif
 {
   Arg al[1];
 
@@ -231,19 +222,15 @@
 }
 
 void
-xlw_update_one_value (widget_instance *instance, Widget widget, widget_value *val)
+xlw_update_one_value (widget_instance *instance,
+                      Widget widget,
+                      widget_value *val)
 {
   return;
 }
 
 void
-#ifdef PROTOTYPES
 xlw_pop_instance (widget_instance* instance, Boolean up)
-#else
-xlw_pop_instance (instance, up)
-     widget_instance* instance;
-     Boolean up;
-#endif
 {
 }
 
--- a/lwlib/lwlib-Xm.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/lwlib/lwlib-Xm.c	Thu Jul 08 11:50:25 2010 +0000
@@ -65,13 +65,6 @@
 #include <Xm/DialogS.h>
 #include <Xm/Form.h>
 
-#undef P_
-#if defined __STDC__ || defined PROTOTYPES
-#define P_(X) X
-#else
-#define P_(X) ()
-#endif
-
 enum do_call_type { pre_activate, selection, no_selection, post_activate };
 
 
@@ -152,8 +145,7 @@
    This is sometimes handy to have available.  */
 
 void
-x_print_complete_resource_name (widget)
-     Widget widget;
+x_print_complete_resource_name (Widget widget)
 {
   int i;
   String names[100];
@@ -175,12 +167,11 @@
 static destroyed_instance *all_destroyed_instances = NULL;
 
 static destroyed_instance*
-make_destroyed_instance (name, type, widget, parent, pop_up_p)
-     char* name;
-     char* type;
-     Widget widget;
-     Widget parent;
-     Boolean pop_up_p;
+make_destroyed_instance (char* name,
+                         char* type,
+                         Widget widget,
+                         Widget parent,
+                         Boolean pop_up_p)
 {
   destroyed_instance* instance =
     (destroyed_instance*)malloc (sizeof (destroyed_instance));
@@ -194,8 +185,7 @@
 }
 
 static void
-free_destroyed_instance (instance)
-     destroyed_instance* instance;
+free_destroyed_instance (destroyed_instance* instance)
 {
   free (instance->name);
   free (instance->type);
@@ -204,15 +194,13 @@
 
 /* motif utility functions */
 Widget
-first_child (widget)
-     Widget widget;
+first_child (Widget widget)
 {
   return ((CompositeWidget)widget)->composite.children [0];
 }
 
 Boolean
-lw_motif_widget_p (widget)
-     Widget widget;
+lw_motif_widget_p (Widget widget)
 {
   return
     XtClass (widget) == xmDialogShellWidgetClass
@@ -220,9 +208,8 @@
 }
 
 static XmString
-resource_motif_string (widget, name)
-     Widget widget;
-     char* name;
+resource_motif_string (Widget widget,
+                       char* name)
 {
   XtResource resource;
   XmString result = 0;
@@ -244,9 +231,8 @@
    starting with number FIRST_CHILD_TO_DESTROY.  */
 
 static void
-destroy_all_children (widget, first_child_to_destroy)
-     Widget widget;
-     int first_child_to_destroy;
+destroy_all_children (Widget widget,
+                      int first_child_to_destroy)
 {
   Widget* children;
   unsigned int number;
@@ -292,9 +278,7 @@
    is called.  */
 
 static void
-xm_arm_callback (w, client_data, call_data)
-     Widget w;
-     XtPointer client_data, call_data;
+xm_arm_callback (Widget w, XtPointer client_data, XtPointer call_data)
 {
   XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct *) call_data;
   widget_value *wv = (widget_value *) client_data;
@@ -346,10 +330,9 @@
    not null, and contains the label string to display.  */
 
 static void
-xm_update_label (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_label (widget_instance* instance,
+                 Widget widget,
+                 widget_value* val)
 {
   XmString res_string = 0;
   XmString built_string = 0;
@@ -397,10 +380,9 @@
 
 /* update of list */
 static void
-xm_update_list (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_list (widget_instance* instance,
+                Widget widget,
+                widget_value* val)
 {
   widget_value* cur;
   int i;
@@ -421,10 +403,9 @@
 
 /* update of buttons */
 static void
-xm_update_pushbutton (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_pushbutton (widget_instance* instance,
+                      Widget widget,
+                      widget_value* val)
 {
   XtVaSetValues (widget, XmNalignment, XmALIGNMENT_CENTER, NULL);
   XtRemoveAllCallbacks (widget, XmNactivateCallback);
@@ -432,10 +413,9 @@
 }
 
 static void
-xm_update_cascadebutton (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_cascadebutton (widget_instance* instance,
+                         Widget widget,
+                         widget_value* val)
 {
   /* Should also rebuild the menu by calling ...update_menu... */
   XtRemoveAllCallbacks (widget, XmNcascadingCallback);
@@ -445,10 +425,9 @@
 
 /* update toggle and radiobox */
 static void
-xm_update_toggle (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_toggle (widget_instance* instance,
+                  Widget widget,
+                  widget_value* val)
 {
   XtRemoveAllCallbacks (widget, XmNvalueChangedCallback);
   XtAddCallback (widget, XmNvalueChangedCallback,
@@ -458,10 +437,9 @@
 }
 
 static void
-xm_update_radiobox (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_radiobox (widget_instance* instance,
+                    Widget widget,
+                    widget_value* val)
 
 {
   Widget toggle;
@@ -505,11 +483,10 @@
 /* KEEP_FIRST_CHILDREN gives the number of initial children to keep.  */
 
 static void
-make_menu_in_widget (instance, widget, val, keep_first_children)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
-     int keep_first_children;
+make_menu_in_widget (widget_instance* instance,
+                     Widget widget,
+                     widget_value* val,
+                     int keep_first_children)
 {
   Widget* children = 0;
   int num_children;
@@ -662,11 +639,10 @@
 }
 
 static void
-update_one_menu_entry (instance, widget, val, deep_p)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
-     Boolean deep_p;
+update_one_menu_entry (widget_instance* instance,
+                       Widget widget,
+                       widget_value* val,
+                       Boolean deep_p)
 {
   Arg al [256];
   int ac;
@@ -764,11 +740,10 @@
 }
 
 static void
-xm_update_menu (instance, widget, val, deep_p)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
-     Boolean deep_p;
+xm_update_menu (widget_instance* instance,
+                Widget widget,
+                widget_value* val,
+                Boolean deep_p)
 {
   Widget* children;
   unsigned int num_children;
@@ -839,10 +814,9 @@
 /* update text widgets */
 
 static void
-xm_update_text (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_text (widget_instance* instance,
+                Widget widget,
+                widget_value* val)
 {
   XmTextSetString (widget, val->value ? val->value : "");
   XtRemoveAllCallbacks (widget, XmNactivateCallback);
@@ -853,10 +827,9 @@
 }
 
 static void
-xm_update_text_field (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_text_field (widget_instance* instance,
+                      Widget widget,
+                      widget_value* val)
 {
   XmTextFieldSetString (widget, val->value ? val->value : "");
   XtRemoveAllCallbacks (widget, XmNactivateCallback);
@@ -870,11 +843,10 @@
 /* update a motif widget */
 
 void
-xm_update_one_widget (instance, widget, val, deep_p)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
-     Boolean deep_p;
+xm_update_one_widget (widget_instance* instance,
+                      Widget widget,
+                      widget_value* val,
+                      Boolean deep_p)
 {
   WidgetClass class;
 
@@ -935,10 +907,9 @@
 
 /* getting the value back */
 void
-xm_update_one_value (instance, widget, val)
-     widget_instance* instance;
-     Widget widget;
-     widget_value* val;
+xm_update_one_value (widget_instance* instance,
+                     Widget widget,
+                     widget_value* val)
 {
   WidgetClass class = XtClass (widget);
   widget_value *old_wv;
@@ -1031,10 +1002,9 @@
    I could not find a way to do that with accelerators.
  */
 static void
-activate_button (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+activate_button (Widget widget,
+                 XtPointer closure,
+                 XtPointer call_data)
 {
   Widget button = (Widget)closure;
   XtCallCallbacks (button, XmNactivateCallback, NULL);
@@ -1044,11 +1014,10 @@
 
 /* Called for key press in dialogs.  Used to pop down dialog on ESC.  */
 static void
-dialog_key_cb (widget, closure, event, continue_to_dispatch)
-     Widget widget;
-     XtPointer closure;
-     XEvent *event;
-     Boolean *continue_to_dispatch;
+dialog_key_cb (Widget widget,
+               XtPointer closure,
+               XEvent *event,
+               Boolean *continue_to_dispatch)
 {
   KeySym sym = 0;
   Modifiers modif_ret;
@@ -1071,18 +1040,16 @@
 
 /* dialogs */
 static Widget
-make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot,
-	     radio_box, list, left_buttons, right_buttons)
-     char* name;
-     Widget parent;
-     Boolean pop_up_p;
-     char* shell_title;
-     char* icon_name;
-     Boolean text_input_slot;
-     Boolean radio_box;
-     Boolean list;
-     int left_buttons;
-     int right_buttons;
+make_dialog (char* name,
+             Widget parent,
+             Boolean pop_up_p,
+             char* shell_title,
+             char* icon_name,
+             Boolean text_input_slot,
+             Boolean radio_box,
+             Boolean list,
+             int left_buttons,
+             int right_buttons)
 {
   Widget result;
   Widget form;
@@ -1335,8 +1302,7 @@
 }
 
 static destroyed_instance*
-find_matching_instance (instance)
-     widget_instance* instance;
+find_matching_instance (widget_instance* instance)
 {
   destroyed_instance*	cur;
   destroyed_instance*	prev;
@@ -1373,18 +1339,16 @@
 }
 
 static void
-mark_dead_instance_destroyed (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+mark_dead_instance_destroyed (Widget widget,
+                              XtPointer closure,
+                              XtPointer call_data)
 {
   destroyed_instance* instance = (destroyed_instance*)closure;
   instance->widget = NULL;
 }
 
 static void
-recenter_widget (widget)
-     Widget widget;
+recenter_widget (Widget widget)
 {
   Widget parent = XtParent (widget);
   Screen* screen = XtScreen (widget);
@@ -1420,8 +1384,7 @@
 }
 
 static Widget
-recycle_instance (instance)
-     destroyed_instance* instance;
+recycle_instance (destroyed_instance* instance)
 {
   Widget widget = instance->widget;
 
@@ -1457,8 +1420,7 @@
 }
 
 Widget
-xm_create_dialog (instance)
-     widget_instance* instance;
+xm_create_dialog (widget_instance* instance)
 {
   char* 	name = instance->info->type;
   Widget 	parent = instance->parent;
@@ -1538,8 +1500,7 @@
    because we have not yet managed to make it work right in Motif.  */
 
 static Widget
-make_menubar (instance)
-     widget_instance* instance;
+make_menubar (widget_instance* instance)
 {
   Arg al[3];
   int ac;
@@ -1550,18 +1511,16 @@
 }
 
 static void
-remove_grabs (shell, closure, call_data)
-     Widget shell;
-     XtPointer closure;
-     XtPointer call_data;
+remove_grabs (Widget shell,
+              XtPointer closure,
+              XtPointer call_data)
 {
   Widget menu = (Widget) closure;
   XmRemoveFromPostFromList (menu, XtParent (XtParent (menu)));
 }
 
 static Widget
-make_popup_menu (instance)
-     widget_instance* instance;
+make_popup_menu (widget_instance* instance)
 {
   Widget parent = instance->parent;
   Window parent_window = parent->core.window;
@@ -1577,8 +1536,7 @@
 }
 
 static Widget
-make_main (instance)
-     widget_instance* instance;
+make_main (widget_instance* instance)
 {
   Widget parent = instance->parent;
   Widget result;
@@ -1717,8 +1675,7 @@
 
 /* Destruction of instances */
 void
-xm_destroy_instance (instance)
-     widget_instance* instance;
+xm_destroy_instance ( widget_instance* instance)
 {
   Widget widget = instance->widget;
   /* recycle the dialog boxes */
@@ -1752,9 +1709,7 @@
 
 /* popup utility */
 void
-xm_popup_menu (widget, event)
-     Widget widget;
-     XEvent *event;
+xm_popup_menu (Widget widget, XEvent *event)
 {
   XButtonPressedEvent dummy;
 
@@ -1802,8 +1757,7 @@
 }
 
 static void
-set_min_dialog_size (w)
-     Widget w;
+set_min_dialog_size (Widget w)
 {
   short width;
   short height;
@@ -1812,9 +1766,7 @@
 }
 
 void
-xm_pop_instance (instance, up)
-     widget_instance* instance;
-     Boolean up;
+xm_pop_instance (widget_instance* instance, Boolean up)
 {
   Widget widget = instance->widget;
 
@@ -1843,10 +1795,9 @@
 /* motif callback */
 
 static void
-do_call (widget, closure, type)
-     Widget widget;
-     XtPointer closure;
-     enum do_call_type type;
+do_call (Widget widget,
+         XtPointer closure,
+         enum do_call_type type)
 {
   Arg al [256];
   int ac;
@@ -1903,10 +1854,9 @@
    if the widget was ``destroyed'' by caching it in the all_destroyed_instances
    list */
 static void
-xm_internal_update_other_instances (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+xm_internal_update_other_instances (Widget widget,
+                                    XtPointer closure,
+                                    XtPointer call_data)
 {
   Widget parent;
   for (parent = widget; parent; parent = XtParent (parent))
@@ -1918,20 +1868,18 @@
 }
 
 static void
-xm_generic_callback (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+xm_generic_callback (Widget widget,
+                     XtPointer closure,
+                     XtPointer call_data)
 {
   lw_internal_update_other_instances (widget, closure, call_data);
   do_call (widget, closure, selection);
 }
 
 static void
-xm_nosel_callback (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+xm_nosel_callback (Widget widget,
+                   XtPointer closure,
+                   XtPointer call_data)
 {
   /* This callback is only called when a dialog box is dismissed with
      the wm's destroy button (WM_DELETE_WINDOW.)  We want the dialog
@@ -1946,10 +1894,9 @@
 }
 
 static void
-xm_pull_down_callback (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+xm_pull_down_callback (Widget widget,
+                       XtPointer closure,
+                       XtPointer call_data)
 {
   Widget parent = XtParent (widget);
 
@@ -1970,10 +1917,9 @@
    menu, whether or not its submenu is visible.  */
 
 static void
-xm_pop_down_callback (widget, closure, call_data)
-     Widget widget;
-     XtPointer closure;
-     XtPointer call_data;
+xm_pop_down_callback (Widget widget,
+                      XtPointer closure,
+                      XtPointer call_data)
 {
   widget_instance *instance = (widget_instance *) closure;
 
@@ -1985,9 +1931,7 @@
 
 /* set the keyboard focus */
 void
-xm_set_keyboard_focus (parent, w)
-     Widget parent;
-     Widget w;
+xm_set_keyboard_focus (Widget parent, Widget w)
 {
   XmProcessTraversal (w, 0);
   XtSetKeyboardFocus (parent, w);
@@ -1995,10 +1939,9 @@
 
 /* Motif hack to set the main window areas. */
 void
-xm_set_main_areas (parent, menubar, work_area)
-     Widget parent;
-     Widget menubar;
-     Widget work_area;
+xm_set_main_areas (Widget parent,
+                   Widget menubar,
+                   Widget work_area)
 {
   XmMainWindowSetAreas (parent,
 			menubar,	/* menubar (maybe 0) */
@@ -2010,9 +1953,7 @@
 
 /* Motif hack to control resizing on the menubar. */
 void
-xm_manage_resizing (w, flag)
-     Widget w;
-     Boolean flag;
+xm_manage_resizing (Widget w, Boolean flag)
 {
   XtVaSetValues (w, XtNallowShellResize, flag, NULL);
 }
--- a/lwlib/lwlib-int.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/lwlib/lwlib-int.h	Thu Jul 08 11:50:25 2010 +0000
@@ -58,8 +58,7 @@
   struct _widget_info*		next;
 } widget_info;
 
-typedef Widget
-(*widget_creation_function) ();
+typedef Widget (*widget_creation_function) (widget_instance *instance);
 
 typedef struct _widget_creation_entry
 {
--- a/lwlib/lwlib-utils.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/lwlib/lwlib-utils.c	Thu Jul 08 11:50:25 2010 +0000
@@ -77,8 +77,8 @@
       int nkids = cw->composite.num_children;
       Widget *kids = (Widget *) malloc (sizeof (Widget) * nkids);
       int i;
-      lwlib_bcopy ((char *) cw->composite.children, (char *) kids,
-		   sizeof (Widget) * nkids);
+      memcpy ((char *) kids, (char *) cw->composite.children,
+	      sizeof (Widget) * nkids);
       for (i = 0; i < nkids; i++)
 /* This prevent us from using gadgets, why is it here? */
 /*	if (XtIsWidget (kids [i])) */
--- a/lwlib/lwlib.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/lwlib/lwlib.c	Thu Jul 08 11:50:25 2010 +0000
@@ -104,24 +104,6 @@
 static void lw_pop_all_widgets (LWLIB_ID, Boolean);
 static Boolean get_one_value (widget_instance *, widget_value *);
 static void show_one_widget_busy (Widget, Boolean);
-
-void
-lwlib_memset (char *address, int value, size_t length)
-{
-  int i;
-
-  for (i = 0; i < length; i++)
-    address[i] = value;
-}
-
-void
-lwlib_bcopy (char *from, char *to, int length)
-{
-  int i;
-
-  for (i = 0; i < length; i++)
-    to[i] = from[i];
-}
 /* utility functions for widget_instance and widget_info */
 char *
 safe_strdup (const char *s)
@@ -179,7 +161,7 @@
       wv = (widget_value *) malloc (sizeof (widget_value));
       malloc_cpt++;
     }
-  lwlib_memset ((void*) wv, 0, sizeof (widget_value));
+  memset ((void*) wv, 0, sizeof (widget_value));
   return wv;
 }
 
@@ -267,16 +249,14 @@
 }
 
 static widget_info *
-allocate_widget_info (type, name, id, val, pre_activate_cb,
-		      selection_cb, post_activate_cb, highlight_cb)
-     char* type;
-     char* name;
-     LWLIB_ID id;
-     widget_value* val;
-     lw_callback pre_activate_cb;
-     lw_callback selection_cb;
-     lw_callback post_activate_cb;
-     lw_callback highlight_cb;
+allocate_widget_info (char* type,
+                      char* name,
+                      LWLIB_ID id,
+                      widget_value* val,
+                      lw_callback pre_activate_cb,
+                      lw_callback selection_cb,
+                      lw_callback post_activate_cb,
+                      lw_callback highlight_cb)
 {
   widget_info* info = (widget_info*)malloc (sizeof (widget_info));
   info->type = safe_strdup (type);
@@ -302,7 +282,7 @@
   safe_free_str (info->type);
   safe_free_str (info->name);
   free_widget_value_tree (info->val);
-  lwlib_memset ((void*)info, 0xDEADBEEF, sizeof (widget_info));
+  memset ((void*)info, 0xDEADBEEF, sizeof (widget_info));
   free (info);
 }
 
@@ -316,22 +296,12 @@
     instance->widget = NULL;
 }
 
-/* The messy #ifdef PROTOTYPES here and elsewhere are prompted by a
-   flood of warnings about argument promotion from proprietary ISO C
-   compilers.  (etags still only makes one entry for each function.)  */
 static widget_instance *
-#ifdef PROTOTYPES
 allocate_widget_instance (widget_info* info, Widget parent, Boolean pop_up_p)
-#else
-allocate_widget_instance (info, parent, pop_up_p)
-     widget_info* info;
-     Widget parent;
-     Boolean pop_up_p;
-#endif
 {
   widget_instance* instance =
     (widget_instance*)malloc (sizeof (widget_instance));
-  bzero (instance, sizeof *instance);
+  memset (instance, 0, sizeof *instance);
   instance->parent = parent;
   instance->pop_up_p = pop_up_p;
   instance->info = info;
@@ -348,18 +318,12 @@
 static void
 free_widget_instance (widget_instance *instance)
 {
-  lwlib_memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance));
+  memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance));
   free (instance);
 }
 
 static widget_info *
-#ifdef PROTOTYPES
 get_widget_info (LWLIB_ID id, Boolean remove_p)
-#else
-get_widget_info (id, remove_p)
-     LWLIB_ID id;
-     Boolean remove_p;
-#endif
 {
   widget_info* info;
   widget_info* prev;
@@ -389,13 +353,7 @@
 }
 
 static widget_instance *
-#ifdef PROTOTYPES
 get_widget_instance (Widget widget, Boolean remove_p)
-#else
-get_widget_instance (widget, remove_p)
-     Widget widget;
-     Boolean remove_p;
-#endif
 {
   widget_info* info;
   widget_instance* instance;
@@ -428,14 +386,7 @@
 }
 
 static widget_instance*
-#ifdef PROTOTYPES
 find_instance (LWLIB_ID id, Widget parent, Boolean pop_up_p)
-#else
-find_instance (id, parent, pop_up_p)
-     LWLIB_ID id;
-     Widget parent;
-     Boolean pop_up_p;
-#endif
 {
   widget_info* info = get_widget_info (id, False);
   widget_instance* instance;
@@ -478,7 +429,10 @@
 
 
 static widget_value *
-merge_widget_value (widget_value *val1, widget_value *val2, int level, int *change_p)
+merge_widget_value (widget_value *val1,
+                    widget_value *val2,
+                    int level,
+                    int *change_p)
 {
   change_type change, this_one_change;
   widget_value* merged_next;
@@ -656,14 +610,7 @@
 }
 
 static void
-#ifdef PROTOTYPES
 set_one_value (widget_instance* instance, widget_value* val, Boolean deep_p)
-#else
-set_one_value (instance, val, deep_p)
-     widget_instance* instance;
-     widget_value* val;
-     Boolean deep_p;
-#endif
 {
   Widget widget = name_to_widget (instance, val->name);
 
@@ -685,13 +632,7 @@
 }
 
 static void
-#ifdef PROTOTYPES
 update_one_widget_instance (widget_instance* instance, Boolean deep_p)
-#else
-update_one_widget_instance (instance, deep_p)
-     widget_instance* instance;
-     Boolean deep_p;
-#endif
 {
   widget_value *val;
 
@@ -705,13 +646,7 @@
 }
 
 static void
-#ifdef PROTOTYPES
 update_all_widget_values (widget_info* info, Boolean deep_p)
-#else
-update_all_widget_values (info, deep_p)
-     widget_info* info;
-     Boolean deep_p;
-#endif
 {
   widget_instance* instance;
   widget_value* val;
@@ -724,14 +659,7 @@
 }
 
 int
-#ifdef PROTOTYPES
 lw_modify_all_widgets (LWLIB_ID id, widget_value* val, Boolean deep_p)
-#else
-lw_modify_all_widgets (id, val, deep_p)
-     LWLIB_ID id;
-     widget_value* val;
-     Boolean deep_p;
-#endif
 {
   widget_info* info = get_widget_info (id, False);
   widget_value* new_val;
@@ -895,16 +823,14 @@
 }
 
 void
-lw_register_widget (type, name, id, val, pre_activate_cb,
-		    selection_cb, post_activate_cb, highlight_cb)
-     char* type;
-     char* name;
-     LWLIB_ID id;
-     widget_value* val;
-     lw_callback pre_activate_cb;
-     lw_callback selection_cb;
-     lw_callback post_activate_cb;
-     lw_callback highlight_cb;
+lw_register_widget (char* type,
+                    char* name,
+                    LWLIB_ID id,
+                    widget_value* val,
+                    lw_callback pre_activate_cb,
+                    lw_callback selection_cb,
+                    lw_callback post_activate_cb,
+                    lw_callback highlight_cb)
 {
   if (!get_widget_info (id, False))
     allocate_widget_info (type, name, id, val, pre_activate_cb, selection_cb,
@@ -912,14 +838,7 @@
 }
 
 Widget
-#ifdef PROTOTYPES
 lw_get_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p)
-#else
-lw_get_widget (id, parent, pop_up_p)
-     LWLIB_ID id;
-     Widget parent;
-     Boolean pop_up_p;
-#endif
 {
   widget_instance* instance;
 
@@ -928,14 +847,7 @@
 }
 
 Widget
-#ifdef PROTOTYPES
 lw_make_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p)
-#else
-lw_make_widget (id, parent, pop_up_p)
-     LWLIB_ID id;
-     Widget parent;
-     Boolean pop_up_p;
-#endif
 {
   widget_instance* instance;
   widget_info* info;
@@ -955,25 +867,10 @@
 }
 
 Widget
-#ifdef PROTOTYPES
 lw_create_widget (char* type, char* name, LWLIB_ID id, widget_value* val,
 		  Widget parent, Boolean pop_up_p,
 		  lw_callback pre_activate_cb, lw_callback selection_cb,
 		  lw_callback post_activate_cb, lw_callback highlight_cb)
-#else
-lw_create_widget (type, name, id, val, parent, pop_up_p, pre_activate_cb,
-		  selection_cb, post_activate_cb, highlight_cb)
-     char* type;
-     char* name;
-     LWLIB_ID id;
-     widget_value* val;
-     Widget parent;
-     Boolean pop_up_p;
-     lw_callback pre_activate_cb;
-     lw_callback selection_cb;
-     lw_callback post_activate_cb;
-     lw_callback highlight_cb;
-#endif
 {
   lw_register_widget (type, name, id, val, pre_activate_cb, selection_cb,
 		      post_activate_cb, highlight_cb);
@@ -1120,13 +1017,7 @@
 }
 
 static void
-#ifdef PROTOTYPES
 lw_pop_all_widgets (LWLIB_ID id, Boolean up)
-#else
-lw_pop_all_widgets (id, up)
-     LWLIB_ID id;
-     Boolean up;
-#endif
 {
   widget_info* info = get_widget_info (id, False);
   widget_instance* instance;
@@ -1270,7 +1161,9 @@
   modified to update other instances of the widgets.  Closure should be the
   widget_instance. */
 void
-lw_internal_update_other_instances (Widget widget, XtPointer closure, XtPointer call_data)
+lw_internal_update_other_instances (Widget widget,
+                                    XtPointer closure,
+                                    XtPointer call_data)
 {
   widget_instance* instance = (widget_instance*)closure;
   char* name = XtName (widget);
@@ -1327,13 +1220,7 @@
 
 /* Show busy */
 static void
-#ifdef PROTOTYPES
 show_one_widget_busy (Widget w, Boolean flag)
-#else
-show_one_widget_busy (w, flag)
-     Widget w;
-     Boolean flag;
-#endif
 {
   Pixel foreground = 0;
   Pixel background = 1;
@@ -1352,13 +1239,7 @@
 }
 
 void
-#ifdef PROTOTYPES
 lw_show_busy (Widget w, Boolean busy)
-#else
-lw_show_busy (w, busy)
-     Widget w;
-     Boolean busy;
-#endif
 {
   widget_instance* instance = get_widget_instance (w, False);
   widget_info* info;
@@ -1380,13 +1261,7 @@
 /* This hack exists because Lucid/Athena need to execute the strange
    function below to support geometry management. */
 void
-#ifdef PROTOTYPES
 lw_refigure_widget (Widget w, Boolean doit)
-#else
-lw_refigure_widget (w, doit)
-     Widget w;
-     Boolean doit;
-#endif
 {
 #if defined (USE_XAW)
   XawPanedSetRefigureMode (w, doit);
@@ -1428,13 +1303,7 @@
 /* Manage resizing for Motif.  This disables resizing when the menubar
    is about to be modified. */
 void
-#ifdef PROTOTYPES
 lw_allow_resizing (Widget w, Boolean flag)
-#else
-lw_allow_resizing (w, flag)
-     Widget w;
-     Boolean flag;
-#endif
 {
 #if defined (USE_MOTIF)
   xm_manage_resizing (w, flag);
@@ -1453,7 +1322,7 @@
   int separator_p = 0;
 
   if (strlen (label) >= 3
-      && bcmp (label, "--:", 3) == 0)
+      && memcmp (label, "--:", 3) == 0)
     {
       static struct separator_table
       {
@@ -1496,7 +1365,7 @@
 	  }
     }
   else if (strlen (label) > 3
-	   && bcmp (label, "--", 2) == 0
+	   && memcmp (label, "--", 2) == 0
 	   && label[2] != '-')
     {
       /* Alternative, more Emacs-style names.  */
--- a/lwlib/lwlib.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/lwlib/lwlib.h	Thu Jul 08 11:50:25 2010 +0000
@@ -189,8 +189,6 @@
 int lw_separator_p (char *label, enum menu_separator *type,
                     int motif_p);
 
-void lwlib_bcopy (char*, char*, int);
-
 #endif /* LWLIB_H */
 
 /* arch-tag: 44d818d5-7eb2-4d87-acd7-b992bb0d5d20
--- a/lwlib/xlwmenu.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/lwlib/xlwmenu.c	Thu Jul 08 11:50:25 2010 +0000
@@ -187,9 +187,9 @@
 
 static Boolean XlwMenuSetValues(Widget current, Widget request, Widget new,
                                 ArgList args, Cardinal *num_args);
-static void XlwMenuRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes);
+static void XlwMenuRealize(Widget, Mask *, XSetWindowAttributes *);
 static void XlwMenuResize(Widget w);
-static void XlwMenuInitialize(Widget request, Widget mw, ArgList args, Cardinal *num_args);
+static void XlwMenuInitialize(Widget, Widget, ArgList, Cardinal *);
 static void XlwMenuRedisplay(Widget w, XEvent *ev, Region region);
 static void XlwMenuDestroy(Widget w);
 static void XlwMenuClassInitialize(void);
@@ -473,15 +473,13 @@
 
 /* Returns the sizes of an item */
 static void
-size_menu_item (mw, val, horizontal_p, label_width, rest_width, button_width,
-		height)
-     XlwMenuWidget mw;
-     widget_value* val;
-     int horizontal_p;
-     int* label_width;
-     int* rest_width;
-     int* button_width;
-     int* height;
+size_menu_item (XlwMenuWidget mw,
+                widget_value* val,
+                int horizontal_p,
+                int* label_width,
+                int* rest_width,
+                int* button_width,
+                int* height)
 {
   enum menu_separator separator;
 
@@ -525,12 +523,12 @@
 static void
 size_menu (XlwMenuWidget mw, int level)
 {
-  unsigned int  label_width = 0;
+  int           label_width = 0;
   int		rest_width = 0;
   int		button_width = 0;
   int		max_rest_width = 0;
   int		max_button_width = 0;
-  unsigned int  height = 0;
+  int           height = 0;
   int		horizontal_p = mw->menu.horizontal && (level == 0);
   widget_value*	val;
   window_state*	ws;
@@ -589,7 +587,13 @@
 /* Display code */
 
 static void
-draw_arrow (XlwMenuWidget mw, Window window, GC gc, int x, int y, int width, int down_p)
+draw_arrow (XlwMenuWidget mw,
+            Window window,
+            GC gc,
+            int x,
+            int y,
+            int width,
+            int down_p)
 {
   Display *dpy = XtDisplay (mw);
   GC top_gc = mw->menu.shadow_top_gc;
@@ -646,7 +650,14 @@
 
 
 static void
-draw_shadow_rectangle (XlwMenuWidget mw, Window window, int x, int y, int width, int height, int erase_p, int down_p)
+draw_shadow_rectangle (XlwMenuWidget mw,
+                       Window window,
+                       int x,
+                       int y,
+                       int width,
+                       int height,
+                       int erase_p,
+                       int down_p)
 {
   Display *dpy = XtDisplay (mw);
   GC top_gc = !erase_p ? mw->menu.shadow_top_gc : mw->menu.background_gc;
@@ -702,7 +713,14 @@
 
 
 static void
-draw_shadow_rhombus (XlwMenuWidget mw, Window window, int x, int y, int width, int height, int erase_p, int down_p)
+draw_shadow_rhombus (XlwMenuWidget mw,
+                     Window window,
+                     int x,
+                     int y,
+                     int width,
+                     int height,
+                     int erase_p,
+                     int down_p)
 {
   Display *dpy = XtDisplay (mw);
   GC top_gc = !erase_p ? mw->menu.shadow_top_gc : mw->menu.background_gc;
@@ -796,7 +814,12 @@
    separator to draw.  TYPE is the separator type.  */
 
 static void
-draw_separator (XlwMenuWidget mw, Window window, int x, int y, int width, enum menu_separator type)
+draw_separator (XlwMenuWidget mw,
+                Window window,
+                int x,
+                int y,
+                int width,
+                enum menu_separator type)
 {
   Display *dpy = XtDisplay (mw);
   XGCValues xgcv;
@@ -946,15 +969,13 @@
    the menu item was.  */
 
 static void
-display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p,
-		   just_compute_p)
-     XlwMenuWidget mw;
-     widget_value* val;
-     window_state* ws;
-     XPoint* where;
-     Boolean highlighted_p;
-     Boolean horizontal_p;
-     Boolean just_compute_p;
+display_menu_item (XlwMenuWidget mw,
+                   widget_value* val,
+                   window_state* ws,
+                   XPoint* where,
+                   Boolean highlighted_p,
+                   Boolean horizontal_p,
+                   Boolean just_compute_p)
 {
   GC deco_gc;
   GC text_gc;
@@ -1137,7 +1158,12 @@
 }
 
 static void
-display_menu (XlwMenuWidget mw, int level, Boolean just_compute_p, XPoint *highlighted_pos, XPoint *hit, widget_value **hit_return)
+display_menu (XlwMenuWidget mw,
+              int level,
+              Boolean just_compute_p,
+              XPoint *highlighted_pos,
+              XPoint *hit,
+              widget_value **hit_return)
 {
   widget_value*	val;
   widget_value* following_item;
@@ -1345,7 +1371,10 @@
 
 /* Make the window fit in the screen */
 static void
-fit_to_screen (XlwMenuWidget mw, window_state *ws, window_state *previous_ws, Boolean horizontal_p)
+fit_to_screen (XlwMenuWidget mw,
+               window_state *ws,
+               window_state *previous_ws,
+               Boolean horizontal_p)
 {
   unsigned int screen_width = WidthOfScreen (XtScreen (mw));
   unsigned int screen_height = HeightOfScreen (XtScreen (mw));
@@ -1519,7 +1548,10 @@
 }
 
 static Boolean
-motion_event_is_in_menu (XlwMenuWidget mw, XMotionEvent *ev, int level, XPoint *relative_pos)
+motion_event_is_in_menu (XlwMenuWidget mw,
+                         XMotionEvent *ev,
+                         int level,
+                         XPoint *relative_pos)
 {
   window_state* ws = &mw->menu.windows [level];
   int shadow = level == 0 ? 0 : mw->menu.shadow_thickness;
@@ -1532,7 +1564,10 @@
 }
 
 static Boolean
-map_event_to_widget_value (XlwMenuWidget mw, XMotionEvent *ev, widget_value **val, int *level)
+map_event_to_widget_value (XlwMenuWidget mw,
+                           XMotionEvent *ev,
+                           widget_value **val,
+                           int *level)
 {
   int 		i;
   XPoint	relative_pos;
@@ -1861,7 +1896,7 @@
 
   /* _XtCreate is freeing the object that was passed to us,
      so make a copy that we will actually keep.  */
-  lwlib_bcopy (mw->menu.contents, tem, sizeof (widget_value));
+  memcpy (tem, mw->menu.contents, sizeof (widget_value));
   mw->menu.contents = tem;
 #endif
 
--- a/msdos/ChangeLog	Wed Jul 07 12:15:48 2010 +0000
+++ b/msdos/ChangeLog	Thu Jul 08 11:50:25 2010 +0000
@@ -1,3 +1,12 @@
+2010-07-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* sed1v2.inp: Remove reference to prefix-args.
+
+2010-07-07  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
+	(HAVE_BZERO): Don't edit.
+
 2010-07-02  Eli Zaretskii  <eliz@gnu.org>
 
 	* sed1v2.inp (LIB_GCC): Edit to empty.
--- a/msdos/sed1v2.inp	Wed Jul 07 12:15:48 2010 +0000
+++ b/msdos/sed1v2.inp	Thu Jul 08 11:50:25 2010 +0000
@@ -128,7 +128,6 @@
 /^[ 	]*$/d
 /^	if test -f/,/^	fi$/c\
 	command.com /c if exist .gdbinit rm -f _gdbinit
-/^temacs:/s/prefix-args//
 /^temacs:/s/stamp-oldxmenu//
 /^	if test "\${CANNOT_DUMP}" =/,/^	else /d
 /^	fi/d
--- a/msdos/sed2v2.inp	Wed Jul 07 12:15:48 2010 +0000
+++ b/msdos/sed2v2.inp	Thu Jul 08 11:50:25 2010 +0000
@@ -38,6 +38,8 @@
 /^#undef HAVE_CBRT *$/s/^.*$/#define HAVE_CBRT 1/
 /^#undef HAVE_DIFFTIME *$/s/^.*$/#define HAVE_DIFFTIME 1/
 /^#undef HAVE_FPATHCONF *$/s/^.*$/#define HAVE_FPATHCONF 1/
+/^#undef HAVE_MEMCPY *$/s/^.*$/#define HAVE_MEMCPY 1/
+/^#undef HAVE_MEMSET *$/s/^.*$/#define HAVE_MEMSET 1/
 /^#undef HAVE_MEMCMP *$/s/^.*$/#define HAVE_MEMCMP 1/
 /^#undef HAVE_MEMMOVE *$/s/^.*$/#define HAVE_MEMMOVE 1/
 /^#undef HAVE_SETRLIMIT *$/s/^.*$/#define HAVE_SETRLIMIT 1/
@@ -84,14 +86,6 @@
 #else\
 #undef HAVE_STDINT_H\
 #endif
-# GCC 3.x has a built-in bzero, which conflicts with the define at
-# the end of config.in
-/^#undef HAVE_BZERO/c\
-#if __GNUC__ >= 3\
-#define HAVE_BZERO 1\
-#else\
-#undef HAVE_BZERO\
-#endif
 
 # Comment out any remaining undef directives, because some of them
 # might be defined in sys/config.h we include at the top of config.h.
--- a/nt/ChangeLog	Wed Jul 07 12:15:48 2010 +0000
+++ b/nt/ChangeLog	Thu Jul 08 11:50:25 2010 +0000
@@ -1,3 +1,8 @@
+2010-07-07  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
+	(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
+
 2010-07-02  Juanma Barranquero  <lekktu@gmail.com>
 
 	* config.nt (__P): Remove.
--- a/nt/config.nt	Wed Jul 07 12:15:48 2010 +0000
+++ b/nt/config.nt	Thu Jul 08 11:50:25 2010 +0000
@@ -212,8 +212,10 @@
 #undef HAVE_SYSINFO
 #undef HAVE_RANDOM
 #undef HAVE_LRAND48
-#undef HAVE_BCOPY
-#undef HAVE_BCMP
+#undef HAVE_MEMCPY
+#undef HAVE_MEMMOVE
+#undef HAVE_MEMSET
+#undef HAVE_MEMCMP
 #undef HAVE_LOGB
 #undef HAVE_FREXP
 #undef HAVE_FMOD
--- a/src/ChangeLog	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/ChangeLog	Thu Jul 08 11:50:25 2010 +0000
@@ -1,3 +1,262 @@
+2010-07-08  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xmenu.c (set_frame_menubar, create_and_show_popup_menu)
+	(create_and_show_dialog): Don't call apply_systemfont_to_(menu|dialog)
+	unless USE_LUCID.
+
+2010-07-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* xdisp.c (store_mode_line_noprop_char): Remove K&R alternative declaration.
+
+	Clean up include guards.
+	* tparam.c: Remove include guards for config.h, string.h and code
+	that assumes #ifndef emacs.
+	* termcap.c:
+	* unexalpha.c:
+	* sysdep.c:
+	* filemode.c:
+	* filelock.c:
+	* bidi.c: Likewise.
+
+	Remove prefix-args.c
+	* prefix-args.c: Remove file.
+	* autodeps.mk (ALLOBJS): Remove reference to prefix-args.
+	* Makefile.in (temacs${EXEEXT}): Remove references to
+	PRE_EDIT_LDFLAGS and POST_EDIT_LDFLAGS.
+	(mostlyclean): Remove reference to prefix-args.
+	(prefix-args): Remove.
+
+	Simplify cstart_of_data, start_of_code and related code.
+	* mem-limits.h: Remove !emacs and _LIBC conditional code.
+	(start_of_data): Merge into start_of_data function.
+	* sysdep.c (start_of_text): Remove.  Move simplified versions of
+	it in the only users: unexaix.c and unexec.c.
+	(read_input_waiting): Remove local declaration of quit_char.
+	(start, etext): Remove declarations.
+	(start_of_data): Merge with the version in mem-limits.h and move
+	to vm-limits.c.
+	* vm-limit.c (start_of_data): Merged and simplified version of the
+	code formerly in mem-limits.h and sysdep.c.
+	* unexec.c (start): New declaration, moved from sysdep.c.
+	(start_of_text): Simplified version of the code formerly in sysdep.c.
+	* unexaix.c (start_of_text): Simplified version of the code
+	formerly in sysdep.c.
+	* m/alpha.h (HAVE_TEXT_START): Remove.
+	(TEXT_START): Move ...
+	* unexalpha.c (TEXT_START): ... here.
+	* s/hpux10-20.h (TEXT_START): Remove.
+	* s/darwin.h (TEXT_START):
+	* m/mips.h (TEXT_START):
+	* m/macppc.h (HAVE_TEXT_START):
+	* m/m68k.h (TEXT_START):
+	* m/iris4d.h (TEXT_START):
+	* m/intel386.h (TEXT_START):
+	* m/ibmrs6000.h (TEXT_START):
+	* m/ia64.h (HAVE_TEXT_START):
+	* s/msdos.h (TEXT_START): Likewise.
+
+2010-07-07  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* alloc.c (overrun_check_malloc, overrun_check_realloc)
+	(overrun_check_free, xstrdup, allocate_string)
+	(allocate_string_data, compact_small_strings, Fmake_string)
+	(make_unibyte_string, make_multibyte_string)
+	(make_string_from_bytes, make_specified_string, make_float)
+	(Fcons, allocate_terminal, allocate_frame, make_pure_string)
+	(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
+	memcpy, memmove, memset, memcmp.
+	* atimer.c (start_atimer, set_alarm): Likewise.
+	* buffer.c (clone_per_buffer_values, report_overlay_modification)
+	(mmap_realloc, init_buffer_once): Likewise.
+	* callint.c (Fcall_interactively): Likewise.
+	* callproc.c (Fcall_process, Fcall_process_region, child_setup)
+	(getenv_internal_1): Likewise.
+	* casefiddle.c (casify_object): Likewise.
+	* ccl.c (ccl_driver): Likewise.
+	* character.c (str_as_multibyte, str_to_multibyte): Likewise.
+	* charset.c (load_charset_map_from_file)
+	(load_charset_map_from_file, load_charset_map_from_vector)
+	(Fdefine_charset_internal): Likewise.
+	* cm.c (Wcm_clear): Likewise.
+	* coding.c (decode_eol, decode_coding_object)
+	(Fset_coding_system_priority, make_subsidiaries): Likewise.
+	* data.c (Faset): Likewise.
+	* dired.c (directory_files_internal, file_name_completion_stat):
+	Likewise.
+	* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
+	(clear_glyph_row, copy_row_except_pointers)
+	(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
+	(save_current_matrix, restore_current_matrix)
+	(build_frame_matrix_from_leaf_window, mirrored_line_dance)
+	(mirror_line_dance, scrolling_window): Likewise.
+	* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
+	Likewise.
+	* doprnt.c (doprnt): Likewise.
+	* editfns.c (Fuser_full_name, make_buffer_string_both)
+	(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
+	* emacs.c (sort_args): Likewise.
+	* eval.c (Fapply, Ffuncall): Likewise.
+	* fileio.c (Ffile_name_directory, make_temp_name)
+	(Fexpand_file_name, search_embedded_absfilename)
+	(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
+	(auto_save_error): Likewise.
+	* fns.c (Fstring_equal, Fcopy_sequence, concat)
+	(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
+	(internal_equal, Fclear_string, larger_vector, copy_hash_table)
+	(Fmake_hash_table): Likewise.
+	* fringe.c (Fdefine_fringe_bitmap): Likewise.
+	* ftfont.c (ftfont_text_extents): Likewise.
+	* getloadavg.c (getloadavg): Likewise.
+	* image.c (define_image_type, make_image, make_image_cache)
+	(x_create_x_image_and_pixmap, xbm_image_p)
+	(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
+	(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
+	(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
+	(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
+	(tiff_image_p, tiff_read_from_memory, gif_image_p)
+	(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
+	Likewise.
+	* indent.c (scan_for_column, compute_motion): Likewise.
+	* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
+	(insert_1_both, insert_from_gap, replace_range_2): Likewise.
+	* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
+	* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
+	(kbd_buffer_store_event_hold, apply_modifiers_uncached)
+	(store_user_signal_events, menu_bar_items, tool_bar_items)
+	(process_tool_bar_item, append_tool_bar_item)
+	(read_char_minibuf_menu_prompt, read_key_sequence)
+	(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
+	Likewise.
+	* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
+	Likewise.
+	* lisp.h (STRING_COPYIN): Likewise.
+	* lread.c (Fload, read1, oblookup): Likewise.
+	* msdos.c (Frecent_doskeys): Likewise.
+	* nsfns.m (Fx_create_frame): Likewise.
+	* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
+	Likewise.
+	* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
+	(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
+	Likewise.
+	* nsmenu.m (ns_update_menubar): Likewise.
+	* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
+	* print.c (print_unwind, printchar, strout, print_string)
+	(print_error_message): Likewise.
+	* process.c (conv_lisp_to_sockaddr, set_socket_option)
+	(Fmake_network_process, Fnetwork_interface_list)
+	(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
+	(init_process): Likewise.
+	* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
+	* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
+	Likewise.
+	* scroll.c (do_scrolling, do_direct_scrolling)
+	(scrolling_max_lines_saved): Likewise.
+	* search.c (search_buffer, wordify, Freplace_match): Likewise.
+	* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
+	* syntax.c (skip_chars, skip_syntaxes): Likewise.
+	* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
+	(emacs_set_tty): Likewise.
+	* term.c (encode_terminal_code, calculate_costs)
+	(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
+	Likewise.
+	* termcap.c (tgetst1, gobble_line): Likewise.
+	* termhooks.h (EVENT_INIT): Likewise.
+	* tparam.c (tparam1): Likewise.
+	* unexalpha.c (unexec): Likewise.
+	* unexec.c (write_segment): Likewise.
+	* unexmacosx.c (unexec_write_zero): Likewise.
+	* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
+	(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
+	* w32font.c (w32font_list_family, w32font_text_extents)
+	(w32font_list_internal, w32font_match_internal)
+	(w32font_open_internal, compute_metrics, Fx_select_font):
+	Likewise.
+	* w32menu.c (set_frame_menubar, add_menu_item)
+	(w32_menu_display_help, w32_free_submenu_strings): Likewise.
+	* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
+	* w32uniscribe.c (uniscribe_list_family): Likewise.
+	* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
+	* window.c (make_window, replace_window, set_window_buffer)
+	(Fsplit_window): Likewise.
+	* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
+	(add_to_log, message3, x_consider_frame_title)
+	(append_space_for_newline, extend_face_to_end_of_line)
+	(decode_mode_spec_coding, init_glyph_string): Likewise.
+	* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
+	(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
+	(face_attr_equal_p, make_realized_face, make_face_cache)
+	(free_realized_faces, lookup_named_face, smaller_face)
+	(face_with_height, lookup_derived_face)
+	(x_supports_face_attributes_p, Finternal_set_font_selection_order)
+	(Finternal_set_font_selection_order, realize_default_face)
+	(compute_char_face, face_at_buffer_position)
+	(face_for_overlay_string, face_at_string_position, merge_faces):
+	Likewise.
+	* xfns.c (xic_create_fontsetname, Fx_create_frame)
+	(Fx_window_property, x_create_tip_frame)
+	(Fx_backspace_delete_keys_p): Likewise.
+	* xfont.c (xfont_list, xfont_match, xfont_list_family)
+	(xfont_text_extents): Likewise.
+	* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
+	* xrdb.c (magic_file_p, x_get_resource): Likewise.
+	* xselect.c (x_queue_event, x_get_window_property)
+	(receive_incremental_selection): Likewise.
+	* xsmfns.c (x_session_check_input): Likewise.
+	* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
+	(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
+	Likewise.
+	* character.h (BCOPY_SHORT): Removed.
+	* config.in: Regenerate.
+	* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
+	* emacs.c (main) [PROFILING]: Don't declare
+	dump_opcode_frequencies.
+	* lisp.h (safe_bcopy): Remove declaration.
+	(memset) [!HAVE_MEMSET]: Declare.
+	(memcpy) [!HAVE_MEMCPY]: Likewise.
+	(memmove) [!HAVE_MEMMOVE]: Likewise.
+	(memcmp) [!HAVE_MEMCMP]: Likewise.
+	* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
+	(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
+	Don't define.
+	(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
+	* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
+	(BCOPY_DOWNWARD_SAFE): Don't define.
+	* sysdep.c (memset) [!HAVE_MEMSET]: Define.
+	(memcpy) [!HAVE_MEMCPY]: Define.
+	(memmove) [!HAVE_MEMMOVE]: Define.
+	(memcmp) [!HAVE_MEMCMP]: Define.
+
+2010-07-07  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* process.c (kbd_is_on_hold): New variable.
+	(hold_keyboard_input, unhold_keyboard_input, kbd_on_hold_p): New
+	functions.
+	(wait_reading_process_output): If kbd_on_hold_p returns non-zero,
+	select on empty input mask.
+	(init_process): Initialize kbd_is_on_hold to 0.
+
+	* process.h (hold_keyboard_input, unhold_keyboard_input)
+	(kbd_on_hold_p): Declare.
+
+	* keyboard.c (input_available_signal): Declare.
+	(kbd_buffer_nr_stored): New function.
+	(kbd_buffer_store_event_hold): If kbd_buffer_nr_stored returns
+	more than KBD_BUFFER_SIZE/2, stop reding input (Bug#6571).
+	(kbd_buffer_get_event): If input is suspended and kbd_buffer_nr_stored
+	returns less than KBD_BUFFER_SIZE/4, resume reding input (Bug#6571).
+	(tty_read_avail_input): If input is on hold, return.
+	Don't read more that free slots in kbd_buffer (Bug#6571).
+
+2010-07-07  Eli Zaretskii  <eliz@gnu.org>
+
+	* msdos.h:
+	* msdos.c:
+	* dosfns.c:
+	* w16select.c: Convert function definitions to ANSI C.
+
+	* msdos.h (ctrl_break_func, install_ctrl_break_check): Remove
+	unused prototypes.
+
 2010-07-07  Juanma Barranquero  <lekktu@gmail.com>
 
 	* coding.c, sysdep.c: Convert some more functions to standard C.
--- a/src/Makefile.in	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/Makefile.in	Thu Jul 08 11:50:25 2010 +0000
@@ -628,20 +628,10 @@
 	echo "#define BUILDOBJ \"${obj} ${otherobj} " "\"" > buildobj.h
 
 
-## We cannot define variables for PRE_EDIT and POST_EDIT.
-## If !ORDINARY_LINK && !LINKER && GCC, they add a
-## `./prefix-args -Xlinker ... ` wrapper, otherwise they are empty.
-## One alternative to this approach would be to always call prefix-args, 
-## and have it DTRT in all cases, by testing the above defines.
-temacs${EXEEXT}: $(START_FILES) stamp-oldxmenu ${obj} ${otherobj} prefix-args${EXEEXT}
-	$(LD) @PRE_EDIT_LDFLAGS@ ${TEMACS_LDFLAGS} @POST_EDIT_LDFLAGS@ \
-	  ${TEMACS_LDFLAGS2} \
+temacs${EXEEXT}: $(START_FILES) stamp-oldxmenu ${obj} ${otherobj}
+	$(LD) ${TEMACS_LDFLAGS} ${TEMACS_LDFLAGS2} \
 	  -o temacs ${START_FILES} ${obj} ${otherobj} ${LIBES}
 
-prefix-args${EXEEXT}: prefix-args.o $(config_h)
-	$(CC) $(LDFLAGS) prefix-args.o -o prefix-args
-
-
 ## The following oldxmenu-related rules are only (possibly) used if
 ## HAVE_X11 && !USE_GTK, but there is no harm in always defining them
 ## (provided we take a little care that OLDXMENU is never empty).
@@ -688,7 +678,7 @@
 
 
 mostlyclean:
-	rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a
+	rm -f temacs${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a
 	rm -f ../etc/DOC
 	rm -f bootstrap-emacs${EXEEXT} emacs-${version}${EXEEXT}
 	rm -f buildobj.h
--- a/src/alloc.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/alloc.c	Thu Jul 08 11:50:25 2010 +0000
@@ -636,10 +636,12 @@
   val = (unsigned char *) malloc (size + overhead);
   if (val && check_depth == 1)
     {
-      bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4);
+      memcpy (val, xmalloc_overrun_check_header,
+	      XMALLOC_OVERRUN_CHECK_SIZE - 4);
       val += XMALLOC_OVERRUN_CHECK_SIZE;
       XMALLOC_PUT_SIZE(val, size);
-      bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE);
+      memcpy (val + size, xmalloc_overrun_check_trailer,
+	      XMALLOC_OVERRUN_CHECK_SIZE);
     }
   --check_depth;
   return (POINTER_TYPE *)val;
@@ -659,28 +661,29 @@
 
   if (val
       && check_depth == 1
-      && bcmp (xmalloc_overrun_check_header,
-	       val - XMALLOC_OVERRUN_CHECK_SIZE,
-	       XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
+      && memcmp (xmalloc_overrun_check_header,
+		 val - XMALLOC_OVERRUN_CHECK_SIZE,
+		 XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
     {
       size_t osize = XMALLOC_GET_SIZE (val);
-      if (bcmp (xmalloc_overrun_check_trailer,
-		val + osize,
-		XMALLOC_OVERRUN_CHECK_SIZE))
+      if (memcmp (xmalloc_overrun_check_trailer, val + osize,
+		  XMALLOC_OVERRUN_CHECK_SIZE))
 	abort ();
-      bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE);
+      memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE);
       val -= XMALLOC_OVERRUN_CHECK_SIZE;
-      bzero (val, XMALLOC_OVERRUN_CHECK_SIZE);
+      memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE);
     }
 
   val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead);
 
   if (val && check_depth == 1)
     {
-      bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4);
+      memcpy (val, xmalloc_overrun_check_header,
+	      XMALLOC_OVERRUN_CHECK_SIZE - 4);
       val += XMALLOC_OVERRUN_CHECK_SIZE;
       XMALLOC_PUT_SIZE(val, size);
-      bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE);
+      memcpy (val + size, xmalloc_overrun_check_trailer,
+	      XMALLOC_OVERRUN_CHECK_SIZE);
     }
   --check_depth;
   return (POINTER_TYPE *)val;
@@ -697,22 +700,21 @@
   ++check_depth;
   if (val
       && check_depth == 1
-      && bcmp (xmalloc_overrun_check_header,
-	       val - XMALLOC_OVERRUN_CHECK_SIZE,
-	       XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
+      && memcmp (xmalloc_overrun_check_header,
+		 val - XMALLOC_OVERRUN_CHECK_SIZE,
+		 XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
     {
       size_t osize = XMALLOC_GET_SIZE (val);
-      if (bcmp (xmalloc_overrun_check_trailer,
-		val + osize,
-		XMALLOC_OVERRUN_CHECK_SIZE))
+      if (memcmp (xmalloc_overrun_check_trailer, val + osize,
+		  XMALLOC_OVERRUN_CHECK_SIZE))
 	abort ();
 #ifdef XMALLOC_CLEAR_FREE_MEMORY
       val -= XMALLOC_OVERRUN_CHECK_SIZE;
       memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2);
 #else
-      bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE);
+      memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE);
       val -= XMALLOC_OVERRUN_CHECK_SIZE;
-      bzero (val, XMALLOC_OVERRUN_CHECK_SIZE);
+      memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE);
 #endif
     }
 
@@ -799,7 +801,7 @@
 {
   size_t len = strlen (s) + 1;
   char *p = (char *) xmalloc (len);
-  bcopy (s, p, len);
+  memcpy (p, s, len);
   return p;
 }
 
@@ -1873,7 +1875,7 @@
       int i;
 
       b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING);
-      bzero (b, sizeof *b);
+      memset (b, 0, sizeof *b);
       b->next = string_blocks;
       string_blocks = b;
       ++n_string_blocks;
@@ -1897,7 +1899,7 @@
   MALLOC_UNBLOCK_INPUT;
 
   /* Probably not strictly necessary, but play it safe.  */
-  bzero (s, sizeof *s);
+  memset (s, 0, sizeof *s);
 
   --total_free_strings;
   ++total_strings;
@@ -2005,8 +2007,7 @@
   s->size_byte = nbytes;
   s->data[nbytes] = '\0';
 #ifdef GC_CHECK_STRING_OVERRUN
-  bcopy (string_overrun_cookie, (char *) data + needed,
-	 GC_STRING_OVERRUN_COOKIE_SIZE);
+  memcpy (data + needed, string_overrun_cookie, GC_STRING_OVERRUN_COOKIE_SIZE);
 #endif
 
   /* If S had already data assigned, mark that as free by setting its
@@ -2197,9 +2198,9 @@
 	  from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA);
 
 #ifdef GC_CHECK_STRING_OVERRUN
-	  if (bcmp (string_overrun_cookie,
-		    ((char *) from_end) - GC_STRING_OVERRUN_COOKIE_SIZE,
-		    GC_STRING_OVERRUN_COOKIE_SIZE))
+	  if (memcmp (string_overrun_cookie,
+		      (char *) from_end - GC_STRING_OVERRUN_COOKIE_SIZE,
+		      GC_STRING_OVERRUN_COOKIE_SIZE))
 	    abort ();
 #endif
 
@@ -2221,7 +2222,7 @@
 	      if (from != to)
 		{
 		  xassert (tb != b || to <= from);
-		  safe_bcopy ((char *) from, (char *) to, nbytes + GC_STRING_EXTRA);
+		  memmove (to, from, nbytes + GC_STRING_EXTRA);
 		  to->string->data = SDATA_DATA (to);
 		}
 
@@ -2280,7 +2281,7 @@
       end = p + nbytes;
       while (p != end)
 	{
-	  bcopy (str, p, len);
+	  memcpy (p, str, len);
 	  p += len;
 	}
     }
@@ -2362,7 +2363,7 @@
 {
   register Lisp_Object val;
   val = make_uninit_string (length);
-  bcopy (contents, SDATA (val), length);
+  memcpy (SDATA (val), contents, length);
   STRING_SET_UNIBYTE (val);
   return val;
 }
@@ -2376,7 +2377,7 @@
 {
   register Lisp_Object val;
   val = make_uninit_multibyte_string (nchars, nbytes);
-  bcopy (contents, SDATA (val), nbytes);
+  memcpy (SDATA (val), contents, nbytes);
   return val;
 }
 
@@ -2389,7 +2390,7 @@
 {
   register Lisp_Object val;
   val = make_uninit_multibyte_string (nchars, nbytes);
-  bcopy (contents, SDATA (val), nbytes);
+  memcpy (SDATA (val), contents, nbytes);
   if (SBYTES (val) == SCHARS (val))
     STRING_SET_UNIBYTE (val);
   return val;
@@ -2414,7 +2415,7 @@
 	nchars = nbytes;
     }
   val = make_uninit_multibyte_string (nchars, nbytes);
-  bcopy (contents, SDATA (val), nbytes);
+  memcpy (SDATA (val), contents, nbytes);
   if (!multibyte)
     STRING_SET_UNIBYTE (val);
   return val;
@@ -2587,7 +2588,7 @@
 	  new = (struct float_block *) lisp_align_malloc (sizeof *new,
 							  MEM_TYPE_FLOAT);
 	  new->next = float_block;
-	  bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits);
+	  memset (new->gcmarkbits, 0, sizeof new->gcmarkbits);
 	  float_block = new;
 	  float_block_index = 0;
 	  n_float_blocks++;
@@ -2709,7 +2710,7 @@
 	  register struct cons_block *new;
 	  new = (struct cons_block *) lisp_align_malloc (sizeof *new,
 							 MEM_TYPE_CONS);
-	  bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits);
+	  memset (new->gcmarkbits, 0, sizeof new->gcmarkbits);
 	  new->next = cons_block;
 	  cons_block = new;
 	  cons_block_index = 0;
@@ -2950,8 +2951,8 @@
   struct terminal *t = ALLOCATE_PSEUDOVECTOR (struct terminal,
 					      next_terminal, PVEC_TERMINAL);
   /* Zero out the non-GC'd fields.  FIXME: This should be made unnecessary.  */
-  bzero (&(t->next_terminal),
-	 ((char*)(t+1)) - ((char*)&(t->next_terminal)));
+  memset (&t->next_terminal, 0,
+	  (char*) (t + 1) - (char*) &t->next_terminal);
 
   return t;
 }
@@ -2962,8 +2963,8 @@
   struct frame *f = ALLOCATE_PSEUDOVECTOR (struct frame,
 					   face_cache, PVEC_FRAME);
   /* Zero out the non-GC'd fields.  FIXME: This should be made unnecessary.  */
-  bzero (&(f->face_cache),
-	 ((char*)(f+1)) - ((char*)&(f->face_cache)));
+  memset (&f->face_cache, 0,
+	  (char *) (f + 1) - (char *) &f->face_cache);
   return f;
 }
 
@@ -4713,7 +4714,7 @@
   if (s->data == NULL)
     {
       s->data = (unsigned char *) pure_alloc (nbytes + 1, -1);
-      bcopy (data, s->data, nbytes);
+      memcpy (s->data, data, nbytes);
       s->data[nbytes] = '\0';
     }
   s->size = nchars;
@@ -4980,9 +4981,9 @@
 	  if (stack_copy)
 	    {
 	      if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0)
-		bcopy (stack_bottom, stack_copy, i);
+		memcpy (stack_copy, stack_bottom, i);
 	      else
-		bcopy (&stack_top_variable, stack_copy, i);
+		memcpy (stack_copy, &stack_top_variable, i);
 	    }
 	}
     }
--- a/src/atimer.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/atimer.c	Thu Jul 08 11:50:25 2010 +0000
@@ -116,7 +116,7 @@
     t = (struct atimer *) xmalloc (sizeof *t);
 
   /* Fill the atimer structure.  */
-  bzero (t, sizeof *t);
+  memset (t, 0, sizeof *t);
   t->type = type;
   t->fn = fn;
   t->client_data = client_data;
@@ -308,7 +308,7 @@
 	  EMACS_SET_USECS (time, 1000);
 	}
 
-      bzero (&it, sizeof it);
+      memset (&it, 0, sizeof it);
       it.it_value = time;
       setitimer (ITIMER_REAL, &it, 0);
 #else /* not HAVE_SETITIMER */
--- a/src/autodeps.mk	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/autodeps.mk	Thu Jul 08 11:50:25 2010 +0000
@@ -2,5 +2,5 @@
 
 ## This is inserted in src/Makefile if AUTO_DEPEND=yes.
 
-ALLOBJS=$(START_FILES) ${obj} ${otherobj} prefix-args.o
+ALLOBJS=$(START_FILES) ${obj} ${otherobj}
 -include $(ALLOBJS:%.o=${DEPDIR}/%.d)
--- a/src/bidi.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/bidi.c	Thu Jul 08 11:50:25 2010 +0000
@@ -49,16 +49,9 @@
    rule X9 and to its modifications decribed in the "Implementation
    Notes" section of UAX#9, under "Retaining Format Codes".  */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
-
 #include <stdio.h>
-
-#ifdef HAVE_STRING_H
 #include <string.h>
-#endif
-
 #include <setjmp.h>
 
 #include "lisp.h"
--- a/src/buffer.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/buffer.c	Thu Jul 08 11:50:25 2010 +0000
@@ -514,7 +514,7 @@
       PER_BUFFER_VALUE (to, offset) = obj;
     }
 
-  bcopy (from->local_flags, to->local_flags, sizeof to->local_flags);
+  memcpy (to->local_flags, from->local_flags, sizeof to->local_flags);
 
   to->overlays_before = copy_overlays (to, from->overlays_before);
   to->overlays_after = copy_overlays (to, from->overlays_after);
@@ -4413,8 +4413,8 @@
     Lisp_Object *copy = (Lisp_Object *) alloca (size * sizeof (Lisp_Object));
     int i;
 
-    bcopy (XVECTOR (last_overlay_modification_hooks)->contents,
-	   copy, size * sizeof (Lisp_Object));
+    memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents,
+	    size * sizeof (Lisp_Object));
     gcpro1.var = copy;
     gcpro1.nvars = size;
 
@@ -4877,7 +4877,7 @@
 	    }
 	  else if (mmap_alloc (var, nbytes))
 	    {
-	      bcopy (old_ptr, *var, r->nbytes_specified);
+	      memcpy (*var, old_ptr, r->nbytes_specified);
 	      mmap_free_1 (MMAP_REGION (old_ptr));
 	      result = *var;
 	      r = MMAP_REGION (result);
@@ -5058,7 +5058,7 @@
 {
   int idx;
 
-  bzero (buffer_permanent_local_flags, sizeof buffer_permanent_local_flags);
+  memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags);
 
   /* Make sure all markable slots in buffer_defaults
      are initialized reasonably, so mark_buffer won't choke.  */
@@ -5146,7 +5146,7 @@
   if (sizeof (EMACS_INT) != sizeof (Lisp_Object)) abort ();
 
   /* 0 means not a lisp var, -1 means always local, else mask */
-  bzero (&buffer_local_flags, sizeof buffer_local_flags);
+  memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
   XSETINT (buffer_local_flags.filename, -1);
   XSETINT (buffer_local_flags.directory, -1);
   XSETINT (buffer_local_flags.backed_up, -1);
--- a/src/callint.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/callint.c	Thu Jul 08 11:50:25 2010 +0000
@@ -348,8 +348,7 @@
       /* Make a copy of string so that if a GC relocates specs,
 	 `string' will still be valid.  */
       string = (unsigned char *) alloca (SBYTES (specs) + 1);
-      bcopy (SDATA (specs), string,
-	     SBYTES (specs) + 1);
+      memcpy (string, SDATA (specs), SBYTES (specs) + 1);
     }
   else
     {
--- a/src/callproc.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/callproc.c	Thu Jul 08 11:50:25 2010 +0000
@@ -775,10 +775,8 @@
 				  PT_BYTE + process_coding.produced);
 		carryover = process_coding.carryover_bytes;
 		if (carryover > 0)
-		  /* As CARRYOVER should not be that large, we had
-		     better avoid overhead of bcopy.  */
-		  BCOPY_SHORT (process_coding.carryover, buf,
-			       process_coding.carryover_bytes);
+		  memcpy (buf, process_coding.carryover,
+			  process_coding.carryover_bytes);
 	      }
 	  }
 
@@ -916,7 +914,7 @@
 
   pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir);
   tempfile = (char *) alloca (SBYTES (pattern) + 1);
-  bcopy (SDATA (pattern), tempfile, SBYTES (pattern) + 1);
+  memcpy (tempfile, SDATA (pattern), SBYTES (pattern) + 1);
   coding_systems = Qt;
 
 #ifdef HAVE_MKSTEMP
@@ -1099,8 +1097,8 @@
     pwd_var = (char *) alloca (i + 6);
 #endif
     temp = pwd_var + 4;
-    bcopy ("PWD=", pwd_var, 4);
-    bcopy (SDATA (current_dir), temp, i);
+    memcpy (pwd_var, "PWD=", 4);
+    memcpy (temp, SDATA (current_dir), i);
     if (!IS_DIRECTORY_SEP (temp[i - 1])) temp[i++] = DIRECTORY_SEP;
     temp[i] = 0;
 
@@ -1325,7 +1323,7 @@
 	  /* NT environment variables are case insensitive.  */
 	  && ! strnicmp (SDATA (entry), var, varlen)
 #else  /* not WINDOWSNT */
-	  && ! bcmp (SDATA (entry), var, varlen)
+	  && ! memcmp (SDATA (entry), var, varlen)
 #endif /* not WINDOWSNT */
 	  )
 	{
--- a/src/casefiddle.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/casefiddle.c	Thu Jul 08 11:50:25 2010 +0000
@@ -128,7 +128,7 @@
 	      unsigned char *old_dst = dst;
 	      o_size += o_size;	/* Probably overkill, but extremely rare.  */
 	      SAFE_ALLOCA (dst, void *, o_size);
-	      bcopy (old_dst, dst, o - old_dst);
+	      memcpy (dst, old_dst, o - old_dst);
 	      o = dst + (o - old_dst);
 	    }
 	  c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len);
--- a/src/ccl.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/ccl.c	Thu Jul 08 11:50:25 2010 +0000
@@ -1715,7 +1715,7 @@
 	    msglen = strlen (msg);
 	    if (dst + msglen <= (dst_bytes ? dst_end : src))
 	      {
-		bcopy (msg, dst, msglen);
+		memcpy (dst, msg, msglen);
 		dst += msglen;
 	      }
 
@@ -1728,7 +1728,7 @@
 		msglen = strlen (msg);
 		if (dst + msglen > (dst_bytes ? dst_end : src))
 		  break;
-		bcopy (msg, dst, msglen);
+		memcpy (dst, msg, msglen);
 		dst += msglen;
 	      }
 	    goto ccl_finish;
@@ -1761,7 +1761,7 @@
 	  int i = src_end - src;
 	  if (dst_bytes && (dst_end - dst) < i)
 	    i = dst_end - dst;
-	  bcopy (src, dst, i);
+	  memcpy (dst, src, i);
 	  src += i;
 	  dst += i;
 #else
--- a/src/character.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/character.c	Thu Jul 08 11:50:25 2010 +0000
@@ -668,7 +668,7 @@
   to = p;
   nbytes = endp - p;
   endp = str + len;
-  safe_bcopy ((char *) p, (char *) (endp - nbytes), nbytes);
+  memmove (endp - nbytes, p, nbytes);
   p = endp - nbytes;
 
   if (nbytes >= MAX_MULTIBYTE_LENGTH)
@@ -746,7 +746,7 @@
   to = p;
   bytes = endp - p;
   endp = str + len;
-  safe_bcopy ((char *) p, (char *) (endp - bytes), bytes);
+  memmove (endp - bytes, p, bytes);
   p = endp - bytes;
   while (p < endp)
     {
--- a/src/character.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/character.h	Thu Jul 08 11:50:25 2010 +0000
@@ -636,18 +636,6 @@
 extern Lisp_Object Vchar_script_table;
 extern Lisp_Object Vscript_representative_chars;
 
-/* Copy LEN bytes from FROM to TO.  This macro should be used only
-   when a caller knows that LEN is short and the obvious copy loop is
-   faster than calling bcopy which has some overhead.  Copying a
-   multibyte sequence of a character is the typical case.  */
-
-#define BCOPY_SHORT(from, to, len)		\
-  do {						\
-    int i = len;				\
-    unsigned char *from_p = from, *to_p = to;	\
-    while (i--) *to_p++ = *from_p++;		\
-  } while (0)
-
 #define DEFSYM(sym, name)	\
   do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (0)
 
--- a/src/charset.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/charset.c	Thu Jul 08 11:50:25 2010 +0000
@@ -522,7 +522,7 @@
   SAFE_ALLOCA (head, struct charset_map_entries *,
 	       sizeof (struct charset_map_entries));
   entries = head;
-  bzero (entries, sizeof (struct charset_map_entries));
+  memset (entries, 0, sizeof (struct charset_map_entries));
 
   n_entries = 0;
   eof = 0;
@@ -549,7 +549,7 @@
 	  SAFE_ALLOCA (entries->next, struct charset_map_entries *,
 		       sizeof (struct charset_map_entries));
 	  entries = entries->next;
-	  bzero (entries, sizeof (struct charset_map_entries));
+	  memset (entries, 0, sizeof (struct charset_map_entries));
 	}
       idx = n_entries % 0x10000;
       entries->entry[idx].from = from;
@@ -585,7 +585,7 @@
   SAFE_ALLOCA (head, struct charset_map_entries *,
 	       sizeof (struct charset_map_entries));
   entries = head;
-  bzero (entries, sizeof (struct charset_map_entries));
+  memset (entries, 0, sizeof (struct charset_map_entries));
 
   n_entries = 0;
   for (i = 0; i < len; i += 2)
@@ -622,7 +622,7 @@
 	  SAFE_ALLOCA (entries->next, struct charset_map_entries *,
 		       sizeof (struct charset_map_entries));
 	  entries = entries->next;
-	  bzero (entries, sizeof (struct charset_map_entries));
+	  memset (entries, 0, sizeof (struct charset_map_entries));
 	}
       idx = n_entries % 0x10000;
       entries->entry[idx].from = from;
@@ -935,7 +935,7 @@
   if (! charset.code_linear_p)
     {
       charset.code_space_mask = (unsigned char *) xmalloc (256);
-      bzero (charset.code_space_mask, 256);
+      memset (charset.code_space_mask, 0, 256);
       for (i = 0; i < 4; i++)
 	for (j = charset.code_space[i * 4]; j <= charset.code_space[i * 4 + 1];
 	     j++)
@@ -1058,7 +1058,7 @@
 
   charset.unified_p = 0;
 
-  bzero (charset.fast_map, sizeof (charset.fast_map));
+  memset (charset.fast_map, 0, sizeof (charset.fast_map));
 
   if (! NILP (args[charset_arg_code_offset]))
     {
@@ -1191,8 +1191,8 @@
 	  struct charset *new_table
 	    = (struct charset *) xmalloc (sizeof (struct charset)
 					  * (charset_table_size + 16));
-	  bcopy (charset_table, new_table,
-		 sizeof (struct charset) * charset_table_size);
+	  memcpy (new_table, charset_table,
+		  sizeof (struct charset) * charset_table_size);
 	  charset_table_size += 16;
 	  charset_table = new_table;
 	}
--- a/src/cm.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/cm.c	Thu Jul 08 11:50:25 2010 +0000
@@ -430,7 +430,7 @@
 void
 Wcm_clear (struct tty_display_info *tty)
 {
-  bzero (tty->Wcm, sizeof (struct cm));
+  memset (tty->Wcm, 0, sizeof (struct cm));
   UP = 0;
   BC = 0;
 }
--- a/src/coding.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/coding.c	Thu Jul 08 11:50:25 2010 +0000
@@ -6550,7 +6550,7 @@
 	  for (p = pend - 2; p >= pbeg; p--)
 	    if (*p == '\r')
 	      {
-		safe_bcopy ((char *) (p + 1), (char *) p, pend-- - p - 1);
+		memmove (p, p + 1, pend-- - p - 1);
 		n++;
 	      }
 	}
@@ -7814,7 +7814,7 @@
 	    }
 	  if (BEGV < GPT && GPT < BEGV + coding->produced_char)
 	    move_gap_both (BEGV, BEGV_BYTE);
-	  bcopy (BEGV_ADDR, destination, coding->produced);
+	  memcpy (destination, BEGV_ADDR, coding->produced);
 	  coding->destination = destination;
 	}
     }
@@ -9482,7 +9482,7 @@
   int changed[coding_category_max];
   enum coding_category priorities[coding_category_max];
 
-  bzero (changed, sizeof changed);
+  memset (changed, 0, sizeof changed);
 
   for (i = j = 0; i < nargs; i++)
     {
@@ -9517,7 +9517,7 @@
       priorities[i] = coding_priorities[j];
     }
 
-  bcopy (priorities, coding_priorities, sizeof priorities);
+  memcpy (coding_priorities, priorities, sizeof priorities);
 
   /* Update `coding-category-list'.  */
   Vcoding_category_list = Qnil;
@@ -9568,11 +9568,11 @@
   char *buf = (char *) alloca (base_name_len + 6);
   int i;
 
-  bcopy (SDATA (SYMBOL_NAME (base)), buf, base_name_len);
+  memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len);
   subsidiaries = Fmake_vector (make_number (3), Qnil);
   for (i = 0; i < 3; i++)
     {
-      bcopy (suffixes[i], buf + base_name_len, strlen (suffixes[i]) + 1);
+      memcpy (buf + base_name_len, suffixes[i], strlen (suffixes[i]) + 1);
       ASET (subsidiaries, i, intern (buf));
     }
   return subsidiaries;
--- a/src/config.in	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/config.in	Thu Jul 08 11:50:25 2010 +0000
@@ -102,15 +102,6 @@
 /* Define to 1 if ALSA is available. */
 #undef HAVE_ALSA
 
-/* Define to 1 if you have the `bcmp' function. */
-#undef HAVE_BCMP
-
-/* Define to 1 if you have the `bcopy' function. */
-#undef HAVE_BCOPY
-
-/* Define to 1 if you have the `bzero' function. */
-#undef HAVE_BZERO
-
 /* Define to 1 if you have the `cbrt' function. */
 #undef HAVE_CBRT
 
@@ -1141,10 +1132,6 @@
 #include <string.h>
 #endif
 
-#ifdef HAVE_STRINGS_H
-#include <strings.h>  /* May be needed for bcopy & al.  */
-#endif
-
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
@@ -1186,16 +1173,6 @@
 #  endif
 #endif
 
-#ifndef HAVE_BCOPY
-#define bcopy(a,b,s) memcpy (b,a,s)
-#endif
-#ifndef HAVE_BZERO
-#define bzero(a,s) memset (a,0,s)
-#endif
-#ifndef HAVE_BCMP
-#define BCMP memcmp
-#endif
-
 #endif /* EMACS_CONFIG_H */
 
 /*
--- a/src/data.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/data.c	Thu Jul 08 11:50:25 2010 +0000
@@ -2264,13 +2264,13 @@
 	  USE_SAFE_ALLOCA;
 
 	  SAFE_ALLOCA (str, unsigned char *, nbytes);
-	  bcopy (SDATA (array), str, nbytes);
+	  memcpy (str, SDATA (array), nbytes);
 	  allocate_string_data (XSTRING (array), nchars,
 				nbytes + new_bytes - prev_bytes);
-	  bcopy (str, SDATA (array), idxval_byte);
+	  memcpy (SDATA (array), str, idxval_byte);
 	  p1 = SDATA (array) + idxval_byte;
-	  bcopy (str + idxval_byte + prev_bytes, p1 + new_bytes,
-		 nbytes - (idxval_byte + prev_bytes));
+	  memcpy (p1 + new_bytes, str + idxval_byte + prev_bytes,
+		  nbytes - (idxval_byte + prev_bytes));
 	  SAFE_FREE ();
 	  clear_string_char_byte_cache ();
 	}
--- a/src/dired.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/dired.c	Thu Jul 08 11:50:25 2010 +0000
@@ -289,15 +289,14 @@
 		  int nchars;
 
 		  fullname = make_uninit_multibyte_string (nbytes, nbytes);
-		  bcopy (SDATA (directory), SDATA (fullname),
-			 directory_nbytes);
+		  memcpy (SDATA (fullname), SDATA (directory),
+			  directory_nbytes);
 
 		  if (needsep)
 		    SSET (fullname, directory_nbytes, DIRECTORY_SEP);
 
-		  bcopy (SDATA (name),
-			 SDATA (fullname) + directory_nbytes + needsep,
-			 len);
+		  memcpy (SDATA (fullname) + directory_nbytes + needsep,
+			  SDATA (name), len);
 
 		  nchars = chars_in_text (SDATA (fullname), nbytes);
 
@@ -857,11 +856,11 @@
   _djstat_flags = _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;
 #endif /* MSDOS */
 
-  bcopy (SDATA (dirname), fullname, pos);
+  memcpy (fullname, SDATA (dirname), pos);
   if (!IS_DIRECTORY_SEP (fullname[pos - 1]))
     fullname[pos++] = DIRECTORY_SEP;
 
-  bcopy (dp->d_name, fullname + pos, len);
+  memcpy (fullname + pos, dp->d_name, len);
   fullname[pos + len] = 0;
 
 #ifdef S_IFLNK
--- a/src/dispnew.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/dispnew.c	Thu Jul 08 11:50:25 2010 +0000
@@ -436,62 +436,15 @@
 #endif /* GLYPH_DEBUG == 0 */
 
 
-/* Like bcopy except never gets confused by overlap.  Let this be the
-   first function defined in this file, or change emacs.c where the
-   address of this function is used.  */
+#ifdef PROFILING
+/* FIXME: only used to find text start for profiling.  */
 
 void
 safe_bcopy (const char *from, char *to, int size)
 {
-  if (size <= 0 || from == to)
-    return;
-
-  /* If the source and destination don't overlap, then bcopy can
-     handle it.  If they do overlap, but the destination is lower in
-     memory than the source, we'll assume bcopy can handle that.  */
-  if (to < from || from + size <= to)
-    bcopy (from, to, size);
-
-  /* Otherwise, we'll copy from the end.  */
-  else
-    {
-      register const char *endf = from + size;
-      register char *endt = to + size;
-
-      /* If TO - FROM is large, then we should break the copy into
-	 nonoverlapping chunks of TO - FROM bytes each.  However, if
-	 TO - FROM is small, then the bcopy function call overhead
-	 makes this not worth it.  The crossover point could be about
-	 anywhere.  Since I don't think the obvious copy loop is too
-	 bad, I'm trying to err in its favor.  */
-      if (to - from < 64)
-	{
-	  do
-	    *--endt = *--endf;
-	  while (endf != from);
-	}
-      else
-	{
-	  for (;;)
-	    {
-	      endt -= (to - from);
-	      endf -= (to - from);
-
-	      if (endt < to)
-		break;
-
-	      bcopy (endf, endt, to - from);
-	    }
-
-	  /* If SIZE wasn't a multiple of TO - FROM, there will be a
-	     little left over.  The amount left over is (endt + (to -
-	     from)) - to, which is endt - from.  */
-	  bcopy (from, to, endt - from);
-	}
-    }
+  abort ();
 }
-
-
+#endif
 
 /***********************************************************************
 			    Glyph Matrices
@@ -510,7 +463,7 @@
 
   /* Allocate and clear.  */
   result = (struct glyph_matrix *) xmalloc (sizeof *result);
-  bzero (result, sizeof *result);
+  memset (result, 0, sizeof *result);
 
   /* Increment number of allocated matrices.  This count is used
      to detect memory leaks.  */
@@ -655,8 +608,8 @@
       int size = dim.height * sizeof (struct glyph_row);
       new_rows = dim.height - matrix->rows_allocated;
       matrix->rows = (struct glyph_row *) xrealloc (matrix->rows, size);
-      bzero (matrix->rows + matrix->rows_allocated,
-	     new_rows * sizeof *matrix->rows);
+      memset (matrix->rows + matrix->rows_allocated, 0,
+	      new_rows * sizeof *matrix->rows);
       matrix->rows_allocated = dim.height;
     }
   else
@@ -1103,7 +1056,7 @@
 	 returned by xmalloc.  If flickering happens again, activate
 	 the code below.  If the flickering is gone with that, chances
 	 are that the flickering has the same reason as here.  */
-  bzero (p[0], (char *) p[LAST_AREA] - (char *) p[0]);
+  memset (p[0], 0, (char *) p[LAST_AREA] - (char *) p[0]);
 #endif
 }
 
@@ -1237,13 +1190,13 @@
   struct glyph *pointers[1 + LAST_AREA];
 
   /* Save glyph pointers of TO.  */
-  bcopy (to->glyphs, pointers, sizeof to->glyphs);
+  memcpy (pointers, to->glyphs, sizeof to->glyphs);
 
   /* Do a structure assignment.  */
   *to = *from;
 
   /* Restore original pointers of TO.  */
-  bcopy (pointers, to->glyphs, sizeof to->glyphs);
+  memcpy (to->glyphs, pointers, sizeof to->glyphs);
 }
 
 
@@ -1264,8 +1217,8 @@
   /* Copy glyphs from FROM to TO.  */
   for (area = 0; area < LAST_AREA; ++area)
     if (from->used[area])
-      bcopy (from->glyphs[area], to->glyphs[area],
-	     from->used[area] * sizeof (struct glyph));
+      memcpy (to->glyphs[area], from->glyphs[area],
+	      from->used[area] * sizeof (struct glyph));
 
   /* Increment buffer positions in TO by DELTA.  */
   increment_row_positions (to, delta, delta_bytes);
@@ -1524,7 +1477,7 @@
 
   /* Allocate a new glyph_pool and clear it.  */
   result = (struct glyph_pool *) xmalloc (sizeof *result);
-  bzero (result, sizeof *result);
+  memset (result, 0, sizeof *result);
 
   /* For memory leak and double deletion checking.  */
   ++glyph_pool_count;
@@ -1585,7 +1538,7 @@
       else
 	{
 	  pool->glyphs = (struct glyph *) xmalloc (size);
-	  bzero (pool->glyphs, size);
+	  memset (pool->glyphs, 0, size);
 	}
 
       pool->nglyphs = needed;
@@ -2196,11 +2149,11 @@
   struct glyph_matrix *saved;
 
   saved = (struct glyph_matrix *) xmalloc (sizeof *saved);
-  bzero (saved, sizeof *saved);
+  memset (saved, 0, sizeof *saved);
   saved->nrows = f->current_matrix->nrows;
   saved->rows = (struct glyph_row *) xmalloc (saved->nrows
 					      * sizeof *saved->rows);
-  bzero (saved->rows, saved->nrows * sizeof *saved->rows);
+  memset (saved->rows, 0, saved->nrows * sizeof *saved->rows);
 
   for (i = 0; i < saved->nrows; ++i)
     {
@@ -2208,7 +2161,7 @@
       struct glyph_row *to = saved->rows + i;
       size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
       to->glyphs[TEXT_AREA] = (struct glyph *) xmalloc (nbytes);
-      bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes);
+      memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes);
       to->used[TEXT_AREA] = from->used[TEXT_AREA];
     }
 
@@ -2229,7 +2182,7 @@
       struct glyph_row *from = saved->rows + i;
       struct glyph_row *to = f->current_matrix->rows + i;
       size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
-      bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes);
+      memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes);
       to->used[TEXT_AREA] = from->used[TEXT_AREA];
       xfree (from->glyphs[TEXT_AREA]);
     }
@@ -2740,9 +2693,9 @@
       if (current_row_p)
 	{
 	  /* Copy window row to frame row.  */
-	  bcopy (window_row->glyphs[0],
-		 frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x,
-		 window_matrix->matrix_w * sizeof (struct glyph));
+	  memcpy (frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x,
+		  window_row->glyphs[0],
+		  window_matrix->matrix_w * sizeof (struct glyph));
 	}
       else
 	{
@@ -2979,7 +2932,7 @@
 
   /* Make a copy of the original rows.  */
   old_rows = (struct glyph_row *) alloca (nlines * sizeof *old_rows);
-  bcopy (new_rows, old_rows, nlines * sizeof *old_rows);
+  memcpy (old_rows, new_rows, nlines * sizeof *old_rows);
 
   /* Assign new rows, maybe clear lines.  */
   for (i = 0; i < nlines; ++i)
@@ -3097,7 +3050,7 @@
 
 	  /* Make a copy of the original rows of matrix m.  */
 	  old_rows = (struct glyph_row *) alloca (m->nrows * sizeof *old_rows);
-	  bcopy (m->rows, old_rows, m->nrows * sizeof *old_rows);
+	  memcpy (old_rows, m->rows, m->nrows * sizeof *old_rows);
 
 	  for (i = 0; i < nlines; ++i)
 	    {
@@ -4563,7 +4516,7 @@
       row_table_size = next_almost_prime (3 * n);
       nbytes = row_table_size * sizeof *row_table;
       row_table = (struct row_entry **) xrealloc (row_table, nbytes);
-      bzero (row_table, nbytes);
+      memset (row_table, 0, nbytes);
     }
 
   if (n > row_entry_pool_size)
--- a/src/doc.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/doc.c	Thu Jul 08 11:50:25 2010 +0000
@@ -686,7 +686,7 @@
 	}
       pos += end - buf;
       filled -= end - buf;
-      bcopy (end, buf, filled);
+      memcpy (buf, end, filled);
     }
   emacs_close (fd);
   return Qnil;
@@ -765,7 +765,7 @@
 	      if (len == 1)
 		*bufp = *strp;
 	      else
-		bcopy (strp, bufp, len);
+		memcpy (bufp, strp, len);
 	      strp += len;
 	      bufp += len;
 	      nchars++;
@@ -817,7 +817,7 @@
 	      int offset = bufp - buf;
 	      buf = (unsigned char *) xrealloc (buf, bsize += 4);
 	      bufp = buf + offset;
-	      bcopy ("M-x ", bufp, 4);
+	      memcpy (bufp, "M-x ", 4);
 	      bufp += 4;
 	      nchars += 4;
 	      if (multibyte)
@@ -911,7 +911,7 @@
 	    int offset = bufp - buf;
 	    buf = (unsigned char *) xrealloc (buf, bsize += length_byte);
 	    bufp = buf + offset;
-	    bcopy (start, bufp, length_byte);
+	    memcpy (bufp, start, length_byte);
 	    bufp += length_byte;
 	    nchars += length;
 	    /* Check STRING again in case gc relocated it.  */
@@ -928,7 +928,7 @@
 	  if (len == 1)
 	    *bufp = *strp;
 	  else
-	    bcopy (strp, bufp, len);
+	    memcpy (bufp, strp, len);
 	  strp += len;
 	  bufp += len;
 	  nchars++;
--- a/src/doprnt.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/doprnt.c	Thu Jul 08 11:50:25 2010 +0000
@@ -229,12 +229,12 @@
 		  /* Truncate the string at character boundary.  */
 		  tem = bufsize;
 		  while (!CHAR_HEAD_P (string[tem - 1])) tem--;
-		  bcopy (string, bufptr, tem);
+		  memcpy (bufptr, string, tem);
 		  /* We must calculate WIDTH again.  */
 		  width = strwidth (bufptr, tem);
 		}
 	      else
-		bcopy (string, bufptr, tem);
+		memcpy (bufptr, string, tem);
 	      bufptr += tem;
 	      bufsize -= tem;
 	      if (minlen < 0)
--- a/src/dosfns.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/dosfns.c	Thu Jul 08 11:50:25 2010 +0000
@@ -283,7 +283,7 @@
 #endif /* !HAVE_X_WINDOWS */
 
 void
-init_dosfns ()
+init_dosfns (void)
 {
   union REGS regs;
   _go32_dpmi_registers dpmiregs;
@@ -481,9 +481,7 @@
    sets the name in the frame struct, but has no other effects.  */
 
 void
-x_set_title (f, name)
-     struct frame *f;
-     Lisp_Object name;
+x_set_title (struct frame *f, Lisp_Object name)
 {
   /* Don't change the title if it's already NAME.  */
   if (EQ (name, f->title))
@@ -536,7 +534,7 @@
    (There are no other processes on DOS, right?)  */
 
 Lisp_Object
-list_system_processes ()
+list_system_processes (void)
 {
   Lisp_Object proclist = Qnil;
 
@@ -689,7 +687,8 @@
 /*
  *	Define everything
  */
-syms_of_dosfns ()
+void
+syms_of_dosfns (void)
 {
   defsubr (&Sint86);
   defsubr (&Sdos_memget);
--- a/src/editfns.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/editfns.c	Thu Jul 08 11:50:25 2010 +0000
@@ -1405,7 +1405,7 @@
 
       login = Fuser_login_name (make_number (pw->pw_uid));
       r = (unsigned char *) alloca (strlen (p) + SCHARS (login) + 1);
-      bcopy (p, r, q - p);
+      memcpy (r, p, q - p);
       r[q - p] = 0;
       strcat (r, SDATA (login));
       r[q - p] = UPCASE (r[q - p]);
@@ -2418,8 +2418,7 @@
     result = make_uninit_multibyte_string (end - start, end_byte - start_byte);
   else
     result = make_uninit_string (end - start);
-  bcopy (BYTE_POS_ADDR (start_byte), SDATA (result),
-	 end_byte - start_byte);
+  memcpy (SDATA (result), BYTE_POS_ADDR (start_byte), end_byte - start_byte);
 
   /* If desired, update and copy the text properties.  */
   if (props)
@@ -3437,7 +3436,7 @@
 	  message_length = SBYTES (val);
 	  message_text = (char *)xrealloc (message_text, message_length);
 	}
-      bcopy (SDATA (val), message_text, SBYTES (val));
+      memcpy (message_text, SDATA (val), SBYTES (val));
       message2 (message_text, SBYTES (val),
 		STRING_MULTIBYTE (val));
       return val;
@@ -3654,12 +3653,12 @@
     int i;
     if (!info)
       info = (struct info *) alloca (nbytes);
-    bzero (info, nbytes);
+    memset (info, 0, nbytes);
     for (i = 0; i <= nargs; i++)
       info[i].start = -1;
     if (!discarded)
       SAFE_ALLOCA (discarded, char *, SBYTES (args[0]));
-    bzero (discarded, SBYTES (args[0]));
+    memset (discarded, 0, SBYTES (args[0]));
   }
 
   /* Add to TOTAL enough space to hold the converted arguments.  */
@@ -3973,8 +3972,8 @@
 	    {
 	      int this_nchars;
 
-	      bcopy (this_format_start, this_format,
-		     format - this_format_start);
+	      memcpy (this_format, this_format_start,
+		      format - this_format_start);
 	      this_format[format - this_format_start] = 0;
 
 	      if (format[-1] == 'e' || format[-1] == 'f' || format[-1] == 'g')
@@ -4451,9 +4450,9 @@
 	  start1_addr = BYTE_POS_ADDR (start1_byte);
 	  start2_addr = BYTE_POS_ADDR (start2_byte);
 
-          bcopy (start2_addr, temp, len2_byte);
-          bcopy (start1_addr, start1_addr + len2_byte, len1_byte);
-          bcopy (temp, start1_addr, len2_byte);
+          memcpy (temp, start2_addr, len2_byte);
+          memcpy (start1_addr + len2_byte, start1_addr, len1_byte);
+          memcpy (start1_addr, temp, len2_byte);
 	  SAFE_FREE ();
         }
       else
@@ -4464,9 +4463,9 @@
 	  SAFE_ALLOCA (temp, unsigned char *, len1_byte);
 	  start1_addr = BYTE_POS_ADDR (start1_byte);
 	  start2_addr = BYTE_POS_ADDR (start2_byte);
-          bcopy (start1_addr, temp, len1_byte);
-          bcopy (start2_addr, start1_addr, len2_byte);
-          bcopy (temp, start1_addr + len2_byte, len1_byte);
+          memcpy (temp, start1_addr, len1_byte);
+          memcpy (start1_addr, start2_addr, len2_byte);
+          memcpy (start1_addr + len2_byte, temp, len1_byte);
 	  SAFE_FREE ();
         }
       graft_intervals_into_buffer (tmp_interval1, start1 + len2,
@@ -4504,9 +4503,9 @@
 	  SAFE_ALLOCA (temp, unsigned char *, len1_byte);
 	  start1_addr = BYTE_POS_ADDR (start1_byte);
 	  start2_addr = BYTE_POS_ADDR (start2_byte);
-          bcopy (start1_addr, temp, len1_byte);
-          bcopy (start2_addr, start1_addr, len2_byte);
-          bcopy (temp, start2_addr, len1_byte);
+          memcpy (temp, start1_addr, len1_byte);
+          memcpy (start1_addr, start2_addr, len2_byte);
+          memcpy (start2_addr, temp, len1_byte);
 	  SAFE_FREE ();
 
           graft_intervals_into_buffer (tmp_interval1, start2,
@@ -4534,10 +4533,10 @@
 	  SAFE_ALLOCA (temp, unsigned char *, len2_byte);
 	  start1_addr = BYTE_POS_ADDR (start1_byte);
 	  start2_addr = BYTE_POS_ADDR (start2_byte);
-          bcopy (start2_addr, temp, len2_byte);
-          bcopy (start1_addr, start1_addr + len_mid + len2_byte, len1_byte);
-          safe_bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid);
-          bcopy (temp, start1_addr, len2_byte);
+          memcpy (temp, start2_addr, len2_byte);
+          memcpy (start1_addr + len_mid + len2_byte, start1_addr, len1_byte);
+          memmove (start1_addr + len2_byte, start1_addr + len1_byte, len_mid);
+          memcpy (start1_addr, temp, len2_byte);
 	  SAFE_FREE ();
 
           graft_intervals_into_buffer (tmp_interval1, end2 - len1,
@@ -4567,10 +4566,10 @@
 	  SAFE_ALLOCA (temp, unsigned char *, len1_byte);
 	  start1_addr = BYTE_POS_ADDR (start1_byte);
 	  start2_addr = BYTE_POS_ADDR (start2_byte);
-          bcopy (start1_addr, temp, len1_byte);
-          bcopy (start2_addr, start1_addr, len2_byte);
-          bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid);
-          bcopy (temp, start1_addr + len2_byte + len_mid, len1_byte);
+          memcpy (temp, start1_addr, len1_byte);
+          memcpy (start1_addr, start2_addr, len2_byte);
+          memcpy (start1_addr + len2_byte, start1_addr + len1_byte, len_mid);
+          memcpy (start1_addr + len2_byte + len_mid, temp, len1_byte);
 	  SAFE_FREE ();
 
           graft_intervals_into_buffer (tmp_interval1, end2 - len1,
--- a/src/emacs.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/emacs.c	Thu Jul 08 11:50:25 2010 +0000
@@ -1761,13 +1761,14 @@
       extern char etext;
 #endif
       extern void safe_bcopy ();
-      extern void dump_opcode_frequencies ();
 
       atexit (_mcleanup);
       /* This uses safe_bcopy because that function comes first in the
 	 Emacs executable.  It might be better to use something that
 	 gives the start of the text segment, but start_of_text is not
 	 defined on all systems now.  */
+      /* FIXME: Does not work on architectures with function
+	 descriptors.  */
       monstartup (safe_bcopy, &etext);
     }
   else
@@ -2058,7 +2059,7 @@
   while (to < argc)
     new[to++] = 0;
 
-  bcopy (new, argv, sizeof (char *) * argc);
+  memcpy (argv, new, sizeof (char *) * argc);
 
   xfree (options);
   xfree (new);
--- a/src/eval.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/eval.c	Thu Jul 08 11:50:25 2010 +0000
@@ -2529,7 +2529,7 @@
       gcpro1.nvars = 1 + numargs;
     }
 
-  bcopy (args, funcall_args, nargs * sizeof (Lisp_Object));
+  memcpy (funcall_args, args, nargs * sizeof (Lisp_Object));
   /* Spread the last arg we got.  Its first element goes in
      the slot that it used to occupy, hence this value of I.  */
   i = nargs - 1;
@@ -3018,7 +3018,7 @@
       if (XSUBR (fun)->max_args > numargs)
 	{
 	  internal_args = (Lisp_Object *) alloca (XSUBR (fun)->max_args * sizeof (Lisp_Object));
-	  bcopy (args + 1, internal_args, numargs * sizeof (Lisp_Object));
+	  memcpy (internal_args, args + 1, numargs * sizeof (Lisp_Object));
 	  for (i = numargs; i < XSUBR (fun)->max_args; i++)
 	    internal_args[i] = Qnil;
 	}
--- a/src/fileio.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/fileio.c	Thu Jul 08 11:50:25 2010 +0000
@@ -425,7 +425,7 @@
   filename = FILE_SYSTEM_CASE (filename);
 #ifdef DOS_NT
   beg = (unsigned char *) alloca (SBYTES (filename) + 1);
-  bcopy (SDATA (filename), beg, SBYTES (filename) + 1);
+  memcpy (beg, SDATA (filename), SBYTES (filename) + 1);
 #else
   beg = SDATA (filename);
 #endif
@@ -725,10 +725,10 @@
   if (!STRING_MULTIBYTE (prefix))
     STRING_SET_UNIBYTE (val);
   data = SDATA (val);
-  bcopy(SDATA (prefix), data, len);
+  memcpy (data, SDATA (prefix), len);
   p = data + len;
 
-  bcopy (pidbuf, p, pidlen);
+  memcpy (p, pidbuf, pidlen);
   p += pidlen;
 
   /* Here we try to minimize useless stat'ing when this function is
@@ -939,7 +939,7 @@
 
   /* Make a local copy of nm[] to protect it from GC in DECODE_FILE below. */
   nm = (unsigned char *) alloca (SBYTES (name) + 1);
-  bcopy (SDATA (name), nm, SBYTES (name) + 1);
+  memcpy (nm, SDATA (name), SBYTES (name) + 1);
 
 #ifdef DOS_NT
   /* Note if special escape prefix is present, but remove for now.  */
@@ -1093,7 +1093,7 @@
 	  unsigned char *o, *p;
 	  for (p = nm; *p && (!IS_DIRECTORY_SEP (*p)); p++);
 	  o = alloca (p - nm + 1);
-	  bcopy ((char *) nm, o, p - nm);
+	  memcpy (o, nm, p - nm);
 	  o [p - nm] = 0;
 
 	  BLOCK_INPUT;
@@ -1244,7 +1244,7 @@
 	  )
 	{
 	  unsigned char *temp = (unsigned char *) alloca (length);
-	  bcopy (newdir, temp, length - 1);
+	  memcpy (temp, newdir, length - 1);
 	  temp[length - 1] = 0;
 	  newdir = temp;
 	}
@@ -1467,7 +1467,7 @@
 	int len = ptr ? ptr - user : strlen (user);
 	/* Copy the user name into temp storage. */
 	o = (unsigned char *) alloca (len + 1);
-	bcopy ((char *) user, o, len);
+	memcpy (o, user, len);
 	o[len] = 0;
 
 	/* Look up the user name. */
@@ -1583,7 +1583,7 @@
 	    {
 	      unsigned char *o = alloca (s - p + 1);
 	      struct passwd *pw;
-	      bcopy (p, o, s - p);
+	      memcpy (o, p, s - p);
 	      o [s - p] = 0;
 
 	      /* If we have ~user and `user' exists, discard
@@ -1640,7 +1640,7 @@
      decode of environment variables, causing the original Lisp_String
      data to be relocated.  */
   nm = (unsigned char *) alloca (SBYTES (filename) + 1);
-  bcopy (SDATA (filename), nm, SBYTES (filename) + 1);
+  memcpy (nm, SDATA (filename), SBYTES (filename) + 1);
 
 #ifdef DOS_NT
   dostounix_filename (nm);
@@ -2733,7 +2733,7 @@
     {
       bufsize *= 2;
       buf = (char *) xrealloc (buf, bufsize);
-      bzero (buf, bufsize);
+      memset (buf, 0, bufsize);
 
       errno = 0;
       valsize = readlink (SDATA (filename), buf, bufsize);
@@ -3837,7 +3837,7 @@
 				  conversion_buffer);
 	  unprocessed = coding.carryover_bytes;
 	  if (coding.carryover_bytes > 0)
-	    bcopy (coding.carryover, read_buf, unprocessed);
+	    memcpy (read_buf, coding.carryover, unprocessed);
 	}
       UNGCPRO;
       emacs_close (fd);
@@ -5245,7 +5245,7 @@
   GCPRO1 (msg);
   nbytes = SBYTES (msg);
   SAFE_ALLOCA (msgbuf, char *, nbytes);
-  bcopy (SDATA (msg), msgbuf, nbytes);
+  memcpy (msgbuf, SDATA (msg), nbytes);
 
   for (i = 0; i < 3; ++i)
     {
--- a/src/filelock.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/filelock.c	Thu Jul 08 11:50:25 2010 +0000
@@ -34,9 +34,7 @@
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
-#ifdef HAVE_STRING_H
 #include <string.h>
-#endif
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
--- a/src/filemode.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/filemode.c	Thu Jul 08 11:50:25 2010 +0000
@@ -17,10 +17,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
    USA.  */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
-
 #include <sys/types.h>
 #include <sys/stat.h>
 
--- a/src/fns.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/fns.c	Thu Jul 08 11:50:25 2010 +0000
@@ -233,7 +233,7 @@
 
   if (SCHARS (s1) != SCHARS (s2)
       || SBYTES (s1) != SBYTES (s2)
-      || bcmp (SDATA (s1), SDATA (s2), SBYTES (s1)))
+      || memcmp (SDATA (s1), SDATA (s2), SBYTES (s1)))
     return Qnil;
   return Qt;
 }
@@ -469,8 +469,8 @@
 	   / BOOL_VECTOR_BITS_PER_CHAR);
 
       val = Fmake_bool_vector (Flength (arg), Qnil);
-      bcopy (XBOOL_VECTOR (arg)->data, XBOOL_VECTOR (val)->data,
-	     size_in_chars);
+      memcpy (XBOOL_VECTOR (val)->data, XBOOL_VECTOR (arg)->data,
+	      size_in_chars);
       return val;
     }
 
@@ -637,8 +637,7 @@
 	{
 	  int thislen_byte = SBYTES (this);
 
-	  bcopy (SDATA (this), SDATA (val) + toindex_byte,
-		 SBYTES (this));
+	  memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this));
 	  if (! NULL_INTERVAL_P (STRING_INTERVALS (this)))
 	    {
 	      textprops[num_textprops].argnum = argnum;
@@ -953,7 +952,7 @@
     return make_multibyte_string (SDATA (string), nbytes, nbytes);
 
   SAFE_ALLOCA (buf, unsigned char *, nbytes);
-  bcopy (SDATA (string), buf, SBYTES (string));
+  memcpy (buf, SDATA (string), SBYTES (string));
   str_to_multibyte (buf, nbytes, SBYTES (string));
 
   ret = make_multibyte_string (buf, SCHARS (string), nbytes);
@@ -1039,7 +1038,7 @@
       int bytes = SBYTES (string);
       unsigned char *str = (unsigned char *) xmalloc (bytes);
 
-      bcopy (SDATA (string), str, bytes);
+      memcpy (str, SDATA (string), bytes);
       bytes = str_as_unibyte (str, bytes);
       string = make_unibyte_string (str, bytes);
       xfree (str);
@@ -1076,8 +1075,7 @@
 			      SBYTES (string),
 			      &nchars, &nbytes);
       new_string = make_uninit_multibyte_string (nchars, nbytes);
-      bcopy (SDATA (string), SDATA (new_string),
-	     SBYTES (string));
+      memcpy (SDATA (new_string), SDATA (string), SBYTES (string));
       if (nbytes != SBYTES (string))
 	str_as_multibyte (SDATA (new_string), nbytes,
 			  SBYTES (string), NULL);
@@ -2170,8 +2168,8 @@
 
 	    if (XBOOL_VECTOR (o1)->size != XBOOL_VECTOR (o2)->size)
 	      return 0;
-	    if (bcmp (XBOOL_VECTOR (o1)->data, XBOOL_VECTOR (o2)->data,
-		      size_in_chars))
+	    if (memcmp (XBOOL_VECTOR (o1)->data, XBOOL_VECTOR (o2)->data,
+			size_in_chars))
 	      return 0;
 	    return 1;
 	  }
@@ -2205,8 +2203,7 @@
 	return 0;
       if (SBYTES (o1) != SBYTES (o2))
 	return 0;
-      if (bcmp (SDATA (o1), SDATA (o2),
-		SBYTES (o1)))
+      if (memcmp (SDATA (o1), SDATA (o2), SBYTES (o1)))
 	return 0;
       if (props && !compare_string_intervals (o1, o2))
 	return 0;
@@ -2304,7 +2301,7 @@
   int len;
   CHECK_STRING (string);
   len = SBYTES (string);
-  bzero (SDATA (string), len);
+  memset (SDATA (string), 0, len);
   STRING_SET_CHARS (string, len);
   STRING_SET_UNIBYTE (string);
   return Qnil;
@@ -3709,8 +3706,7 @@
   xassert (new_size >= old_size);
 
   v = allocate_vector (new_size);
-  bcopy (XVECTOR (vec)->contents, v->contents,
-	 old_size * sizeof *v->contents);
+  memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents);
   for (i = old_size; i < new_size; ++i)
     v->contents[i] = init;
   XSETVECTOR (vec, v);
@@ -3947,7 +3943,7 @@
 
   h2 = allocate_hash_table ();
   next = h2->vec_next;
-  bcopy (h1, h2, sizeof *h2);
+  memcpy (h2, h1, sizeof *h2);
   h2->vec_next = next;
   h2->key_and_value = Fcopy_sequence (h1->key_and_value);
   h2->hash = Fcopy_sequence (h1->hash);
@@ -4553,7 +4549,7 @@
   /* The vector `used' is used to keep track of arguments that
      have been consumed.  */
   used = (char *) alloca (nargs * sizeof *used);
-  bzero (used, nargs * sizeof *used);
+  memset (used, 0, nargs * sizeof *used);
 
   /* See if there's a `:test TEST' among the arguments.  */
   i = get_key_arg (QCtest, nargs, args, used);
--- a/src/fringe.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/fringe.c	Thu Jul 08 11:50:25 2010 +0000
@@ -1493,7 +1493,7 @@
   xfb = (struct fringe_bitmap *) xmalloc (sizeof fb
 					  + fb.height * BYTES_PER_BITMAP_ROW);
   fb.bits = b = (unsigned short *) (xfb + 1);
-  bzero (b, fb.height);
+  memset (b, 0, fb.height);
 
   j = 0;
   while (j < fb.height)
--- a/src/ftfont.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/ftfont.c	Thu Jul 08 11:50:25 2010 +0000
@@ -1365,7 +1365,7 @@
   if (ftfont_info->ft_size != ft_face->size)
     FT_Activate_Size (ftfont_info->ft_size);
   if (metrics)
-    bzero (metrics, sizeof (struct font_metrics));
+    memset (metrics, 0, sizeof (struct font_metrics));
   for (i = 0, first = 1; i < nglyphs; i++)
     {
       if (FT_Load_Glyph (ft_face, code[i], FT_LOAD_DEFAULT) == 0)
--- a/src/getloadavg.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/getloadavg.c	Thu Jul 08 11:50:25 2010 +0000
@@ -713,7 +713,7 @@
       for (i = 0; i < conf.config_maxclass; ++i)
 	{
 	  struct class_stats stats;
-	  bzero ((char *) &stats, sizeof stats);
+	  memset (&stats, 0, sizeof stats);
 
 	  desc.sd_type = CPUTYPE_CLASS;
 	  desc.sd_objid = i;
--- a/src/image.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/image.c	Thu Jul 08 11:50:25 2010 +0000
@@ -625,7 +625,7 @@
       /* Make a copy of TYPE to avoid a bus error in a dumped Emacs.
          The initialized data segment is read-only.  */
       struct image_type *p = (struct image_type *) xmalloc (sizeof *p);
-      bcopy (type, p, sizeof *p);
+      memcpy (p, type, sizeof *p);
       p->next = image_types;
       image_types = p;
       success = Qt;
@@ -1020,7 +1020,7 @@
   Lisp_Object file = image_spec_value (spec, QCfile, NULL);
 
   xassert (valid_image_p (spec));
-  bzero (img, sizeof *img);
+  memset (img, 0, sizeof *img);
   img->dependencies = NILP (file) ? Qnil : list1 (file);
   img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
   xassert (img->type != NULL);
@@ -1424,12 +1424,12 @@
   struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c);
   int size;
 
-  bzero (c, sizeof *c);
+  memset (c, 0, sizeof *c);
   c->size = 50;
   c->images = (struct image **) xmalloc (c->size * sizeof *c->images);
   size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
   c->buckets = (struct image **) xmalloc (size);
-  bzero (c->buckets, size);
+  memset (c->buckets, 0, size);
   return c;
 }
 
@@ -2048,8 +2048,8 @@
       return 0;
     }
 
-  header = &((*ximg)->info.bmiHeader);
-  bzero (&((*ximg)->info), sizeof (BITMAPINFO));
+  header = &(*ximg)->info.bmiHeader;
+  memset (&(*ximg)->info, 0, sizeof (BITMAPINFO));
   header->biSize = sizeof (*header);
   header->biWidth = width;
   header->biHeight = -height;  /* negative indicates a top-down bitmap.  */
@@ -2353,7 +2353,7 @@
 {
   struct image_keyword kw[XBM_LAST];
 
-  bcopy (xbm_format, kw, sizeof kw);
+  memcpy (kw, xbm_format, sizeof kw);
   if (!parse_image_spec (object, kw, XBM_LAST, Qxbm))
     return 0;
 
@@ -2543,7 +2543,7 @@
   w1 = (width + 7) / 8;         /* nb of 8bits elt in X bitmap */
   w2 = ((width + 15) / 16) * 2; /* nb of 16bits elt in W32 bitmap */
   bits = (unsigned char *) alloca (height * w2);
-  bzero (bits, height * w2);
+  memset (bits, 0, height * w2);
   for (i = 0; i < height; i++)
     {
       p = bits + i*w2;
@@ -2918,7 +2918,7 @@
       in_memory_file_p = xbm_file_p (data);
 
       /* Parse the image specification.  */
-      bcopy (xbm_format, fmt, sizeof fmt);
+      memcpy (fmt, xbm_format, sizeof fmt);
       parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm);
       xassert (parsed_p);
 
@@ -2964,9 +2964,9 @@
 		{
 		  Lisp_Object line = XVECTOR (data)->contents[i];
 		  if (STRINGP (line))
-		    bcopy (SDATA (line), p, nbytes);
+		    memcpy (p, SDATA (line), nbytes);
 		  else
-		    bcopy (XBOOL_VECTOR (line)->data, p, nbytes);
+		    memcpy (p, XBOOL_VECTOR (line)->data, nbytes);
 		}
 	    }
 	  else if (STRINGP (data))
@@ -3248,7 +3248,7 @@
      with transparency, and it's useful.  */
   else if (strcmp ("opaque", color_name) == 0)
     {
-      bzero (color, sizeof (XColor));  /* Is this necessary/correct?  */
+      memset (color, 0, sizeof (XColor));  /* Is this necessary/correct?  */
       color->pixel = FRAME_FOREGROUND_PIXEL (f);
       p = xpm_cache_color (f, color_name, color, h);
     }
@@ -3337,7 +3337,7 @@
 xpm_image_p (Lisp_Object object)
 {
   struct image_keyword fmt[XPM_LAST];
-  bcopy (xpm_format, fmt, sizeof fmt);
+  memcpy (fmt, xpm_format, sizeof fmt);
   return (parse_image_spec (object, fmt, XPM_LAST, Qxpm)
 	  /* Either `:file' or `:data' must be present.  */
 	  && fmt[XPM_FILE].count + fmt[XPM_DATA].count == 1
@@ -3358,7 +3358,7 @@
   XpmAttributes attrs;
   Pixmap bitmap, mask;
 
-  bzero (&attrs, sizeof attrs);
+  memset (&attrs, 0, sizeof attrs);
 
   attrs.visual = FRAME_X_VISUAL (f);
   attrs.colormap = FRAME_X_COLORMAP (f);
@@ -3406,7 +3406,7 @@
 
   /* Configure the XPM lib.  Use the visual of frame F.  Allocate
      close colors.  Return colors allocated.  */
-  bzero (&attrs, sizeof attrs);
+  memset (&attrs, 0, sizeof attrs);
 
 #ifndef HAVE_NTGUI
   attrs.visual = FRAME_X_VISUAL (f);
@@ -3453,7 +3453,7 @@
       /* Allocate an XpmColorSymbol array.  */
       size = attrs.numsymbols * sizeof *xpm_syms;
       xpm_syms = (XpmColorSymbol *) alloca (size);
-      bzero (xpm_syms, size);
+      memset (xpm_syms, 0, size);
       attrs.colorsymbols = xpm_syms;
 
       /* Fill the color symbol array.  */
@@ -4152,7 +4152,7 @@
 {
   int size = CT_SIZE * sizeof (*ct_table);
   ct_table = (struct ct_color **) xmalloc (size);
-  bzero (ct_table, size);
+  memset (ct_table, 0, size);
   ct_colors_allocated = 0;
 }
 
@@ -4848,7 +4848,7 @@
   /* Create the bit array serving as mask.  */
   row_width = (img->width + 7) / 8;
   mask_img = xmalloc (row_width * img->height);
-  bzero (mask_img, row_width * img->height);
+  memset (mask_img, 0, row_width * img->height);
 
   /* Create a memory device context for IMG->pixmap.  */
   frame_dc = get_frame_dc (f);
@@ -5000,7 +5000,7 @@
 {
   struct image_keyword fmt[PBM_LAST];
 
-  bcopy (pbm_format, fmt, sizeof fmt);
+  memcpy (fmt, pbm_format, sizeof fmt);
 
   if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm))
     return 0;
@@ -5212,7 +5212,7 @@
       unsigned long bg = FRAME_BACKGROUND_PIXEL (f);
 
       /* Parse the image specification.  */
-      bcopy (pbm_format, fmt, sizeof fmt);
+      memcpy (fmt, pbm_format, sizeof fmt);
       parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm);
 
       /* Get foreground and background colors, maybe allocate colors.  */
@@ -5415,7 +5415,7 @@
 png_image_p (Lisp_Object object)
 {
   struct image_keyword fmt[PNG_LAST];
-  bcopy (png_format, fmt, sizeof fmt);
+  memcpy (fmt, png_format, sizeof fmt);
 
   if (!parse_image_spec (object, fmt, PNG_LAST, Qpng))
     return 0;
@@ -5554,7 +5554,7 @@
   if (length > tbr->len - tbr->index)
     fn_png_error (png_ptr, "Read error");
 
-  bcopy (tbr->bytes + tbr->index, data, length);
+  memcpy (data, tbr->bytes + tbr->index, length);
   tbr->index = tbr->index + length;
 }
 
@@ -5756,7 +5756,7 @@
 	    {
 	      png_color_16 user_bg;
 
-	      bzero (&user_bg, sizeof user_bg);
+	      memset (&user_bg, 0, sizeof user_bg);
 	      user_bg.red = color.red >> shift;
 	      user_bg.green = color.green >> shift;
 	      user_bg.blue = color.blue >> shift;
@@ -5776,7 +5776,7 @@
 	  color.pixel = FRAME_BACKGROUND_PIXEL (f);
 	  x_query_color (f, &color);
 
-	  bzero (&frame_background, sizeof frame_background);
+	  memset (&frame_background, 0, sizeof frame_background);
 	  frame_background.red = color.red >> shift;
 	  frame_background.green = color.green >> shift;
 	  frame_background.blue = color.blue >> shift;
@@ -6005,7 +6005,7 @@
 {
   struct image_keyword fmt[JPEG_LAST];
 
-  bcopy (jpeg_format, fmt, sizeof fmt);
+  memcpy (fmt, jpeg_format, sizeof fmt);
 
   if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg))
     return 0;
@@ -6561,7 +6561,7 @@
 tiff_image_p (Lisp_Object object)
 {
   struct image_keyword fmt[TIFF_LAST];
-  bcopy (tiff_format, fmt, sizeof fmt);
+  memcpy (fmt, tiff_format, sizeof fmt);
 
   if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff))
     return 0;
@@ -6644,7 +6644,7 @@
 
   if (size > src->len - src->index)
     return (size_t) -1;
-  bcopy (src->bytes + src->index, buf, size);
+  memcpy (buf, src->bytes + src->index, size);
   src->index += size;
   return size;
 }
@@ -6999,7 +6999,7 @@
 gif_image_p (Lisp_Object object)
 {
   struct image_keyword fmt[GIF_LAST];
-  bcopy (gif_format, fmt, sizeof fmt);
+  memcpy (fmt, gif_format, sizeof fmt);
 
   if (!parse_image_spec (object, fmt, GIF_LAST, Qgif))
     return 0;
@@ -7086,7 +7086,7 @@
   if (len > src->len - src->index)
     return -1;
 
-  bcopy (src->bytes + src->index, buf, len);
+  memcpy (buf, src->bytes + src->index, len);
   src->index += len;
   return len;
 }
@@ -7222,7 +7222,7 @@
   if (!gif_color_map)
     gif_color_map = gif->SColorMap;
   init_color_table ();
-  bzero (pixel_colors, sizeof pixel_colors);
+  memset (pixel_colors, 0, sizeof pixel_colors);
 
   if (gif_color_map)
     for (i = 0; i < gif_color_map->ColorCount; ++i)
@@ -7432,7 +7432,7 @@
 svg_image_p (Lisp_Object object)
 {
   struct image_keyword fmt[SVG_LAST];
-  bcopy (svg_format, fmt, sizeof fmt);
+  memcpy (fmt, svg_format, sizeof fmt);
 
   if (!parse_image_spec (object, fmt, SVG_LAST, Qsvg))
     return 0;
@@ -7839,7 +7839,7 @@
   Lisp_Object tem;
   int i;
 
-  bcopy (gs_format, fmt, sizeof fmt);
+  memcpy (fmt, gs_format, sizeof fmt);
 
   if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript))
     return 0;
--- a/src/indent.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/indent.c	Thu Jul 08 11:50:25 2010 +0000
@@ -546,7 +546,7 @@
   w = ! NILP (window) ? XWINDOW (window) : NULL;
 
   if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
-  bzero (&cmp_it, sizeof cmp_it);
+  memset (&cmp_it, 0, sizeof cmp_it);
   cmp_it.id = -1;
   composition_compute_stop_pos (&cmp_it, scan, scan_byte, end, Qnil);
 
@@ -1214,7 +1214,7 @@
   pos_byte = prev_pos_byte = CHAR_TO_BYTE (from);
   contin_hpos = 0;
   prev_tab_offset = tab_offset;
-  bzero (&cmp_it, sizeof cmp_it);
+  memset (&cmp_it, 0, sizeof cmp_it);
   cmp_it.id = -1;
   composition_compute_stop_pos (&cmp_it, pos, pos_byte, to, Qnil);
 
--- a/src/insdel.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/insdel.c	Thu Jul 08 11:50:25 2010 +0000
@@ -164,28 +164,9 @@
       /* Move at most 32000 chars before checking again for a quit.  */
       if (i > 32000)
 	i = 32000;
-#ifdef GAP_USE_BCOPY
-      if (i >= 128
-	  /* bcopy is safe if the two areas of memory do not overlap
-	     or on systems where bcopy is always safe for moving upward.  */
-	  && (BCOPY_UPWARD_SAFE
-	      || to - from >= 128))
-	{
-	  /* If overlap is not safe, avoid it by not moving too many
-	     characters at once.  */
-	  if (!BCOPY_UPWARD_SAFE && i > to - from)
-	    i = to - from;
-	  new_s1 -= i;
-	  from -= i, to -= i;
-	  bcopy (from, to, i);
-	}
-      else
-#endif
-	{
-	  new_s1 -= i;
-	  while (--i >= 0)
-	    *--to = *--from;
-	}
+      new_s1 -= i;
+      from -= i, to -= i;
+      memmove (to, from, i);
     }
 
   /* Adjust markers, and buffer data structure, to put the gap at BYTEPOS.
@@ -238,28 +219,9 @@
       /* Move at most 32000 chars before checking again for a quit.  */
       if (i > 32000)
 	i = 32000;
-#ifdef GAP_USE_BCOPY
-      if (i >= 128
-	  /* bcopy is safe if the two areas of memory do not overlap
-	     or on systems where bcopy is always safe for moving downward.  */
-	  && (BCOPY_DOWNWARD_SAFE
-	      || from - to >= 128))
-	{
-	  /* If overlap is not safe, avoid it by not moving too many
-	     characters at once.  */
-	  if (!BCOPY_DOWNWARD_SAFE && i > from - to)
-	    i = from - to;
-	  new_s1 += i;
-	  bcopy (from, to, i);
-	  from += i, to += i;
-	}
-      else
-#endif
-	{
-	  new_s1 += i;
-	  while (--i >= 0)
-	    *to++ = *from++;
-	}
+      new_s1 += i;
+      memmove (to, from, i);
+      from += i, to += i;
     }
 
   adjust_markers_gap_motion (GPT_BYTE + GAP_SIZE, bytepos + GAP_SIZE,
@@ -585,7 +547,7 @@
   /* Pretend that the last unwanted part of the gap is the entire gap,
      and that the first desired part of the gap is part of the buffer
      text.  */
-  bzero (GPT_ADDR, new_gap_size);
+  memset (GPT_ADDR, 0, new_gap_size);
   GPT += new_gap_size;
   GPT_BYTE += new_gap_size;
   Z += new_gap_size;
@@ -636,7 +598,7 @@
 {
   if (from_multibyte == to_multibyte)
     {
-      bcopy (from_addr, to_addr, nbytes);
+      memcpy (to_addr, from_addr, nbytes);
       return nbytes;
     }
   else if (from_multibyte)
@@ -966,7 +928,7 @@
   MODIFF++;
   CHARS_MODIFF = MODIFF;
 
-  bcopy (string, GPT_ADDR, nbytes);
+  memcpy (GPT_ADDR, string, nbytes);
 
   GAP_SIZE -= nbytes;
   GPT += nchars;
@@ -1007,7 +969,7 @@
    copy them into the buffer.
 
    It does not work to use `insert' for this, because a GC could happen
-   before we bcopy the stuff into the buffer, and relocate the string
+   before we copy the stuff into the buffer, and relocate the string
    without insert noticing.  */
 
 void
@@ -1182,7 +1144,7 @@
    into the current buffer.
 
    It does not work to use `insert' for this, because a malloc could happen
-   and relocate BUF's text before the bcopy happens.  */
+   and relocate BUF's text before the copy happens.  */
 
 void
 insert_from_buffer (struct buffer *buf,
@@ -1712,7 +1674,7 @@
     make_gap (insbytes - GAP_SIZE);
 
   /* Copy the replacement text into the buffer.  */
-  bcopy (ins, GPT_ADDR, insbytes);
+  memcpy (GPT_ADDR, ins, insbytes);
 
 #ifdef BYTE_COMBINING_DEBUG
   /* We have copied text into the gap, but we have not marked
--- a/src/intervals.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/intervals.c	Thu Jul 08 11:50:25 2010 +0000
@@ -1558,7 +1558,7 @@
 {
   register INTERVAL t = make_interval ();
 
-  bcopy (source, t, INTERVAL_SIZE);
+  memcpy (t, source, INTERVAL_SIZE);
   copy_properties (source, t);
   SET_INTERVAL_PARENT (t, parent);
   if (! NULL_LEFT_CHILD (source))
@@ -1574,7 +1574,7 @@
 {
   register INTERVAL t = make_interval ();
 
-  bcopy (source, t, INTERVAL_SIZE);
+  memcpy (t, source, INTERVAL_SIZE);
   copy_properties (source, t);
   SET_INTERVAL_OBJECT (t, parent);
   if (! NULL_LEFT_CHILD (source))
--- a/src/keyboard.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/keyboard.c	Thu Jul 08 11:50:25 2010 +0000
@@ -635,6 +635,7 @@
 static void clear_event (struct input_event *);
 static Lisp_Object restore_kboard_configuration (Lisp_Object);
 static SIGTYPE interrupt_signal (int signalnum);
+static SIGTYPE input_available_signal (int signo);
 static void handle_interrupt (void);
 static void timer_start_idle (void);
 static void timer_stop_idle (void);
@@ -715,7 +716,7 @@
 	      ptr = buffer + offset;
 	    }
 
-	  bcopy (text, ptr, len);
+	  memcpy (ptr, text, len);
 	  ptr += len;
 	}
 
@@ -3480,13 +3481,13 @@
 static void
 save_getcjmp (jmp_buf temp)
 {
-  bcopy (getcjmp, temp, sizeof getcjmp);
+  memcpy (temp, getcjmp, sizeof getcjmp);
 }
 
 static void
 restore_getcjmp (jmp_buf temp)
 {
-  bcopy (temp, getcjmp, sizeof getcjmp);
+  memcpy (getcjmp, temp, sizeof getcjmp);
 }
 
 /* Low level keyboard/mouse input.
@@ -3590,6 +3591,18 @@
     return FRAME_KBOARD (XFRAME (frame));
 }
 
+/* Return the number of slots occupied in kbd_buffer.  */
+
+static int
+kbd_buffer_nr_stored ()
+{
+  return kbd_fetch_ptr == kbd_store_ptr
+    ? 0
+    : (kbd_fetch_ptr < kbd_store_ptr
+       ? kbd_store_ptr - kbd_fetch_ptr
+       : ((kbd_buffer + KBD_BUFFER_SIZE) - kbd_fetch_ptr
+          + (kbd_store_ptr - kbd_buffer)));
+}
 
 Lisp_Object Vthrow_on_input;
 
@@ -3662,7 +3675,7 @@
 
 	  if (hold_quit)
 	    {
-	      bcopy (event, (char *) hold_quit, sizeof (*event));
+	      memcpy (hold_quit, event, sizeof (*event));
 	      return;
 	    }
 
@@ -3711,6 +3724,17 @@
     {
       *kbd_store_ptr = *event;
       ++kbd_store_ptr;
+      if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE/2 && ! kbd_on_hold_p ())
+        {
+          /* Don't read keyboard input until we have processed kbd_buffer.
+             This happens when pasting text longer than KBD_BUFFER_SIZE/2.  */
+          hold_keyboard_input ();
+#ifdef SIGIO
+          if (!noninteractive)
+            signal (SIGIO, SIG_IGN);
+#endif
+          stop_polling ();
+        }
     }
 
   /* If we're inside while-no-input, and this event qualifies
@@ -3866,10 +3890,24 @@
    We always read and discard one event.  */
 
 static Lisp_Object
-kbd_buffer_get_event (KBOARD **kbp, int *used_mouse_menu, struct timeval *end_time)
+kbd_buffer_get_event (KBOARD **kbp,
+                      int *used_mouse_menu,
+                      struct timeval *end_time)
 {
   register int c;
   Lisp_Object obj;
+  
+  if (kbd_on_hold_p () && kbd_buffer_nr_stored () < KBD_BUFFER_SIZE/4)
+    {
+      /* Start reading input again, we have processed enough so we can
+         accept new events again.  */
+      unhold_keyboard_input ();
+#ifdef SIGIO
+      if (!noninteractive)
+        signal (SIGIO, input_available_signal);
+#endif /* SIGIO */
+      start_polling ();
+    }
 
   if (noninteractive
       /* In case we are running as a daemon, only do this before
@@ -6298,8 +6336,8 @@
 
     new_name = make_uninit_multibyte_string (mod_len + base_len,
 					     mod_len + base_len_byte);
-    bcopy (new_mods, SDATA (new_name),	       mod_len);
-    bcopy (base,     SDATA (new_name) + mod_len, base_len_byte);
+    memcpy (SDATA (new_name), new_mods, mod_len);
+    memcpy (SDATA (new_name) + mod_len, base, base_len_byte);
 
     return Fintern (new_name, Qnil);
   }
@@ -7039,6 +7077,10 @@
   int n_to_read, i;
   struct tty_display_info *tty = terminal->display_info.tty;
   int nread = 0;
+  int buffer_free = KBD_BUFFER_SIZE - kbd_buffer_nr_stored () - 1;
+
+  if (kbd_on_hold_p () || buffer_free <= 0)
+    return 0;
 
   if (!terminal->name)		/* Don't read from a dead terminal. */
     return 0;
@@ -7120,6 +7162,10 @@
 #endif
 #endif
 
+  /* Don't read more than we can store.  */
+  if (n_to_read > buffer_free)
+    n_to_read = buffer_free;
+
   /* Now read; for one reason or another, this will not block.
      NREAD is set to the number of chars read.  */
   do
@@ -7402,7 +7448,7 @@
 
 	if (nstored == 0)
 	  {
-	    bzero (&buf, sizeof buf);
+	    memset (&buf, 0, sizeof buf);
 	    buf.kind = USER_SIGNAL_EVENT;
 	    buf.frame_or_window = selected_frame;
 	  }
@@ -7506,7 +7552,7 @@
 	nmaps = 0;
 	if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
 	  maps[nmaps++] = tem;
-	bcopy (tmaps, (void *) (maps + nmaps), nminor * sizeof (maps[0]));
+	memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
 	nmaps += nminor;
 	maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
       }
@@ -7547,9 +7593,9 @@
 	    tem2 = XVECTOR (menu_bar_items_vector)->contents[i + 2];
 	    tem3 = XVECTOR (menu_bar_items_vector)->contents[i + 3];
 	    if (end > i + 4)
-	      bcopy (&XVECTOR (menu_bar_items_vector)->contents[i + 4],
-		     &XVECTOR (menu_bar_items_vector)->contents[i],
-		     (end - i - 4) * sizeof (Lisp_Object));
+	      memmove (&XVECTOR (menu_bar_items_vector)->contents[i],
+		       &XVECTOR (menu_bar_items_vector)->contents[i + 4],
+		       (end - i - 4) * sizeof (Lisp_Object));
 	    XVECTOR (menu_bar_items_vector)->contents[end - 4] = tem0;
 	    XVECTOR (menu_bar_items_vector)->contents[end - 3] = tem1;
 	    XVECTOR (menu_bar_items_vector)->contents[end - 2] = tem2;
@@ -7594,9 +7640,9 @@
 	if (EQ (key, XVECTOR (menu_bar_items_vector)->contents[i]))
 	  {
 	    if (menu_bar_items_index > i + 4)
-	      bcopy (&XVECTOR (menu_bar_items_vector)->contents[i + 4],
-		     &XVECTOR (menu_bar_items_vector)->contents[i],
-		     (menu_bar_items_index - i - 4) * sizeof (Lisp_Object));
+	      memmove (&XVECTOR (menu_bar_items_vector)->contents[i],
+		       &XVECTOR (menu_bar_items_vector)->contents[i + 4],
+		       (menu_bar_items_index - i - 4) * sizeof (Lisp_Object));
 	    menu_bar_items_index -= 4;
 	  }
     }
@@ -8044,7 +8090,7 @@
       nmaps = 0;
       if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
 	maps[nmaps++] = tem;
-      bcopy (tmaps, (void *) (maps + nmaps), nminor * sizeof (maps[0]));
+      memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
       nmaps += nminor;
       maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
     }
@@ -8094,9 +8140,9 @@
 	  if (EQ (key, v[TOOL_BAR_ITEM_KEY]))
 	    {
 	      if (ntool_bar_items > i + TOOL_BAR_ITEM_NSLOTS)
-		bcopy (v + TOOL_BAR_ITEM_NSLOTS, v,
-		       ((ntool_bar_items - i - TOOL_BAR_ITEM_NSLOTS)
-			* sizeof (Lisp_Object)));
+		memmove (v, v + TOOL_BAR_ITEM_NSLOTS,
+			 ((ntool_bar_items - i - TOOL_BAR_ITEM_NSLOTS)
+			  * sizeof (Lisp_Object)));
 	      ntool_bar_items -= TOOL_BAR_ITEM_NSLOTS;
 	      break;
 	    }
@@ -8379,7 +8425,7 @@
      tool_bar_items_vector.  */
   to = XVECTOR (tool_bar_items_vector)->contents + ntool_bar_items;
   from = XVECTOR (tool_bar_item_properties)->contents;
-  bcopy (from, to, TOOL_BAR_ITEM_NSLOTS * sizeof *to);
+  memcpy (to, from, TOOL_BAR_ITEM_NSLOTS * sizeof *to);
   ntool_bar_items += TOOL_BAR_ITEM_NSLOTS;
 }
 
@@ -8672,7 +8718,7 @@
 			  thiswidth = SCHARS (desc);
 			  if (thiswidth + i > width)
 			    thiswidth = width - i;
-			  bcopy (SDATA (desc), menu + i, thiswidth);
+			  memcpy (menu + i, SDATA (desc), thiswidth);
 			  i += thiswidth;
 			  strcpy (menu + i, " = ");
 			  i += 3;
@@ -8682,7 +8728,7 @@
 		      thiswidth = SCHARS (s);
 		      if (thiswidth + i > width)
 			thiswidth = width - i;
-		      bcopy (SDATA (s), menu + i, thiswidth);
+		      memcpy (menu + i, SDATA (s), thiswidth);
 		      i += thiswidth;
 		      menu[i] = 0;
 		    }
@@ -9166,8 +9212,7 @@
       if (!NILP (orig_keymap))
 	submaps[nmaps++] = orig_keymap;
 
-      bcopy (maps, (void *) (submaps + nmaps),
-	     nminor * sizeof (submaps[0]));
+      memcpy (submaps + nmaps, maps, nminor * sizeof (submaps[0]));
 
       nmaps += nminor;
 
@@ -10101,7 +10146,7 @@
   specbind (Qinput_method_use_echo_area,
 	    (NILP (command_loop) ? Qt : Qnil));
 
-  bzero (keybuf, sizeof keybuf);
+  memset (keybuf, 0, sizeof keybuf);
   GCPRO1 (keybuf[0]);
   gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0]));
 
@@ -10161,7 +10206,7 @@
   specbind (Qinput_method_use_echo_area,
 	    (NILP (command_loop) ? Qt : Qnil));
 
-  bzero (keybuf, sizeof keybuf);
+  memset (keybuf, 0, sizeof keybuf);
   GCPRO1 (keybuf[0]);
   gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0]));
 
@@ -10551,12 +10596,10 @@
   else
     {
       val = Fvector (NUM_RECENT_KEYS, keys);
-      bcopy (keys + recent_keys_index,
-	     XVECTOR (val)->contents,
-	     (NUM_RECENT_KEYS - recent_keys_index) * sizeof (Lisp_Object));
-      bcopy (keys,
-	     XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index,
-	     recent_keys_index * sizeof (Lisp_Object));
+      memcpy (XVECTOR (val)->contents, keys + recent_keys_index,
+	      (NUM_RECENT_KEYS - recent_keys_index) * sizeof (Lisp_Object));
+      memcpy (XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index,
+	      keys, recent_keys_index * sizeof (Lisp_Object));
       return val;
     }
 }
--- a/src/keymap.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/keymap.c	Thu Jul 08 11:50:25 2010 +0000
@@ -1534,7 +1534,8 @@
 		  {
 		    if (cmm_modes)
 		      {
-			bcopy (cmm_modes, newmodes, cmm_size * sizeof cmm_modes[0]);
+			memcpy (newmodes, cmm_modes,
+				cmm_size * sizeof cmm_modes[0]);
 			free (cmm_modes);
 		      }
 		    cmm_modes = newmodes;
@@ -1545,7 +1546,8 @@
 		  {
 		    if (cmm_maps)
 		      {
-			bcopy (cmm_maps, newmaps, cmm_size * sizeof cmm_maps[0]);
+			memcpy (newmaps, cmm_maps,
+				cmm_size * sizeof cmm_maps[0]);
 			free (cmm_maps);
 		      }
 		    cmm_maps = newmaps;
@@ -3100,12 +3102,12 @@
 	  *p++ = '\f';
 	  *p++ = '\n';
 	  *p++ = '`';
-	  bcopy (SDATA (SYMBOL_NAME (modes[i])), p,
-		 SCHARS (SYMBOL_NAME (modes[i])));
+	  memcpy (p, SDATA (SYMBOL_NAME (modes[i])),
+		  SCHARS (SYMBOL_NAME (modes[i])));
 	  p += SCHARS (SYMBOL_NAME (modes[i]));
 	  *p++ = '\'';
-	  bcopy (" Minor Mode Bindings", p, sizeof (" Minor Mode Bindings") - 1);
-	  p += sizeof (" Minor Mode Bindings") - 1;
+	  memcpy (p, " Minor Mode Bindings", strlen (" Minor Mode Bindings"));
+	  p += strlen (" Minor Mode Bindings");
 	  *p = 0;
 
 	  describe_map_tree (maps[i], 1, shadow, prefix,
--- a/src/lisp.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/lisp.h	Thu Jul 08 11:50:25 2010 +0000
@@ -647,7 +647,7 @@
     (XSTRING (string)->size = (newsize))
 
 #define STRING_COPYIN(string, index, new, count) \
-    bcopy (new, SDATA (string) + index, count)
+    memcpy (SDATA (string) + index, new, count)
 
 /* Type checking.  */
 
@@ -2628,7 +2628,6 @@
 extern Lisp_Object sit_for (Lisp_Object, int, int);
 extern void init_display (void);
 extern void syms_of_display (void);
-extern void safe_bcopy (const char *, char *, int);
 
 /* Defined in xdisp.c */
 extern Lisp_Object Qinhibit_point_motion_hooks;
@@ -3400,6 +3399,18 @@
 extern int emacs_close (int);
 extern int emacs_read (int, char *, unsigned int);
 extern int emacs_write (int, const char *, unsigned int);
+#ifndef HAVE_MEMSET
+extern void *memset P_ ((void *, int, size_t));
+#endif
+#ifndef HAVE_MEMCPY
+extern void *memcpy P_ ((void *, void *, size_t));
+#endif
+#ifndef HAVE_MEMMOVE
+extern void *memmove P_ ((void *, void *, size_t));
+#endif
+#ifndef HAVE_MEMCMP
+extern int memcmp P_ ((void *, void *, size_t));
+#endif
 
 /* Defined in filelock.c */
 EXFUN (Funlock_buffer, 0);
--- a/src/lread.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/lread.c	Thu Jul 08 11:50:25 2010 +0000
@@ -1125,8 +1125,7 @@
   specbind (Qold_style_backquotes, Qnil);
   record_unwind_protect (load_warn_old_style_backquotes, file);
 
-  if (!bcmp (SDATA (found) + SBYTES (found) - 4,
-	     ".elc", 4)
+  if (!memcmp (SDATA (found) + SBYTES (found) - 4, ".elc", 4)
       || (fd >= 0 && (version = safe_to_load_p (fd)) > 0))
     /* Load .elc files directly, but not when they are
        remote and have no handler!  */
@@ -2430,8 +2429,7 @@
 		invalid_syntax ("#&...", 5);
 
 	      val = Fmake_bool_vector (length, Qnil);
-	      bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data,
-		     size_in_chars);
+	      memcpy (XBOOL_VECTOR (val)->data, SDATA (tmp), size_in_chars);
 	      /* Clear the extraneous bits in the last byte.  */
 	      if (XINT (length) != size_in_chars * BOOL_VECTOR_BITS_PER_CHAR)
 		XBOOL_VECTOR (val)->data[size_in_chars - 1]
@@ -3786,7 +3784,7 @@
       {
 	if (SBYTES (SYMBOL_NAME (tail)) == size_byte
 	    && SCHARS (SYMBOL_NAME (tail)) == size
-	    && !bcmp (SDATA (SYMBOL_NAME (tail)), ptr, size_byte))
+	    && !memcmp (SDATA (SYMBOL_NAME (tail)), ptr, size_byte))
 	  return tail;
 	else if (XSYMBOL (tail)->next == 0)
 	  break;
--- a/src/m/alpha.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/m/alpha.h	Thu Jul 08 11:50:25 2010 +0000
@@ -53,14 +53,9 @@
 #define DATA_START    0x140000000
 #endif
 
-#if (defined (__NetBSD__) || defined (__OpenBSD__))
-#define HAVE_TEXT_START
-#endif
-
 #else  /* not __ELF__ */
 
 /* Describe layout of the address space in an executing process.  */
-#define TEXT_START    0x120000000
 #define DATA_START    0x140000000
 
 #endif /* __ELF__ */
--- a/src/m/ia64.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/m/ia64.h	Thu Jul 08 11:50:25 2010 +0000
@@ -58,7 +58,5 @@
 #endif /* not _MALLOC_INTERNAL */
 #endif /* REL_ALLOC */
 
-#define HAVE_TEXT_START
-
 /* arch-tag: 9b8e9fb2-2e49-4c22-b68f-11a488e77c66
    (do not change this comment) */
--- a/src/m/ibmrs6000.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/m/ibmrs6000.h	Thu Jul 08 11:50:25 2010 +0000
@@ -22,7 +22,6 @@
 /* The data segment in this machine always starts at address 0x20000000.
    An address of data cannot be stored correctly in a Lisp object;
    we always lose the high bits.  We must tell XPNTR to add them back.  */
-#define TEXT_START 0x10000000
 #define DATA_START 0x20000000
 #define WORDS_BIG_ENDIAN
 #define DATA_SEG_BITS 0x20000000
--- a/src/m/intel386.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/m/intel386.h	Thu Jul 08 11:50:25 2010 +0000
@@ -23,10 +23,6 @@
    is the most significant byte.  */
 #undef WORDS_BIG_ENDIAN
 
-#ifdef USG
-#define TEXT_START 0
-#endif /* USG */
-
 #ifdef WINDOWSNT
 #define VIRT_ADDR_VARIES
 #define DATA_START 	get_data_start ()
--- a/src/m/iris4d.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/m/iris4d.h	Thu Jul 08 11:50:25 2010 +0000
@@ -30,8 +30,6 @@
    This flag only matters if you use USE_LISP_UNION_TYPE.  */
 #define EXPLICIT_SIGN_EXTEND
 
-#define TEXT_START 0x400000
-
 /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which
    were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for
    the value field of a LISP_OBJECT).  */
--- a/src/m/m68k.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/m/m68k.h	Thu Jul 08 11:50:25 2010 +0000
@@ -41,7 +41,6 @@
 #endif
 
 #define NO_REMAP
-#define TEXT_START 0
 #endif
 
 /* arch-tag: 4eadd161-b4e8-4b82-82a1-e4ce7f42969d
--- a/src/m/macppc.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/m/macppc.h	Thu Jul 08 11:50:25 2010 +0000
@@ -28,10 +28,6 @@
 /* Convert that into an integer that is 100 for a load average of 1.0  */
 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
 
-#if (defined (__NetBSD__) || defined (__OpenBSD__)) && defined (__ELF__)
-#define HAVE_TEXT_START
-#endif
-
 #ifdef _ARCH_PPC64
 #ifndef _LP64
 #define _LP64
--- a/src/m/mips.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/m/mips.h	Thu Jul 08 11:50:25 2010 +0000
@@ -31,8 +31,5 @@
    This flag only matters if you use USE_LISP_UNION_TYPE.  */
 #define EXPLICIT_SIGN_EXTEND
 
-/* Describe layout of the address space in an executing process.  */
-#define TEXT_START      0x00400000
-
 /* arch-tag: 8fd020ee-78a7-4d87-96ce-6129f52f7bee
    (do not change this comment) */
--- a/src/mem-limits.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/mem-limits.h	Thu Jul 08 11:50:25 2010 +0000
@@ -25,17 +25,6 @@
 /* Some systems need this before <sys/resource.h>.  */
 #include <sys/types.h>
 
-#ifdef _LIBC
-
-#include <sys/resource.h>
-#define BSD4_2			/* Tell code below to use getrlimit.  */
-
-/* Old Linux startup code won't define __data_start.  */
-extern int etext, __data_start; weak_extern (__data_start)
-#define start_of_data()	(&__data_start ?: &etext)
-
-#else /* not _LIBC */
-
 #ifdef HAVE_SYS_RESOURCE_H
 # include <sys/time.h>
 # include <sys/resource.h>
@@ -54,7 +43,6 @@
 #include <sys/resource.h>
 #endif /* BSD4_2 */
 
-#ifdef emacs
 /* The important properties of this type are that 1) it's a pointer, and
    2) arithmetic on it should work as if the size of the object pointed
    to has a size of 1.  */
@@ -77,26 +65,5 @@
 #define EXCEEDS_LISP_PTR(ptr) ((EMACS_UINT) (ptr) >> VALBITS)
 #endif
 
-#ifdef DATA_START
-#define start_of_data() ((char *)DATA_START)
-#endif
-
-#ifdef BSD_SYSTEM
-#ifndef DATA_SEG_BITS
-#ifndef DATA_START
-extern char etext;
-#define start_of_data() &etext
-#endif
-#endif
-#endif
-
-#else  /* not emacs */
-extern char etext;
-#define start_of_data() &etext
-#endif /* not emacs */
-
-#endif /* not _LIBC */
-
-
 /* arch-tag: fe39244e-e54f-4208-b7aa-02556f7841c5
    (do not change this comment) */
--- a/src/msdos.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/msdos.c	Thu Jul 08 11:50:25 2010 +0000
@@ -35,7 +35,7 @@
 #include <sys/time.h>
 #include <dos.h>
 #include <errno.h>
-#include <string.h>	 /* for bzero and string functions */
+#include <string.h>	 /* for memset and string functions */
 #include <sys/stat.h>    /* for _fixpath */
 #include <unistd.h>	 /* for chdir, dup, dup2, etc. */
 #include <dir.h>	 /* for getdisk */
@@ -102,7 +102,7 @@
 #endif /* not SYSTEM_MALLOC */
 
 static unsigned long
-event_timestamp ()
+event_timestamp (void)
 {
   struct time t;
   unsigned long s;
@@ -138,7 +138,7 @@
 static int mouse_button_count;
 
 void
-mouse_on ()
+mouse_on (void)
 {
   union REGS regs;
 
@@ -155,7 +155,7 @@
 }
 
 void
-mouse_off ()
+mouse_off (void)
 {
   union REGS regs;
 
@@ -222,8 +222,7 @@
 }
 
 void
-mouse_moveto (x, y)
-     int x, y;
+mouse_moveto (int x, int y)
 {
   union REGS regs;
   struct tty_display_info *tty = CURTTY ();
@@ -237,8 +236,7 @@
 }
 
 static int
-mouse_pressed (b, xp, yp)
-     int b, *xp, *yp;
+mouse_pressed (int b, int *xp, int *yp)
 {
   union REGS regs;
 
@@ -253,8 +251,7 @@
 }
 
 static int
-mouse_released (b, xp, yp)
-     int b, *xp, *yp;
+mouse_released (int b, int *xp, int *yp)
 {
   union REGS regs;
 
@@ -269,8 +266,7 @@
 }
 
 static int
-mouse_button_depressed (b, xp, yp)
-     int b, *xp, *yp;
+mouse_button_depressed (int b, int *xp, int *yp)
 {
   union REGS regs;
 
@@ -288,12 +284,9 @@
 }
 
 void
-mouse_get_pos (f, insist, bar_window, part, x, y, time)
-     FRAME_PTR *f;
-     int insist;
-     Lisp_Object *bar_window, *x, *y;
-     enum scroll_bar_part *part;
-     unsigned long *time;
+mouse_get_pos (FRAME_PTR *f, int insist, Lisp_Object *bar_window,
+	       enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
+	       unsigned long *time)
 {
   int ix, iy;
   Lisp_Object frame, tail;
@@ -311,7 +304,7 @@
 }
 
 static void
-mouse_check_moved ()
+mouse_check_moved (void)
 {
   int x, y;
 
@@ -338,7 +331,7 @@
 }
 
 void
-mouse_init ()
+mouse_init (void)
 {
   union REGS regs;
   struct tty_display_info *tty = CURTTY ();
@@ -440,10 +433,7 @@
 }
 
 static void
-dos_direct_output (y, x, buf, len)
-     int x, y;
-     char *buf;
-     int len;
+dos_direct_output (int y, int x, char *buf, int len)
 {
   int t0 = 2 * (x + y * screen_size_X);
   int t = t0 + (int) ScreenPrimary;
@@ -510,8 +500,7 @@
    ROWS x COLS frame.  */
 
 void
-dos_set_window_size (rows, cols)
-     int *rows, *cols;
+dos_set_window_size (int *rows, int *cols)
 {
   char video_name[30];
   union REGS regs;
@@ -620,7 +609,7 @@
    the mouse cursor may need to be refreshed.  */
 
 static void
-mouse_off_maybe ()
+mouse_off_maybe (void)
 {
   int x, y;
 
@@ -1864,10 +1853,7 @@
 
 /* Insert and delete glyphs.  */
 static void
-IT_insert_glyphs (f, start, len)
-     struct frame *f;
-     register struct glyph *start;
-     register int len;
+IT_insert_glyphs (struct frame *f, struct glyph *start, int len)
 {
   int shift_by_width = screen_size_X - (new_pos_X + len);
 
@@ -1880,18 +1866,14 @@
 }
 
 static void
-IT_delete_glyphs (f, n)
-     struct frame *f;
-     register int n;
+IT_delete_glyphs (struct frame *f, int n)
 {
   abort ();
 }
 
 /* set-window-configuration on window.c needs this.  */
 void
-x_set_menu_bar_lines (f, value, oldval)
-     struct frame *f;
-     Lisp_Object value, oldval;
+x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 {
   set_menu_bar_lines (f, value, oldval);
 }
@@ -2080,9 +2062,7 @@
 }
 
 void
-IT_set_frame_parameters (f, alist)
-     struct frame *f;
-     Lisp_Object alist;
+IT_set_frame_parameters (struct frame *f, Lisp_Object alist)
 {
   Lisp_Object tail;
   int i, j, length = XINT (Flength (alist));
@@ -2289,7 +2269,7 @@
 /* Do we need the internal terminal?  */
 
 void
-internal_terminal_init ()
+internal_terminal_init (void)
 {
   static int init_needed = 1;
   char *term = getenv ("TERM"), *colors;
@@ -2425,10 +2405,8 @@
   term->read_socket_hook = &tty_read_avail_input; /* from keyboard.c */
 }
 
-dos_get_saved_screen (screen, rows, cols)
-     char **screen;
-     int *rows;
-     int *cols;
+int
+dos_get_saved_screen (char **screen, int *rows, int *cols)
 {
 #ifndef HAVE_X_WINDOWS
   *screen = startup_screen_buffer;
@@ -2587,9 +2565,7 @@
 static int international_keyboard;
 
 int
-dos_set_keyboard (code, always)
-     int code;
-     int always;
+dos_set_keyboard (int code, int always)
 {
   int i;
   _go32_dpmi_registers regs;
@@ -2856,8 +2832,7 @@
 #define HYPER_P		0x8000	/* pseudo */
 
 static int
-dos_get_modifiers (keymask)
-     int *keymask;
+dos_get_modifiers (int *keymask)
 {
   union REGS regs;
   int mask, modifiers = 0;
@@ -2939,7 +2914,7 @@
 #define NUM_RECENT_DOSKEYS (100)
 int recent_doskeys_index;	/* Index for storing next element into recent_doskeys */
 int total_doskeys;		/* Total number of elements stored into recent_doskeys */
-Lisp_Object recent_doskeys; /* A vector, holding the last 100 keystrokes */
+Lisp_Object recent_doskeys;	/* A vector, holding the last 100 keystrokes */
 
 DEFUN ("recent-doskeys", Frecent_doskeys, Srecent_doskeys, 0, 0, 0,
        doc: /* Return vector of last 100 keyboard input values seen in dos_rawgetc.
@@ -2954,19 +2929,17 @@
   else
     {
       val = Fvector (NUM_RECENT_DOSKEYS, keys);
-      bcopy (keys + recent_doskeys_index,
-	     XVECTOR (val)->contents,
-	     (NUM_RECENT_DOSKEYS - recent_doskeys_index) * sizeof (Lisp_Object));
-      bcopy (keys,
-	     XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index,
-	     recent_doskeys_index * sizeof (Lisp_Object));
+      memcpy (XVECTOR (val)->contents, keys + recent_doskeys_index,
+	      (NUM_RECENT_DOSKEYS - recent_doskeys_index) * sizeof (Lisp_Object));
+      memcpy (XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index,
+	      keys, recent_doskeys_index * sizeof (Lisp_Object));
       return val;
     }
 }
 
 /* Get a char from keyboard.  Function keys are put into the event queue.  */
 static int
-dos_rawgetc ()
+dos_rawgetc (void)
 {
   struct input_event event;
   union REGS regs;
@@ -3317,8 +3290,8 @@
 static int prev_get_char = -1;
 
 /* Return 1 if a key is ready to be read without suspending execution.  */
-
-dos_keysns ()
+int
+dos_keysns (void)
 {
   if (prev_get_char != -1)
     return 1;
@@ -3327,8 +3300,8 @@
 }
 
 /* Read a key.  Return -1 if no key is ready.  */
-
-dos_keyread ()
+int
+dos_keyread (void)
 {
   if (prev_get_char != -1)
     {
@@ -3357,7 +3330,7 @@
 static int menu_help_paneno, menu_help_itemno;
 
 static XMenu *
-IT_menu_create ()
+IT_menu_create (void)
 {
   XMenu *menu;
 
@@ -3526,7 +3499,7 @@
 /* Report availability of menus.  */
 
 int
-have_menus_p () {  return 1; }
+have_menus_p (void) {  return 1; }
 
 /* Create a brand new menu structure.  */
 
@@ -3884,8 +3857,7 @@
 /* Destructively turn backslashes into slashes.  */
 
 void
-dostounix_filename (p)
-     register char *p;
+dostounix_filename (char *p)
 {
   msdos_downcase_filename (p);
 
@@ -3900,8 +3872,7 @@
 /* Destructively turn slashes into backslashes.  */
 
 void
-unixtodos_filename (p)
-     register char *p;
+unixtodos_filename (char *p)
 {
   if (p[1] == ':' && *p >= 'A' && *p <= 'Z')
     {
@@ -3920,9 +3891,7 @@
 /* Get the default directory for a given drive.  0=def, 1=A, 2=B, ...  */
 
 int
-getdefdir (drive, dst)
-     int drive;
-     char *dst;
+getdefdir (int drive, char *dst)
 {
   char in_path[4], *p = in_path, e = errno;
 
@@ -3961,9 +3930,7 @@
 /* Remove all CR's that are followed by a LF.  */
 
 int
-crlf_to_lf (n, buf)
-     register int n;
-     register unsigned char *buf;
+crlf_to_lf (int n, unsigned char *buf)
 {
   unsigned char *np = buf, *startp = buf, *endp = buf + n;
 
@@ -3995,8 +3962,7 @@
 /* Convert alphabetic characters in a filename to lower-case.  */
 
 void
-msdos_downcase_filename (p)
-     register unsigned char *p;
+msdos_downcase_filename (unsigned char *p)
 {
   /* Always lower-case drive letters a-z, even if the filesystem
      preserves case in filenames.
@@ -4040,8 +4006,7 @@
 static char emacsroot[MAXPATHLEN];
 
 char *
-rootrelativepath (rel)
-     char *rel;
+rootrelativepath (char *rel)
 {
   static char result[MAXPATHLEN + 10];
 
@@ -4056,10 +4021,7 @@
    break if one or more of these are missing.  */
 
 void
-init_environment (argc, argv, skip_args)
-     int argc;
-     char **argv;
-     int skip_args;
+init_environment (int argc, char **argv, int skip_args)
 {
   char *s, *t, *root;
   int len, i;
@@ -4293,7 +4255,7 @@
 /*  Restore status of standard input and Ctrl-C checking.  */
 
 int
-dos_ttcooked ()
+dos_ttcooked (void)
 {
   union REGS inregs, outregs;
 
@@ -4319,11 +4281,8 @@
    file TEMPOUT and stderr to TEMPERR.  */
 
 int
-run_msdos_command (argv, working_dir, tempin, tempout, temperr, envv)
-     unsigned char **argv;
-     const char *working_dir;
-     int tempin, tempout, temperr;
-     char **envv;
+run_msdos_command (unsigned char **argv, const char *working_dir,
+		   int tempin, int tempout, int temperr, char **envv)
 {
   char *saveargv1, *saveargv2, *lowcase_argv0, *pa, *pl;
   char oldwd[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS.  */
@@ -4464,8 +4423,7 @@
 }
 
 void
-croak (badfunc)
-     char *badfunc;
+croak (char *badfunc)
 {
   fprintf (stderr, "%s not yet implemented\r\n", badfunc);
   reset_all_sys_modes ();
@@ -4475,8 +4433,8 @@
 /*
  * A few unimplemented functions that we silently ignore.
  */
-setpgrp () {return 0; }
-setpriority (x,y,z) int x,y,z; { return 0; }
+int setpgrp (void) {return 0; }
+int setpriority (int x, int y, int z) { return 0; }
 
 #if __DJGPP__ == 2 && __DJGPP_MINOR__ < 2
 
@@ -4501,17 +4459,13 @@
 /* A signal handler which just records that a signal occurred
    (it will be raised later, if and when the signal is unblocked).  */
 static void
-sig_suspender (signo)
-     int signo;
+sig_suspender (int signo)
 {
   sigaddset (&msdos_pending_signals, signo);
 }
 
 int
-sigprocmask (how, new_set, old_set)
-     int how;
-     const sigset_t *new_set;
-     sigset_t *old_set;
+sigprocmask (int how, const sigset_t *new_set, sigset_t *old_set)
 {
   int signo;
   sigset_t new_mask;
@@ -4613,10 +4567,8 @@
 /* We don't have to call timer_check here
    because wait_reading_process_output takes care of that.  */
 int
-sys_select (nfds, rfds, wfds, efds, timeout)
-     int nfds;
-     SELECT_TYPE *rfds, *wfds, *efds;
-     EMACS_TIME *timeout;
+sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
+	    EMACS_TIME *timeout)
 {
   int check_input;
   struct time t;
@@ -4686,11 +4638,10 @@
 
 #ifdef chdir
 #undef chdir
-extern int chdir ();
+extern int chdir (const char *);
 
 int
-sys_chdir (path)
-     const char* path;
+sys_chdir (const char *path)
 {
   int len = strlen (path);
   char *tmp = (char *)path;
@@ -4719,7 +4670,7 @@
 extern void tzset (void);
 
 void
-init_gettimeofday ()
+init_gettimeofday (void)
 {
   time_t ltm, gtm;
   struct tm *lstm;
@@ -4737,9 +4688,7 @@
 #ifdef abort
 #undef abort
 void
-dos_abort (file, line)
-     char *file;
-     int  line;
+dos_abort (char *file, int line)
 {
   char buffer1[200], buffer2[400];
   int i, j;
@@ -4755,7 +4704,7 @@
 }
 #else
 void
-abort ()
+abort (void)
 {
   dos_ttcooked ();
   ScreenSetCursor (10, 0);
@@ -4780,7 +4729,8 @@
 static int delete_exited_processes;
 #endif
 
-syms_of_msdos ()
+void
+syms_of_msdos (void)
 {
   recent_doskeys = Fmake_vector (make_number (NUM_RECENT_DOSKEYS), Qnil);
   staticpro (&recent_doskeys);
--- a/src/msdos.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/msdos.h	Thu Jul 08 11:50:25 2010 +0000
@@ -23,7 +23,7 @@
 #include <dpmi.h>
 
 int dos_ttraw (struct tty_display_info *);
-int dos_ttcooked ();
+int dos_ttcooked (void);
 int dos_get_saved_screen (char **, int *, int *);
 int dos_set_keyboard (int, int);
 void dos_set_window_size (int *, int *);
@@ -32,15 +32,13 @@
 void unixtodos_filename (char *);
 void dostounix_filename (char *);
 char *rootrelativepath (char *);
-void init_environment ();
-void internal_terminal_init ();
-void ctrl_break_func (_go32_dpmi_registers *);
-void install_ctrl_break_check ();
+void init_environment (int, char **, int);
+void internal_terminal_init (void);
 
 extern int have_mouse;
-void mouse_init ();
-void mouse_on ();
-void mouse_off ();
+void mouse_init (void);
+void mouse_on (void);
+void mouse_off (void);
 void mouse_moveto (int, int);
 
 #ifndef HAVE_X_WINDOWS
--- a/src/nsfns.m	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/nsfns.m	Thu Jul 08 11:50:25 2010 +0000
@@ -1159,7 +1159,7 @@
 
   f->output_method = output_ns;
   f->output_data.ns = (struct ns_output *)xmalloc (sizeof *(f->output_data.ns));
-  bzero (f->output_data.ns, sizeof (*(f->output_data.ns)));
+  memset (f->output_data.ns, 0, sizeof (*(f->output_data.ns)));
 
   FRAME_FONTSET (f) = -1;
 
--- a/src/nsfont.m	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/nsfont.m	Thu Jul 08 11:50:25 2010 +0000
@@ -776,8 +776,8 @@
     xmalloc (0x100 * sizeof (struct font_metrics *));
   if (!font_info->glyphs || !font_info->metrics)
     return Qnil;
-  bzero (font_info->glyphs, 0x100 * sizeof (unsigned short *));
-  bzero (font_info->metrics, 0x100 * sizeof (struct font_metrics *));
+  memset (font_info->glyphs, 0, 0x100 * sizeof (unsigned short *));
+  memset (font_info->metrics, 0, 0x100 * sizeof (struct font_metrics *));
 
   BLOCK_INPUT;
 
@@ -816,8 +816,8 @@
     [font_info->nsfont retain];
 
     /* set up ns_font (defined in nsgui.h) */
-    font_info->name = (char *)xmalloc (strlen (fontName) + 1);
-    bcopy (fontName, font_info->name, strlen (fontName) + 1);
+    font_info->name = (char *)xmalloc (strlen (fontName)+1);
+    strcpy (font_info->name, fontName);
     font_info->bold = [fontMgr traitsOfFont: nsfont] & NSBoldFontMask;
     font_info->ital =
       synthItal || ([fontMgr traitsOfFont: nsfont] & NSItalicFontMask);
@@ -972,7 +972,7 @@
   int totalWidth = 0;
   int i;
 
-  bzero (metrics, sizeof (struct font_metrics));
+  memset (metrics, 0, sizeof (struct font_metrics));
 
   for (i =0; i<nglyphs; i++)
     {
@@ -1395,7 +1395,7 @@
  sfont = [font_info->nsfont screenFont];
 
   font_info->metrics[block] = xmalloc (0x100 * sizeof (struct font_metrics));
-  bzero (font_info->metrics[block], 0x100 * sizeof (struct font_metrics));
+  memset (font_info->metrics[block], 0, 0x100 * sizeof (struct font_metrics));
   if (!(font_info->metrics[block]))
     abort ();
 
--- a/src/nsimage.m	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/nsimage.m	Thu Jul 08 11:50:25 2010 +0000
@@ -315,9 +315,9 @@
 
   [self addRepresentation: bmRep];
 
-  bzero (planes[0], w*h);
-  bzero (planes[1], w*h);
-  bzero (planes[2], w*h);
+  memset (planes[0], 0, w*h);
+  memset (planes[1], 0, w*h);
+  memset (planes[2], 0, w*h);
   [self setXBMColor: [NSColor blackColor]];
   return self;
 }
@@ -379,7 +379,7 @@
 
   [bmRep getBitmapDataPlanes: pixmapData];
   for (i =0; i<4; i++)
-    bzero (pixmapData[i], width*height);
+    memset (pixmapData[i], 0, width*height);
   [self addRepresentation: bmRep];
   return self;
 }
--- a/src/nsmenu.m	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/nsmenu.m	Thu Jul 08 11:50:25 2010 +0000
@@ -219,8 +219,8 @@
 
       /* Save the frame's previous menu bar contents data */
       if (previous_menu_items_used)
-	bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items,
-	       previous_menu_items_used * sizeof (Lisp_Object));
+	memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
+		previous_menu_items_used * sizeof (Lisp_Object));
 
       /* parse stage 1: extract from lisp */
       save_menu_items ();
--- a/src/nsterm.m	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/nsterm.m	Thu Jul 08 11:50:25 2010 +0000
@@ -2163,11 +2163,11 @@
     {
       EmacsImage **newBimgs
 	= xmalloc (max_used_fringe_bitmap * sizeof (EmacsImage *));
-      bzero (newBimgs, max_used_fringe_bitmap * sizeof (EmacsImage *));
+      memset (newBimgs, 0, max_used_fringe_bitmap * sizeof (EmacsImage *));
 
       if (nBimgs)
         {
-          bcopy (bimgs, newBimgs, nBimgs * sizeof (EmacsImage *));
+          memcpy (newBimgs, bimgs, nBimgs * sizeof (EmacsImage *));
           xfree (bimgs);
         }
 
@@ -3707,7 +3707,7 @@
                                              name: nil object: nil]; */
 
   dpyinfo = (struct ns_display_info *)xmalloc (sizeof (struct ns_display_info));
-  bzero (dpyinfo, sizeof (struct ns_display_info));
+  memset (dpyinfo, 0, sizeof (struct ns_display_info));
 
   ns_initialize_display_info (dpyinfo);
   terminal = ns_create_terminal (dpyinfo);
--- a/src/prefix-args.c	Wed Jul 07 12:15:48 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/* prefix-args.c - echo each argument, prefixed by a string.
-   Copyright (C) 1992, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Jim Blandy <jimb@occs.cs.oberlin.edu> - September 1992
-
-   When using GCC 2 as the linker in the build process, options
-   intended for the linker need to be prefixed with the "-Xlinker"
-   option.  If an option takes an argument, we need to use -Xlinker
-   twice - once for the option and once for its argument.  For
-   example, to run the linker with the options "-Bstatic" "-e"
-   "_start", you'd need to pass the following options to GCC:
-
-   -Xlinker -Bstatic -Xlinker -e -Xlinker _start.
-
-   The Emacs makefile used to use a Bourne Shell `for' loop to prefix
-   each linker option with "-Xlinker", but 1) the for loop was hairier
-   than one might hope because it had to work when there were no
-   arguments to pass to the linker - the shell barfs on a loop like
-   this:
-
-       for arg in ; do echo -Xlinker "$arg"; done
-
-   and 2) the whole compilation command containing this loop seems to
-   exit with a non-zero status and halt the build under Ultrix.
-
-   If I can't write a completely portable program to do this in C,
-   I'm quitting and taking up gardening.  */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#if STDC_HEADERS
-# include <stdlib.h>		/* for proper declaration of `exit' */
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-
-int
-main (int argc, char **argv)
-{
-  char *progname;
-  char *prefix;
-
-  progname = argv[0];
-  argc--, argv++;
-
-  if (argc < 1)
-    {
-      fprintf (stderr, "Usage: %s PREFIX ARGS...\n\
-Echo each ARG preceded by PREFIX and a space.\n", progname);
-      exit (2);
-    }
-
-  prefix = argv[0];
-  argc--, argv++;
-
-  for (; argc > 0; argc--, argv++)
-    printf ("%s %s%c", prefix, argv[0], (argc > 1) ? ' ' : '\n');
-
-  exit (0);
-}
-
-/* arch-tag: 08136d70-e5c0-49c7-bcd8-b4850233977a
-   (do not change this comment) */
--- a/src/print.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/print.c	Thu Jul 08 11:50:25 2010 +0000
@@ -289,7 +289,7 @@
 static Lisp_Object
 print_unwind (Lisp_Object saved_text)
 {
-  bcopy (SDATA (saved_text), print_buffer, SCHARS (saved_text));
+  memcpy (print_buffer, SDATA (saved_text), SCHARS (saved_text));
   return Qnil;
 }
 
@@ -316,7 +316,7 @@
 	  if (print_buffer_pos_byte + len >= print_buffer_size)
 	    print_buffer = (char *) xrealloc (print_buffer,
 					      print_buffer_size *= 2);
-	  bcopy (str, print_buffer + print_buffer_pos_byte, len);
+	  memcpy (print_buffer + print_buffer_pos_byte, str, len);
 	  print_buffer_pos += 1;
 	  print_buffer_pos_byte += len;
 	}
@@ -364,7 +364,7 @@
 	  print_buffer = (char *) xrealloc (print_buffer,
 					    print_buffer_size);
 	}
-      bcopy (ptr, print_buffer + print_buffer_pos_byte, size_byte);
+      memcpy (print_buffer + print_buffer_pos_byte, ptr, size_byte);
       print_buffer_pos += size;
       print_buffer_pos_byte += size_byte;
     }
@@ -461,7 +461,7 @@
 	  if (chars < bytes)
 	    {
 	      newstr = make_uninit_multibyte_string (chars, bytes);
-	      bcopy (SDATA (string), SDATA (newstr), chars);
+	      memcpy (SDATA (newstr), SDATA (string), chars);
 	      str_to_multibyte (SDATA (newstr), bytes, chars);
 	      string = newstr;
 	    }
@@ -480,7 +480,7 @@
 	  USE_SAFE_ALLOCA;
 
 	  SAFE_ALLOCA (buffer, char *, nbytes);
-	  bcopy (SDATA (string), buffer, nbytes);
+	  memcpy (buffer, SDATA (string), nbytes);
 
 	  strout (buffer, chars, SBYTES (string),
 		  printcharfun, STRING_MULTIBYTE (string));
@@ -1032,7 +1032,7 @@
     {
       Lisp_Object cname = SYMBOL_NAME (caller);
       char *name = alloca (SBYTES (cname));
-      bcopy (SDATA (cname), name, SBYTES (cname));
+      memcpy (name, SDATA (cname), SBYTES (cname));
       message_dolog (name, SBYTES (cname), 0, 0);
       message_dolog (": ", 2, 0, 0);
     }
--- a/src/process.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/process.c	Thu Jul 08 11:50:25 2010 +0000
@@ -306,6 +306,10 @@
 
 static SELECT_TYPE input_wait_mask;
 
+/* Non-zero if keyboard input is on hold, zero otherwise.  */
+
+static int kbd_is_on_hold;
+
 /* Mask that excludes keyboard input descriptor(s).  */
 
 static SELECT_TYPE non_keyboard_wait_mask;
@@ -2436,7 +2440,7 @@
   register unsigned char *cp = NULL;
   register int i;
 
-  bzero (sa, len);
+  memset (sa, 0, len);
 
   if (VECTORP (address))
     {
@@ -2631,12 +2635,12 @@
 	/* This is broken, at least in the Linux 2.4 kernel.
 	   To unbind, the arg must be a zero integer, not the empty string.
 	   This should work on all systems.   KFS. 2003-09-23.  */
-	bzero (devname, sizeof devname);
+	memset (devname, 0, sizeof devname);
 	if (STRINGP (val))
 	  {
 	    char *arg = (char *) SDATA (val);
 	    int len = min (strlen (arg), IFNAMSIZ);
-	    bcopy (arg, devname, len);
+	    memcpy (devname, arg, len);
 	  }
 	else if (!NILP (val))
 	  error ("Bad option value for %s", name);
@@ -3345,7 +3349,7 @@
 	  host = Qnil;
 	}
       CHECK_STRING (service);
-      bzero (&address_un, sizeof address_un);
+      memset (&address_un, 0, sizeof address_un);
       address_un.sun_family = AF_LOCAL;
       strncpy (address_un.sun_path, SDATA (service), sizeof address_un.sun_path);
       ai.ai_addr = (struct sockaddr *) &address_un;
@@ -3429,7 +3433,7 @@
       port = svc_info->s_port;
     }
 
-  bzero (&address_in, sizeof address_in);
+  memset (&address_in, 0, sizeof address_in);
   address_in.sin_family = family;
   address_in.sin_addr.s_addr = INADDR_ANY;
   address_in.sin_port = port;
@@ -3453,8 +3457,8 @@
 
       if (host_info_ptr)
 	{
-	  bcopy (host_info_ptr->h_addr, (char *) &address_in.sin_addr,
-		 host_info_ptr->h_length);
+	  memcpy (&address_in.sin_addr, host_info_ptr->h_addr,
+		  host_info_ptr->h_length);
 	  family = host_info_ptr->h_addrtype;
 	  address_in.sin_family = family;
 	}
@@ -3466,8 +3470,8 @@
 	  if (numeric_addr == -1)
 	    error ("Unknown host \"%s\"", SDATA (host));
 
-	  bcopy ((char *)&numeric_addr, (char *) &address_in.sin_addr,
-		 sizeof (address_in.sin_addr));
+	  memcpy (&address_in.sin_addr, &numeric_addr,
+		  sizeof (address_in.sin_addr));
 	}
 
     }
@@ -3651,7 +3655,7 @@
 	  if (is_server)
 	    {
 	      Lisp_Object remote;
-	      bzero (datagram_address[s].sa, lres->ai_addrlen);
+	      memset (datagram_address[s].sa, 0, lres->ai_addrlen);
 	      if (remote = Fplist_get (contact, QCremote), !NILP (remote))
 		{
 		  int rfamily, rlen;
@@ -3662,7 +3666,7 @@
 		}
 	    }
 	  else
-	    bcopy (lres->ai_addr, datagram_address[s].sa, lres->ai_addrlen);
+	    memcpy (datagram_address[s].sa, lres->ai_addr, lres->ai_addrlen);
 	}
 #endif
       contact = Fplist_put (contact, QCaddress,
@@ -3929,7 +3933,7 @@
       char namebuf[sizeof (ifq->ifr_name) + 1];
       if (ifq->ifr_addr.sa_family != AF_INET)
 	continue;
-      bcopy (ifq->ifr_name, namebuf, sizeof (ifq->ifr_name));
+      memcpy (namebuf, ifq->ifr_name, sizeof (ifq->ifr_name));
       namebuf[sizeof (ifq->ifr_name)] = 0;
       res = Fcons (Fcons (build_string (namebuf),
 			  conv_sockaddr_to_lisp (&ifq->ifr_addr,
@@ -4032,7 +4036,7 @@
 
   CHECK_STRING (ifname);
 
-  bzero (rq.ifr_name, sizeof rq.ifr_name);
+  memset (rq.ifr_name, 0, sizeof rq.ifr_name);
   strncpy (rq.ifr_name, SDATA (ifname), sizeof (rq.ifr_name));
 
   s = socket (AF_INET, SOCK_STREAM, 0);
@@ -4731,7 +4735,10 @@
 	  SELECT_TYPE Ctemp;
 #endif
 
-	  Atemp = input_wait_mask;
+          if (kbd_on_hold_p ())
+            FD_ZERO (&Atemp);
+          else
+            Atemp = input_wait_mask;
 	  IF_NON_BLOCKING_CONNECT (Ctemp = connect_wait_mask);
 
 	  EMACS_SET_SECS_USECS (timeout, 0, 0);
@@ -5270,7 +5277,7 @@
   chars = (char *) alloca (carryover + readmax);
   if (carryover)
     /* See the comment above.  */
-    bcopy (SDATA (p->decoding_buf), chars, carryover);
+    memcpy (chars, SDATA (p->decoding_buf), carryover);
 
 #ifdef DATAGRAM_SOCKETS
   /* We have a working select, so proc_buffered_char is always -1.  */
@@ -5414,8 +5421,8 @@
 	{
 	  if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
 	    p->decoding_buf = make_uninit_string (coding->carryover_bytes);
-	  bcopy (coding->carryover, SDATA (p->decoding_buf),
-		 coding->carryover_bytes);
+	  memcpy (SDATA (p->decoding_buf), coding->carryover,
+		  coding->carryover_bytes);
 	  p->decoding_carryover = coding->carryover_bytes;
 	}
       if (SBYTES (text) > 0)
@@ -5506,8 +5513,8 @@
 	{
 	  if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
 	    p->decoding_buf = make_uninit_string (coding->carryover_bytes);
-	  bcopy (coding->carryover, SDATA (p->decoding_buf),
-		 coding->carryover_bytes);
+	  memcpy (SDATA (p->decoding_buf), coding->carryover,
+		  coding->carryover_bytes);
 	  p->decoding_carryover = coding->carryover_bytes;
 	}
       /* Adjust the multibyteness of TEXT to that of the buffer.  */
@@ -6510,11 +6517,11 @@
       if (!proc_encode_coding_system[new_outfd])
 	proc_encode_coding_system[new_outfd]
 	  = (struct coding_system *) xmalloc (sizeof (struct coding_system));
-      bcopy (proc_encode_coding_system[old_outfd],
-	     proc_encode_coding_system[new_outfd],
-	     sizeof (struct coding_system));
-      bzero (proc_encode_coding_system[old_outfd],
-	     sizeof (struct coding_system));
+      memcpy (proc_encode_coding_system[new_outfd],
+	      proc_encode_coding_system[old_outfd],
+	      sizeof (struct coding_system));
+      memset (proc_encode_coding_system[old_outfd], 0,
+	      sizeof (struct coding_system));
 
       XPROCESS (proc)->outfd = new_outfd;
     }
@@ -7010,6 +7017,30 @@
 
 
 
+/* Stop reading input from keyboard sources.  */
+
+void
+hold_keyboard_input (void)
+{
+  kbd_is_on_hold = 1;
+}
+
+/* Resume reading input from keyboard sources.  */
+
+void
+unhold_keyboard_input (void)
+{
+  kbd_is_on_hold = 0;
+}
+
+/* Return non-zero if keyboard input is on hold, zero otherwise.  */
+
+int
+kbd_on_hold_p (void)
+{
+  return kbd_is_on_hold;
+}
+
 /* Add DESC to the set of keyboard input descriptors.  */
 
 void
@@ -7203,10 +7234,10 @@
       chan_process[i] = Qnil;
       proc_buffered_char[i] = -1;
     }
-  bzero (proc_decode_coding_system, sizeof proc_decode_coding_system);
-  bzero (proc_encode_coding_system, sizeof proc_encode_coding_system);
+  memset (proc_decode_coding_system, 0, sizeof proc_decode_coding_system);
+  memset (proc_encode_coding_system, 0, sizeof proc_encode_coding_system);
 #ifdef DATAGRAM_SOCKETS
-  bzero (datagram_address, sizeof datagram_address);
+  memset (datagram_address, 0, sizeof datagram_address);
 #endif
 
 #ifdef HAVE_SOCKETS
@@ -7901,6 +7932,7 @@
 void
 init_process ()
 {
+  kbd_is_on_hold = 0;
 }
 
 void
--- a/src/process.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/process.h	Thu Jul 08 11:50:25 2010 +0000
@@ -170,5 +170,9 @@
 extern Lisp_Object list_system_processes (void);
 extern Lisp_Object system_process_attributes (Lisp_Object);
 
+extern void hold_keyboard_input (void);
+extern void unhold_keyboard_input (void);
+extern int kbd_on_hold_p (void);
+
 /* arch-tag: dffedfc4-d7bc-4b58-a26f-c16155449c72
    (do not change this comment) */
--- a/src/ralloc.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/ralloc.c	Thu Jul 08 11:50:25 2010 +0000
@@ -37,11 +37,6 @@
 typedef POINTER_TYPE *POINTER;
 typedef size_t SIZE;
 
-/* Declared in dispnew.c, this version doesn't screw up if regions
-   overlap.  */
-
-extern void safe_bcopy (const char *, char *, int);
-
 #ifdef DOUG_LEA_MALLOC
 #define M_TOP_PAD           -2
 extern int mallopt (int, int);
@@ -61,9 +56,6 @@
 #include <unistd.h>
 #include <malloc.h>
 
-#define safe_bcopy(x, y, z) memmove (y, x, z)
-#define bzero(x, len) memset (x, 0, len)
-
 #endif	/* not emacs */
 
 
@@ -676,7 +668,7 @@
             }
 	  else
 	    {
-	      safe_bcopy (b->data, b->new_data, b->size);
+	      memmove (b->new_data, b->data, b->size);
 	      *b->variable = b->data = b->new_data;
             }
 	}
@@ -687,8 +679,8 @@
 	}
       else
 	{
-	  safe_bcopy (bloc->data, bloc->new_data, old_size);
-	  bzero ((char *) bloc->new_data + old_size, size - old_size);
+	  memmove (bloc->new_data, bloc->data, old_size);
+	  memset (bloc->new_data + old_size, 0, size - old_size);
 	  *bloc->variable = bloc->data = bloc->new_data;
 	}
     }
@@ -703,7 +695,7 @@
             }
 	  else
 	    {
-	      safe_bcopy (b->data, b->new_data, b->size);
+	      memmove (b->new_data, b->data, b->size);
 	      *b->variable = b->data = b->new_data;
 	    }
 	}
@@ -856,7 +848,7 @@
 	     header.  */
 	  for (b = last_bloc; b != NIL_BLOC; b = b->prev)
 	    {
-	      safe_bcopy (b->data, b->new_data, b->size);
+	      memmove (b->new_data, b->data, b->size);
 	      *b->variable = b->data = b->new_data;
 	    }
 
@@ -883,7 +875,7 @@
 	    last_heap = first_heap;
 	}
 
-      bzero (address, size);
+      memset (address, 0, size);
     }
   else /* size < 0 */
     {
@@ -902,7 +894,7 @@
 
 	  for (b = first_bloc; b != NIL_BLOC; b = b->next)
 	    {
-	      safe_bcopy (b->data, b->new_data, b->size);
+	      memmove (b->new_data, b->data, b->size);
 	      *b->variable = b->data = b->new_data;
 	    }
 	}
@@ -1082,7 +1074,7 @@
     abort ();
 
   /* This frees all unused blocs.  It is not too inefficient, as the resize
-     and bcopy is done only once.  Afterwards, all unreferenced blocs are
+     and memcpy is done only once.  Afterwards, all unreferenced blocs are
      already shrunk to zero size.  */
   if (!r_alloc_freeze_level)
     {
@@ -1292,8 +1284,8 @@
      even though it is after the sbrk value.  */
   /* Doubly true, with the additional call that explicitly adds the
      rest of that page to the address space.  */
-  bzero (first_heap->start,
-	 (char *) first_heap->end - (char *) first_heap->start);
+  memset (first_heap->start, 0,
+	  (char *) first_heap->end - (char *) first_heap->start);
   virtual_break_value = break_value = first_heap->bloc_start = first_heap->end;
 #endif
 
--- a/src/regex.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/regex.c	Thu Jul 08 11:50:25 2010 +0000
@@ -248,37 +248,16 @@
 # endif
 # define realloc xrealloc
 
-/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
-   If nothing else has been done, use the method below.  */
-# ifdef INHIBIT_STRING_HEADER
-#  if !(defined HAVE_BZERO && defined HAVE_BCOPY)
-#   if !defined bzero && !defined bcopy
-#    undef INHIBIT_STRING_HEADER
-#   endif
+/* This is the normal way of making sure we have memcpy, memcmp and memset.  */
+# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
+#  include <string.h>
+# else
+#  include <strings.h>
+#  ifndef memcmp
+#   define memcmp(s1, s2, n)	bcmp (s1, s2, n)
 #  endif
-# endif
-
-/* This is the normal way of making sure we have memcpy, memcmp and bzero.
-   This is used in most programs--a few other programs avoid this
-   by defining INHIBIT_STRING_HEADER.  */
-# ifndef INHIBIT_STRING_HEADER
-#  if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
-#   include <string.h>
-#   ifndef bzero
-#    ifndef _LIBC
-#     define bzero(s, n)	(memset (s, '\0', n), (s))
-#    else
-#     define bzero(s, n)	__bzero (s, n)
-#    endif
-#   endif
-#  else
-#   include <strings.h>
-#   ifndef memcmp
-#    define memcmp(s1, s2, n)	bcmp (s1, s2, n)
-#   endif
-#   ifndef memcpy
-#    define memcpy(d, s, n)	(bcopy (s, d, n), (d))
-#   endif
+#  ifndef memcpy
+#   define memcpy(d, s, n)	(bcopy (s, d, n), (d))
 #  endif
 # endif
 
@@ -464,7 +443,7 @@
    if (done)
      return;
 
-   bzero (re_syntax_table, sizeof re_syntax_table);
+   memset (re_syntax_table, 0, sizeof re_syntax_table);
 
    for (c = 0; c < CHAR_SET_SIZE; ++c)
      if (ISALNUM (c))
@@ -2948,7 +2927,7 @@
 	    BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
 
 	    /* Clear the whole map.  */
-	    bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH);
+	    memset (b, 0, (1 << BYTEWIDTH) / BYTEWIDTH);
 
 	    /* charset_not matches newline according to a syntax bit.  */
 	    if ((re_opcode_t) b[-2] == charset_not
@@ -4303,7 +4282,7 @@
 
   assert (fastmap && bufp->buffer);
 
-  bzero (fastmap, 1 << BYTEWIDTH);  /* Assume nothing's valid.  */
+  memset (fastmap, 0, 1 << BYTEWIDTH);  /* Assume nothing's valid.  */
   bufp->fastmap_accurate = 1;	    /* It will be when we're done.  */
 
   analysis = analyse_first (bufp->buffer, bufp->buffer + bufp->used,
--- a/src/s/darwin.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/s/darwin.h	Thu Jul 08 11:50:25 2010 +0000
@@ -117,9 +117,6 @@
 /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets.  */
 #define HAVE_SOCKETS
 
-/* start_of_text isn't actually used, so make it compile without error.  */
-#define TEXT_START (0)
-
 /* Definitions for how to compile & link.  */
 #ifdef HAVE_NS
 #define SYSTEM_PURESIZE_EXTRA 200000
--- a/src/s/hpux10-20.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/s/hpux10-20.h	Thu Jul 08 11:50:25 2010 +0000
@@ -131,7 +131,6 @@
 #define DATA_SEG_BITS 0x40000000
 
 #define DATA_START    0x40000000
-#define TEXT_START    0x00000000
 
 /* Data type of load average, as read out of kmem.  */
 #define LOAD_AVE_TYPE double
--- a/src/s/ms-w32.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/s/ms-w32.h	Thu Jul 08 11:50:25 2010 +0000
@@ -63,15 +63,6 @@
    for received packets, so datagrams are broken too.  */
 #define BROKEN_DATAGRAM_SOCKETS 1
 
-#define bzero(b, l) memset(b, 0, l)
-#define bcopy(s, d, l) memmove(d, s, l)
-#define bcmp(a, b, l) memcmp(a, b, l)
-
-/* bcopy (aka memmove aka memcpy at least on x86) under MSVC is quite safe.  */
-#define GAP_USE_BCOPY 1
-#define BCOPY_UPWARD_SAFE 1
-#define BCOPY_DOWNWARD_SAFE 1
-
 /* If your system uses COFF (Common Object File Format) then define the
    preprocessor symbol "COFF".  */
 #define COFF 1
@@ -153,8 +144,10 @@
 #define HAVE_RANDOM 1
 #undef  HAVE_SYSINFO
 #undef  HAVE_LRAND48
-#define HAVE_BCOPY 1
-#define HAVE_BCMP 1
+#define HAVE_MEMCMP 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMSET 1
 #define HAVE_LOGB 1
 #define HAVE_FREXP 1
 #define HAVE_FMOD 1
--- a/src/s/msdos.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/s/msdos.h	Thu Jul 08 11:50:25 2010 +0000
@@ -75,7 +75,6 @@
 #define _longjmp longjmp
 
 #define DATA_START  (&etext + 1)
-#define TEXT_START  &start
 
 #define _NAIVE_DOS_REGS
 
@@ -104,10 +103,6 @@
 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
 
-/* bcopy under djgpp is quite safe.  */
-#define GAP_USE_BCOPY
-#define BCOPY_UPWARD_SAFE 1
-#define BCOPY_DOWNWARD_SAFE 1
 
 /* Mode line description of a buffer's type.  */
 #define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B")
--- a/src/scroll.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/scroll.c	Thu Jul 08 11:50:25 2010 +0000
@@ -258,7 +258,7 @@
   int *copy_from = (int *) alloca (window_size * sizeof (int));
 
   /* Zero means line is empty.  */
-  bzero (retained_p, window_size * sizeof (char));
+  memset (retained_p, 0, window_size * sizeof (char));
   for (k = 0; k < window_size; ++k)
     copy_from[k] = -1;
 
@@ -677,7 +677,7 @@
      old matrix.  Lines not retained are empty.  */
   char *retained_p = (char *) alloca (window_size * sizeof (char));
 
-  bzero (retained_p, window_size * sizeof (char));
+  memset (retained_p, 0, window_size * sizeof (char));
 
   /* Perform some sanity checks when GLYPH_DEBUG is on.  */
   CHECK_MATRIX (current_matrix);
@@ -855,7 +855,7 @@
   avg_length /= end - start;
   threshold = avg_length / 4;
 
-  bzero (lines, sizeof lines);
+  memset (lines, 0, sizeof lines);
 
   /* Put new lines' hash codes in hash table.  Ignore lines shorter
      than the threshold.  Thus, if the lines that are in common are
--- a/src/search.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/search.c	Thu Jul 08 11:50:25 2010 +0000
@@ -1404,7 +1404,7 @@
 		}
 
 	      /* Store this character into the translated pattern.  */
-	      bcopy (str, pat, charlen);
+	      memcpy (pat, str, charlen);
 	      pat += charlen;
 	      base_pat += in_charlen;
 	      len_byte -= in_charlen;
@@ -2178,8 +2178,7 @@
 
       if (SYNTAX (c) == Sword)
 	{
-	  bcopy (SDATA (string) + i_byte_orig, o,
-		 i_byte - i_byte_orig);
+	  memcpy (o, SDATA (string) + i_byte_orig, i_byte - i_byte_orig);
 	  o += i_byte - i_byte_orig;
 	}
       else if (i > 0 && SYNTAX (prev_c) == Sword && --word_count)
@@ -2774,7 +2773,7 @@
 	  /* Now add to the end of SUBSTED.  */
 	  if (add_stuff)
 	    {
-	      bcopy (add_stuff, substed + substed_len, add_len);
+	      memcpy (substed + substed_len, add_stuff, add_len);
 	      substed_len += add_len;
 	    }
 	}
--- a/src/sound.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/sound.c	Thu Jul 08 11:50:25 2010 +0000
@@ -550,7 +550,7 @@
   struct wav_header *header = (struct wav_header *) s->header;
 
   if (s->header_size < sizeof *header
-      || bcmp (s->header, "RIFF", 4) != 0)
+      || memcmp (s->header, "RIFF", 4) != 0)
     return 0;
 
   /* WAV files are in little-endian order.  Convert the header
@@ -658,7 +658,7 @@
   struct au_header *header = (struct au_header *) s->header;
 
   if (s->header_size < sizeof *header
-      || bcmp (s->header, ".snd", 4) != 0)
+      || memcmp (s->header, ".snd", 4) != 0)
     return 0;
 
   header->magic_number = be2hl (header->magic_number);
@@ -1380,9 +1380,9 @@
   file = Qnil;
   GCPRO2 (sound, file);
   current_sound_device = (struct sound_device *) xmalloc (sizeof (struct sound_device));
-  bzero (current_sound_device, sizeof (struct sound_device));
+  memset (current_sound_device, 0, sizeof (struct sound_device));
   current_sound = (struct sound *) xmalloc (sizeof (struct sound));
-  bzero (current_sound, sizeof (struct sound));
+  memset (current_sound, 0, sizeof (struct sound));
   record_unwind_protect (sound_cleanup, Qnil);
   current_sound->header = (char *) alloca (MAX_SOUND_HEADER_BYTES);
 
@@ -1405,7 +1405,8 @@
     {
       current_sound->data = attrs[SOUND_DATA];
       current_sound->header_size = min (MAX_SOUND_HEADER_BYTES, SBYTES (current_sound->data));
-      bcopy (SDATA (current_sound->data), current_sound->header, current_sound->header_size);
+      memcpy (current_sound->header, SDATA (current_sound->data),
+	      current_sound->header_size);
     }
 
   /* Find out the type of sound.  Give up if we can't tell.  */
--- a/src/syntax.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/syntax.c	Thu Jul 08 11:50:25 2010 +0000
@@ -1422,7 +1422,7 @@
 	       && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
   string_multibyte = SBYTES (string) > SCHARS (string);
 
-  bzero (fastmap, sizeof fastmap);
+  memset (fastmap, 0, sizeof fastmap);
 
   str = SDATA (string);
   size_byte = SBYTES (string);
@@ -1471,7 +1471,7 @@
 		  || *class_end != ':' || class_end[1] != ']')
 		goto not_a_class_name;
 
-	      bcopy (class_beg, class_name, class_end - class_beg);
+	      memcpy (class_name, class_beg, class_end - class_beg);
 	      class_name[class_end - class_beg] = 0;
 
 	      cc = re_wctype (class_name);
@@ -1532,8 +1532,8 @@
 	  unsigned char fastmap2[0400];
 	  int range_start_byte, range_start_char;
 
-	  bcopy (fastmap2 + 0200, fastmap + 0200, 0200);
-	  bzero (fastmap + 0200, 0200);
+	  memcpy (fastmap + 0200, fastmap2 + 0200, 0200);
+	  memset (fastmap + 0200, 0, 0200);
 	  /* We are sure that this loop stops.  */
 	  for (i = 0200; ! fastmap2[i]; i++);
 	  c = BYTE8_TO_CHAR (i);
@@ -1593,7 +1593,7 @@
 		  || *class_end != ':' || class_end[1] != ']')
 		goto not_a_class_name_multibyte;
 
-	      bcopy (class_beg, class_name, class_end - class_beg);
+	      memcpy (class_name, class_beg, class_end - class_beg);
 	      class_name[class_end - class_beg] = 0;
 
 	      cc = re_wctype (class_name);
@@ -1678,7 +1678,7 @@
 
       if (! multibyte && n_char_ranges > 0)
 	{
-	  bzero (fastmap + 0200, 0200);
+	  memset (fastmap + 0200, 0, 0200);
 	  for (i = 0; i < n_char_ranges; i += 2)
 	    {
 	      int c1 = char_ranges[i];
@@ -1907,7 +1907,7 @@
   multibyte = (!NILP (current_buffer->enable_multibyte_characters)
 	       && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
 
-  bzero (fastmap, sizeof fastmap);
+  memset (fastmap, 0, sizeof fastmap);
 
   if (SBYTES (string) > SCHARS (string))
     /* As this is very rare case (syntax spec is ASCII only), don't
--- a/src/sysdep.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/sysdep.c	Thu Jul 08 11:50:25 2010 +0000
@@ -18,10 +18,7 @@
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
-
 #include <ctype.h>
 #include <signal.h>
 #include <stdio.h>
@@ -79,9 +76,6 @@
 #include "dosfns.h"
 #include "msdos.h"
 #include <sys/param.h>
-
-extern int etext;
-extern unsigned start __asm__ ("start");
 #endif
 
 #include <sys/file.h>
@@ -623,7 +617,7 @@
   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 +849,7 @@
   /* 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 +916,7 @@
       {
 	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
@@ -1511,83 +1505,6 @@
 }
 #endif /* HAVE_PTYS */
 
-#if !defined(CANNOT_DUMP) || !defined(SYSTEM_MALLOC)
-/* Some systems that cannot dump also cannot implement these.  */
-
-/*
- *	Return the address of the start of the text segment prior to
- *	doing an unexec.  After unexec the return value is undefined.
- *	See crt0.c for further explanation and _start.
- *
- */
-
-#if !(defined (__NetBSD__) && defined (__ELF__))
-#ifndef HAVE_TEXT_START
-char *
-start_of_text (void)
-{
-#ifdef TEXT_START
-  return ((char *) TEXT_START);
-#else
-  extern int _start ();
-  return ((char *) _start);
-#endif /* TEXT_START */
-}
-#endif /* not HAVE_TEXT_START */
-#endif
-
-/*
- *	Return the address of the start of the data segment prior to
- *	doing an unexec.  After unexec the return value is undefined.
- *	See crt0.c for further information and definition of data_start.
- *
- *	Apparently, on BSD systems this is etext at startup.  On
- *	USG systems (swapping) this is highly mmu dependent and
- *	is also dependent on whether or not the program is running
- *	with shared text.  Generally there is a (possibly large)
- *	gap between end of text and start of data with shared text.
- *
- *	On Uniplus+ systems with shared text, data starts at a
- *	fixed address.  Each port (from a given oem) is generally
- *	different, and the specific value of the start of data can
- *	be obtained via the UniPlus+ specific "uvar" system call,
- *	however the method outlined in crt0.c seems to be more portable.
- *
- *	Probably what will have to happen when a USG unexec is available,
- *	at least on UniPlus, is temacs will have to be made unshared so
- *	that text and data are contiguous.  Then once loadup is complete,
- *	unexec will produce a shared executable where the data can be
- *	at the normal shared text boundary and the startofdata variable
- *	will be patched by unexec to the correct value.
- *
- */
-
-#ifndef start_of_data
-char *
-start_of_data (void)
-{
-#ifdef DATA_START
-  return ((char *) DATA_START);
-#else
-#ifdef ORDINARY_LINK
-  /*
-   * This is a hack.  Since we're not linking crt0.c or pre_crt0.c,
-   * data_start isn't defined.  We take the address of environ, which
-   * is known to live at or near the start of the system crt0.c, and
-   * we don't sweat the handful of bytes that might lose.
-   */
-  extern char **environ;
-
-  return ((char *) &environ);
-#else
-  extern int data_start;
-  return ((char *) &data_start);
-#endif /* ORDINARY_LINK */
-#endif /* DATA_START */
-}
-#endif /* start_of_data */
-#endif /* NEED_STARTS (not CANNOT_DUMP or not SYSTEM_MALLOC) */
-
 /* init_system_name sets up the string for the Lisp function
    system-name to return. */
 
@@ -1912,7 +1829,6 @@
   /* XXX This needs to be updated for multi-tty support.  Is there
      anybody who needs to emulate select these days?  */
   int nread, i;
-  extern int quit_char;
 
   if (read_socket_hook)
     {
@@ -2715,6 +2631,59 @@
 #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)
--- a/src/term.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/term.c	Thu Jul 08 11:50:25 2010 +0000
@@ -720,7 +720,7 @@
 						  encode_terminal_src_size);
 		  buf = encode_terminal_src + nbytes;
 		}
-	      bcopy (SDATA (string), buf, SBYTES (string));
+	      memcpy (buf, SDATA (string), SBYTES (string));
 	      buf += SBYTES (string);
 	      nchars += SCHARS (string);
 	    }
@@ -1225,8 +1225,8 @@
           = (int *) xmalloc (sizeof (int)
                              + 2 * max_frame_cols * sizeof (int));
 
-      bzero (char_ins_del_vector, (sizeof (int)
-                                   + 2 * max_frame_cols * sizeof (int)));
+      memset (char_ins_del_vector, 0,
+	      (sizeof (int) + 2 * max_frame_cols * sizeof (int)));
 
 
       if (f && (!tty->TS_ins_line && !tty->TS_del_line))
@@ -1893,7 +1893,7 @@
   temp_it.what = IT_CHARACTER;
   temp_it.len = 1;
   temp_it.object = make_number (0);
-  bzero (&temp_it.current, sizeof temp_it.current);
+  memset (&temp_it.current, 0, sizeof temp_it.current);
 
   if (what == IT_CONTINUATION)
     {
@@ -3229,7 +3229,7 @@
     abort ();
 
   t = xmalloc (sizeof (struct tty_output));
-  bzero (t, sizeof (struct tty_output));
+  memset (t, 0, sizeof (struct tty_output));
 
   t->display_info = FRAME_TERMINAL (f)->display_info.tty;
 
@@ -3436,7 +3436,7 @@
 #else
   tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
 #endif
-  bzero (tty, sizeof (struct tty_display_info));
+  memset (tty, 0, sizeof (struct tty_display_info));
   tty->next = tty_list;
   tty_list = tty;
 
@@ -4028,7 +4028,7 @@
   xfree (tty->termcap_strings_buffer);
   xfree (tty->termcap_term_buffer);
 
-  bzero (tty, sizeof (struct tty_display_info));
+  memset (tty, 0, sizeof (struct tty_display_info));
   xfree (tty);
 }
 
--- a/src/termcap.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/termcap.c	Thu Jul 08 11:50:25 2010 +0000
@@ -18,12 +18,7 @@
 Boston, MA 02110-1301, USA.  */
 
 /* Emacs config.h may rename various library functions such as malloc.  */
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
-
-#ifdef emacs
-
 #include <setjmp.h>
 #include <lisp.h>		/* xmalloc is here */
 /* Get the O_* definitions for open et al.  */
@@ -35,31 +30,6 @@
 #include <unistd.h>
 #endif
 
-#else /* not emacs */
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#else
-char *getenv ();
-char *malloc ();
-char *realloc ();
-#endif
-
-/* Do this after the include, in case string.h prototypes bcopy.  */
-#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy)
-#define bcopy(s, d, n) memcpy ((d), (s), (n))
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-
-#endif /* not emacs */
-
 #ifndef NULL
 #define NULL (char *) 0
 #endif
@@ -89,37 +59,6 @@
 #define TERMCAP_FILE "/etc/termcap"
 #endif
 
-#ifndef emacs
-static void
-memory_out ()
-{
-  write (2, "virtual memory exhausted\n", 25);
-  exit (1);
-}
-
-static char *
-xmalloc (size)
-     unsigned size;
-{
-  register char *tem = malloc (size);
-
-  if (!tem)
-    memory_out ();
-  return tem;
-}
-
-static char *
-xrealloc (ptr, size)
-     char *ptr;
-     unsigned size;
-{
-  register char *tem = realloc (ptr, size);
-
-  if (!tem)
-    memory_out ();
-  return tem;
-}
-#endif /* not emacs */
 
 /* Looking up capabilities in the entry already found.  */
 
@@ -315,7 +254,7 @@
 
 	cut[last_p_param].len = r - cut[last_p_param].beg;
 	for (i = 0, wp = ret; i <= last_p_param; wp += cut[i++].len)
-	  bcopy (cut[i].beg, wp, cut[i].len);
+	  memcpy (wp, cut[i].beg, cut[i].len);
 	r = wp;
       }
   }
@@ -739,7 +678,7 @@
       else
 	{
 	  append_end -= bufp->ptr - buf;
-	  bcopy (bufp->ptr, buf, bufp->full -= bufp->ptr - buf);
+	  memcpy (buf, bufp->ptr, bufp->full -= bufp->ptr - buf);
 	  bufp->ptr = buf;
 	}
       if (!(nread = read (fd, buf + bufp->full, bufp->size - bufp->full)))
--- a/src/termhooks.h	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/termhooks.h	Thu Jul 08 11:50:25 2010 +0000
@@ -255,7 +255,7 @@
   Lisp_Object arg;
 };
 
-#define EVENT_INIT(event) bzero (&(event), sizeof (struct input_event))
+#define EVENT_INIT(event) memset (&(event), 0, sizeof (struct input_event))
 
 /* Bits in the modifiers member of the input_event structure.
    Note that reorder_modifiers assumes that the bits are in canonical
--- a/src/tparam.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/tparam.c	Thu Jul 08 11:50:25 2010 +0000
@@ -18,66 +18,14 @@
 Boston, MA 02110-1301, USA.  */
 
 /* Emacs config.h may rename various library functions such as malloc.  */
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
-
-#ifdef emacs
 #include <setjmp.h>
 #include "lisp.h"		/* for xmalloc */
-#else
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#else
-char *malloc ();
-char *realloc ();
-#endif
-
-/* Do this after the include, in case string.h prototypes bcopy.  */
-#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy)
-#define bcopy(s, d, n) memcpy ((d), (s), (n))
-#endif
-
-#endif /* not emacs */
 
 #ifndef NULL
 #define NULL (char *) 0
 #endif
 
-#ifndef emacs
-static void
-memory_out ()
-{
-  write (2, "virtual memory exhausted\n", 25);
-  exit (1);
-}
-
-static char *
-xmalloc (size)
-     unsigned size;
-{
-  register char *tem = malloc (size);
-
-  if (!tem)
-    memory_out ();
-  return tem;
-}
-
-static char *
-xrealloc (ptr, size)
-     char *ptr;
-     unsigned size;
-{
-  register char *tem = realloc (ptr, size);
-
-  if (!tem)
-    memory_out ();
-  return tem;
-}
-#endif /* not emacs */
-
 /* Assuming STRING is the value of a termcap string entry
    containing `%' constructs to expand parameters,
    merge in parameter values and store result in block OUTSTRING points to.
@@ -151,7 +99,7 @@
 	    {
 	      outlen = len + 40;
 	      new = (char *) xmalloc (outlen);
-	      bcopy (outstring, new, offset);
+	      memcpy (new, outstring, offset);
 	    }
 	  else
 	    {
--- a/src/unexaix.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/unexaix.c	Thu Jul 08 11:50:25 2010 +0000
@@ -71,7 +71,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-extern char *start_of_text (void);		/* Start of text */
+char *start_of_text (void);		        /* Start of text */
 extern char *start_of_data (void);		/* Start of initialized data */
 
 extern int _data;
@@ -669,5 +669,18 @@
   return 0;
 }
 
+/*
+ *	Return the address of the start of the text segment prior to
+ *	doing an unexec.  After unexec the return value is undefined.
+ *	See crt0.c for further explanation and _start.
+ *
+ */
+
+char *
+start_of_text (void)
+{
+  return ((char *) 0x10000000);
+}
+
 /* arch-tag: 0783857a-7c2d-456f-a426-58b722d69fd0
    (do not change this comment) */
--- a/src/unexalpha.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/unexalpha.c	Thu Jul 08 11:50:25 2010 +0000
@@ -28,9 +28,7 @@
 #include <sys/mman.h>
 #include <stdio.h>
 #include <errno.h>
-#ifdef HAVE_STRING_H
 #include <string.h>
-#endif
 #if !defined (__NetBSD__) && !defined (__OpenBSD__)
 #include <filehdr.h>
 #include <aouthdr.h>
@@ -79,8 +77,10 @@
 #define	_RDATA		".rdata"
 #define	_SDATA		".sdata"
 #define	_SBSS		".sbss"
+#define TEXT_START     0x120000000
 #endif /* __NetBSD__ || __OpenBSD__ */
 
+
 static void fatal_unexec (char *, char *);
 static void mark_x (char *);
 
@@ -260,7 +260,7 @@
 
   Brk = brk;
 
-  bcopy (data_section, &old_data_scnhdr, sizeof (old_data_scnhdr));
+  memcpy (&old_data_scnhdr, data_section, sizeof (old_data_scnhdr));
 
   nhdr.aout.dsize = brk - DATA_START;
   nhdr.aout.bsize = 0;
@@ -328,7 +328,7 @@
 #ifdef _GOT
   if (got_section != NULL)
     {
-      bcopy (got_section, buffer, sizeof (struct scnhdr));
+      memcpy (buffer, got_section, sizeof (struct scnhdr));
 
       got_section->s_vaddr = vaddr;
       got_section->s_paddr = vaddr;
@@ -376,7 +376,7 @@
    * Construct new symbol table header
    */
 
-  bcopy (oldptr + nhdr.fhdr.f_symptr, buffer, cbHDRR);
+  memcpy (buffer, oldptr + nhdr.fhdr.f_symptr, cbHDRR);
 
 #define symhdr ((pHDRR)buffer)
   newsyms = nhdr.aout.tsize + nhdr.aout.dsize;
--- a/src/unexec.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/unexec.c	Thu Jul 08 11:50:25 2010 +0000
@@ -472,7 +472,7 @@
   int pagesize = getpagesize ();
   char zeros[1 << 13];
 
-  bzero (zeros, sizeof (zeros));
+  memset (zeros, 0, sizeof (zeros));
 
   for (i = 0; ptr < end;)
     {
@@ -687,6 +687,21 @@
   return 0;
 }
 
+extern unsigned start __asm__ ("start");
+
+/*
+ *	Return the address of the start of the text segment prior to
+ *	doing an unexec.  After unexec the return value is undefined.
+ *	See crt0.c for further explanation and _start.
+ *
+ */
+
+char *
+start_of_text (void)
+{
+  return ((char *) &start);
+}
+
 /* ****************************************************************
  * unexec
  *
--- a/src/unexmacosx.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/unexmacosx.c	Thu Jul 08 11:50:25 2010 +0000
@@ -218,7 +218,7 @@
   char buf[UNEXEC_COPY_BUFSZ];
   ssize_t bytes;
 
-  bzero (buf, UNEXEC_COPY_BUFSZ);
+  memset (buf, 0, UNEXEC_COPY_BUFSZ);
   if (lseek (outfd, dest, SEEK_SET) != dest)
     return 0;
 
--- a/src/vm-limit.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/vm-limit.c	Thu Jul 08 11:50:25 2010 +0000
@@ -244,6 +244,46 @@
     (*warn_function) ("Warning: memory in use exceeds lisp pointer size");
 }
 
+#if !defined(CANNOT_DUMP) || !defined(SYSTEM_MALLOC)
+/* Some systems that cannot dump also cannot implement these.  */
+
+/*
+ *	Return the address of the start of the data segment prior to
+ *	doing an unexec.  After unexec the return value is undefined.
+ *	See crt0.c for further information and definition of data_start.
+ *
+ *	Apparently, on BSD systems this is etext at startup.  On
+ *	USG systems (swapping) this is highly mmu dependent and
+ *	is also dependent on whether or not the program is running
+ *	with shared text.  Generally there is a (possibly large)
+ *	gap between end of text and start of data with shared text.
+ *
+ */
+
+POINTER
+start_of_data (void)
+{
+#ifdef BSD_SYSTEM
+  extern char etext;
+  return (POINTER)(&etext);
+#elif defined DATA_START
+  return ((POINTER) DATA_START);
+#elif defined ORDINARY_LINK
+  /*
+   * This is a hack.  Since we're not linking crt0.c or pre_crt0.c,
+   * data_start isn't defined.  We take the address of environ, which
+   * is known to live at or near the start of the system crt0.c, and
+   * we don't sweat the handful of bytes that might lose.
+   */
+  extern char **environ;
+  return ((POINTER) &environ);
+#else
+  extern int data_start;
+  return ((POINTER) &data_start);
+#endif
+}
+#endif /* (not CANNOT_DUMP or not SYSTEM_MALLOC) */
+
 /* Enable memory usage warnings.
    START says where the end of pure storage is.
    WARNFUN specifies the function to call to issue a warning.  */
--- a/src/w16select.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/w16select.c	Thu Jul 08 11:50:25 2010 +0000
@@ -109,7 +109,7 @@
 
 /* Return the WinOldAp support version, or 0x1700 if not supported.  */
 unsigned
-identify_winoldap_version ()
+identify_winoldap_version (void)
 {
   __dpmi_regs regs;
 
@@ -124,7 +124,7 @@
 
 /* Open the clipboard, return non-zero if successfull.  */
 unsigned
-open_clipboard ()
+open_clipboard (void)
 {
   __dpmi_regs regs;
 
@@ -147,7 +147,7 @@
 
 /* Empty clipboard, return non-zero if successfull.  */
 unsigned
-empty_clipboard ()
+empty_clipboard (void)
 {
   __dpmi_regs regs;
 
@@ -162,8 +162,7 @@
 /* Ensure we have a buffer in low memory with enough memory for data
    of size WANT_SIZE.  Return the linear address of the buffer.  */
 static unsigned long
-alloc_xfer_buf (want_size)
-     unsigned want_size;
+alloc_xfer_buf (unsigned want_size)
 {
   __dpmi_regs regs;
 
@@ -200,7 +199,7 @@
    The clipboard buffer tends to be large in size, because for small
    clipboard data sizes we use the DJGPP transfer buffer.  */
 static void
-free_xfer_buf ()
+free_xfer_buf (void)
 {
   /* If the size is 0, we used DJGPP transfer buffer, so don't free.  */
   if (clipboard_xfer_buf_info.size)
@@ -218,11 +217,7 @@
 
 /* Copy data into the clipboard, return zero if successfull.  */
 unsigned
-set_clipboard_data (Format, Data, Size, Raw)
-     unsigned Format;
-     void *Data;
-     unsigned Size;
-     int Raw;
+set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
 {
   __dpmi_regs regs;
   unsigned truelen;
@@ -321,8 +316,7 @@
 
 /* Return the size of the clipboard data of format FORMAT.  */
 unsigned
-get_clipboard_data_size (Format)
-     unsigned Format;
+get_clipboard_data_size (unsigned Format)
 {
   __dpmi_regs regs;
 
@@ -342,11 +336,7 @@
    Warning: this doesn't check whether DATA has enough space to hold
    SIZE bytes.  */
 unsigned
-get_clipboard_data (Format, Data, Size, Raw)
-     unsigned Format;
-     void *Data;
-     unsigned Size;
-     int Raw;
+get_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
 {
   __dpmi_regs regs;
   unsigned long xbuf_addr;
@@ -425,7 +415,7 @@
 
 /* Close clipboard, return non-zero if successfull.  */
 unsigned
-close_clipboard ()
+close_clipboard (void)
 {
   __dpmi_regs regs;
 
@@ -439,8 +429,7 @@
 
 /* Compact clipboard data so that at least SIZE bytes is available.  */
 unsigned
-clipboard_compact (Size)
-     unsigned Size;
+clipboard_compact (unsigned Size)
 {
   __dpmi_regs regs;
 
@@ -705,7 +694,7 @@
 }
 
 void
-syms_of_win16select ()
+syms_of_win16select (void)
 {
   defsubr (&Sw16_set_clipboard_data);
   defsubr (&Sw16_get_clipboard_data);
--- a/src/w32fns.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/w32fns.c	Thu Jul 08 11:50:25 2010 +0000
@@ -2746,7 +2746,7 @@
       {
   	PAINTSTRUCT paintStruct;
         RECT update_rect;
-	bzero (&update_rect, sizeof (update_rect));
+	memset (&update_rect, 0, sizeof (update_rect));
 
 	f = x_window_to_frame (dpyinfo, hwnd);
 	if (f == 0)
@@ -4275,7 +4275,7 @@
   f->output_method = output_w32;
   f->output_data.w32 =
     (struct w32_output *) xmalloc (sizeof (struct w32_output));
-  bzero (f->output_data.w32, sizeof (struct w32_output));
+  memset (f->output_data.w32, 0, sizeof (struct w32_output));
   FRAME_FONTSET (f) = -1;
 
   f->icon_name
@@ -5388,7 +5388,7 @@
   f->output_method = output_w32;
   f->output_data.w32 =
     (struct w32_output *) xmalloc (sizeof (struct w32_output));
-  bzero (f->output_data.w32, sizeof (struct w32_output));
+  memset (f->output_data.w32, 0, sizeof (struct w32_output));
 
   FRAME_FONTSET (f)  = -1;
   f->icon_name = Qnil;
@@ -6046,7 +6046,7 @@
     specbind (Qinhibit_redisplay, Qt);
     BLOCK_INPUT;
 
-    bzero (&new_file_details, sizeof (new_file_details));
+    memset (&new_file_details, 0, sizeof (new_file_details));
     /* Apparently NT4 crashes if you give it an unexpected size.
        I'm not sure about Windows 9x, so play it safe.  */
     if (w32_major_version > 4 && w32_major_version < 95)
@@ -6157,10 +6157,10 @@
     /* On Windows, write permission is required to delete/move files.  */
     _chmod (path, 0666);
 
-    bzero (tmp_path, sizeof (tmp_path));
+    memset (tmp_path, 0, sizeof (tmp_path));
     strcpy (tmp_path, path);
 
-    bzero (&file_op, sizeof (file_op));
+    memset (&file_op, 0, sizeof (file_op));
     file_op.hwnd = HWND_DESKTOP;
     file_op.wFunc = FO_DELETE;
     file_op.pFrom = tmp_path;
--- a/src/w32font.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/w32font.c	Thu Jul 08 11:50:25 2010 +0000
@@ -225,7 +225,7 @@
   HDC dc;
   FRAME_PTR f = XFRAME (frame);
 
-  bzero (&font_match_pattern, sizeof (font_match_pattern));
+  memset (&font_match_pattern, 0, sizeof (font_match_pattern));
   font_match_pattern.lfCharSet = DEFAULT_CHARSET;
 
   dc = get_frame_dc (f);
@@ -373,7 +373,7 @@
 
   if (metrics)
     {
-      bzero (metrics, sizeof (struct font_metrics));
+      memset (metrics, 0, sizeof (struct font_metrics));
       metrics->ascent = font->ascent;
       metrics->descent = font->descent;
 
@@ -394,9 +394,9 @@
 		  = xrealloc (w32_font->cached_metrics,
 			      (block + 1)
 			      * sizeof (struct w32_metric_cache *));
-	      bzero (w32_font->cached_metrics + w32_font->n_cache_blocks,
-		     ((block + 1 - w32_font->n_cache_blocks)
-		      * sizeof (struct w32_metric_cache *)));
+	      memset (w32_font->cached_metrics + w32_font->n_cache_blocks, 0,
+		      ((block + 1 - w32_font->n_cache_blocks)
+		       * sizeof (struct w32_metric_cache *)));
 	      w32_font->n_cache_blocks = block + 1;
 	    }
 
@@ -404,8 +404,8 @@
 	    {
 	      w32_font->cached_metrics[block]
 		= xmalloc (CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
-	      bzero (w32_font->cached_metrics[block],
-		     CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
+	      memset (w32_font->cached_metrics[block], 0,
+		      CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
 	    }
 
 	  char_metric = w32_font->cached_metrics[block] + pos_in_block;
@@ -706,7 +706,7 @@
   match_data.list = Qnil;
   match_data.frame = frame;
 
-  bzero (&match_data.pattern, sizeof (LOGFONT));
+  memset (&match_data.pattern, 0, sizeof (LOGFONT));
   fill_in_logfont (f, &match_data.pattern, font_spec);
 
   /* If the charset is unrecognized, then we won't find a font, so don't
@@ -759,7 +759,7 @@
   match_data.frame = frame;
   match_data.list = Qnil;
 
-  bzero (&match_data.pattern, sizeof (LOGFONT));
+  memset (&match_data.pattern, 0, sizeof (LOGFONT));
   fill_in_logfont (f, &match_data.pattern, font_spec);
 
   match_data.opentype_only = opentype_only;
@@ -795,7 +795,7 @@
   if (!font)
     return 0;
 
-  bzero (&logfont, sizeof (logfont));
+  memset (&logfont, 0, sizeof (logfont));
   fill_in_logfont (f, &logfont, font_entity);
 
   /* Prefer truetype fonts, to avoid known problems with type1 fonts, and
@@ -824,8 +824,8 @@
     {
       metrics = (OUTLINETEXTMETRICW *) alloca (len);
       if (GetOutlineTextMetricsW (dc, len, metrics))
-        bcopy (&metrics->otmTextMetrics, &w32_font->metrics,
-               sizeof (TEXTMETRICW));
+        memcpy (&w32_font->metrics, &metrics->otmTextMetrics,
+		sizeof (TEXTMETRICW));
       else
         metrics = NULL;
     }
@@ -2306,7 +2306,7 @@
   if (w32_font->glyph_idx)
     options |= GGO_GLYPH_INDEX;
 
-  bzero (&transform, sizeof (transform));
+  memset (&transform, 0, sizeof (transform));
   transform.eM11.value = 1;
   transform.eM22.value = 1;
 
@@ -2340,8 +2340,8 @@
   HANDLE oldobj;
   char buf[100];
 
-  bzero (&cf, sizeof (cf));
-  bzero (&lf, sizeof (lf));
+  memset (&cf, 0, sizeof (cf));
+  memset (&lf, 0, sizeof (lf));
 
   cf.lStructSize = sizeof (cf);
   cf.hwndOwner = FRAME_W32_WINDOW (f);
--- a/src/w32menu.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/w32menu.c	Thu Jul 08 11:50:25 2010 +0000
@@ -450,8 +450,8 @@
 
       /* Save the frame's previous menu bar contents data.  */
       if (previous_menu_items_used)
-	bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items,
-	       previous_menu_items_used * sizeof (Lisp_Object));
+	memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
+		previous_menu_items_used * sizeof (Lisp_Object));
 
       /* Fill in menu_items with the current menu bar contents.
 	 This can evaluate Lisp code.  */
@@ -1522,7 +1522,7 @@
       if (set_menu_item_info)
 	{
 	  MENUITEMINFO info;
-	  bzero (&info, sizeof (info));
+	  memset (&info, 0, sizeof (info));
 	  info.cbSize = sizeof (info);
 	  info.fMask = MIIM_DATA;
 
@@ -1605,7 +1605,7 @@
 	{
 	  MENUITEMINFO info;
 
-	  bzero (&info, sizeof (info));
+	  memset (&info, 0, sizeof (info));
 	  info.cbSize = sizeof (info);
 	  info.fMask = MIIM_DATA;
 	  get_menu_item_info (menu, item, FALSE, &info);
@@ -1642,7 +1642,7 @@
   for (i = 0; i < num; i++)
     {
       MENUITEMINFO info;
-      bzero (&info, sizeof (info));
+      memset (&info, 0, sizeof (info));
       info.cbSize = sizeof (info);
       info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_SUBMENU;
 
--- a/src/w32term.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/w32term.c	Thu Jul 08 11:50:25 2010 +0000
@@ -323,7 +323,7 @@
 XCreateGC (void *ignore, Window window, unsigned long mask, XGCValues *xgcv)
 {
   XGCValues *gc = (XGCValues *) xmalloc (sizeof (XGCValues));
-  bzero (gc, sizeof (XGCValues));
+  memset (gc, 0, sizeof (XGCValues));
 
   XChangeGC (ignore, gc, mask, xgcv);
 
@@ -5826,7 +5826,7 @@
 {
   struct w32_display_info *dpyinfo = &one_w32_display_info;
 
-  bzero (dpyinfo, sizeof (*dpyinfo));
+  memset (dpyinfo, 0, sizeof (*dpyinfo));
 
   /* Put it on w32_display_name_list.  */
   w32_display_name_list = Fcons (Fcons (display_name, Qnil),
--- a/src/w32uniscribe.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/w32uniscribe.c	Thu Jul 08 11:50:25 2010 +0000
@@ -97,7 +97,7 @@
   HDC dc;
   FRAME_PTR f = XFRAME (frame);
 
-  bzero (&font_match_pattern, sizeof (font_match_pattern));
+  memset (&font_match_pattern, 0, sizeof (font_match_pattern));
   /* Limit enumerated fonts to outline fonts to save time.  */
   font_match_pattern.lfOutPrecision = OUT_OUTLINE_PRECIS;
 
--- a/src/w32xfns.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/w32xfns.c	Thu Jul 08 11:50:25 2010 +0000
@@ -178,7 +178,7 @@
 
   if (nQueue)
     {
-      bcopy (&(lpHead->w32msg), lpmsg, sizeof (W32Msg));
+      memcpy (lpmsg, &lpHead->w32msg, sizeof (W32Msg));
 
       {
 	int_msg * lpCur = lpHead;
@@ -250,7 +250,7 @@
   if (!lpNew)
     return (FALSE);
 
-  bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg));
+  memcpy (&lpNew->w32msg, lpmsg, sizeof (W32Msg));
   lpNew->lpNext = NULL;
 
   enter_crit ();
@@ -280,7 +280,7 @@
   if (!lpNew)
     return (FALSE);
 
-  bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg));
+  memcpy (&lpNew->w32msg, lpmsg, sizeof (W32Msg));
 
   enter_crit ();
 
--- a/src/window.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/window.c	Thu Jul 08 11:50:25 2010 +0000
@@ -243,9 +243,9 @@
   p->dedicated = Qnil;
   p->window_parameters = Qnil;
   p->pseudo_window_p = 0;
-  bzero (&p->cursor, sizeof (p->cursor));
-  bzero (&p->last_cursor, sizeof (p->last_cursor));
-  bzero (&p->phys_cursor, sizeof (p->phys_cursor));
+  memset (&p->cursor, 0, sizeof (p->cursor));
+  memset (&p->last_cursor, 0, sizeof (p->last_cursor));
+  memset (&p->phys_cursor, 0, sizeof (p->phys_cursor));
   p->desired_matrix = p->current_matrix = 0;
   p->nrows_scale_factor = p->ncols_scale_factor = 1;
   p->phys_cursor_type = -1;
@@ -1557,9 +1557,9 @@
   p->total_lines = o->total_lines;
   p->desired_matrix = p->current_matrix = 0;
   p->vscroll = 0;
-  bzero (&p->cursor, sizeof (p->cursor));
-  bzero (&p->last_cursor, sizeof (p->last_cursor));
-  bzero (&p->phys_cursor, sizeof (p->phys_cursor));
+  memset (&p->cursor, 0, sizeof (p->cursor));
+  memset (&p->last_cursor, 0, sizeof (p->last_cursor));
+  memset (&p->phys_cursor, 0, sizeof (p->phys_cursor));
   p->phys_cursor_type = -1;
   p->phys_cursor_width = -1;
   p->must_be_updated_p = 0;
@@ -3481,7 +3481,7 @@
 
   XSETFASTINT (w->window_end_pos, 0);
   XSETFASTINT (w->window_end_vpos, 0);
-  bzero (&w->last_cursor, sizeof w->last_cursor);
+  memset (&w->last_cursor, 0, sizeof w->last_cursor);
   w->window_end_valid = Qnil;
   if (!(keep_margins_p && samebuf))
     { /* If we're not actually changing the buffer, don't reset hscroll and
@@ -3948,7 +3948,7 @@
   p->parent = o->parent;
   p->buffer = Qt;
   p->window_end_valid = Qnil;
-  bzero (&p->last_cursor, sizeof p->last_cursor);
+  memset (&p->last_cursor, 0, sizeof p->last_cursor);
 
   /* Duplicate special geometry settings.  */
 
--- a/src/xdisp.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/xdisp.c	Thu Jul 08 11:50:25 2010 +0000
@@ -2576,7 +2576,7 @@
     }
 
   /* Clear IT.  */
-  bzero (it, sizeof *it);
+  memset (it, 0, sizeof *it);
   it->current.overlay_string_index = -1;
   it->current.dpvec_index = -1;
   it->base_face_id = remapped_base_face_id;
@@ -4912,7 +4912,7 @@
 	  entries =							\
             (struct overlay_entry *) alloca (new_size			\
 					     * sizeof *entries);	\
-	  bcopy (old, entries, size * sizeof *entries);			\
+	  memcpy (entries, old, size * sizeof *entries);		\
 	  size = new_size;						\
 	}								\
 									\
@@ -5630,7 +5630,7 @@
   it->stop_charpos = -1;
 
   /* Set iterator position and end position.  */
-  bzero (&it->current, sizeof it->current);
+  memset (&it->current, 0, sizeof it->current);
   it->current.overlay_string_index = -1;
   it->current.dpvec_index = -1;
   xassert (charpos >= 0);
@@ -7999,7 +7999,7 @@
 
   len = SBYTES (msg) + 1;
   SAFE_ALLOCA (buffer, char *, len);
-  bcopy (SDATA (msg), buffer, len);
+  memcpy (buffer, SDATA (msg), len);
 
   message_dolog (buffer, len - 1, 1, 0);
   SAFE_FREE ();
@@ -8328,7 +8328,7 @@
       USE_SAFE_ALLOCA;
 
       SAFE_ALLOCA (buffer, char *, nbytes);
-      bcopy (SDATA (m), buffer, nbytes);
+      memcpy (buffer, SDATA (m), nbytes);
       message_dolog (buffer, nbytes, 1, multibyte);
       SAFE_FREE ();
     }
@@ -9630,12 +9630,7 @@
    Re-allocate mode_line_noprop_buf if necessary.  */
 
 static void
-#ifdef PROTOTYPES
 store_mode_line_noprop_char (char c)
-#else
-store_mode_line_noprop_char (c)
-    char c;
-#endif
 {
   /* If output position has reached the end of the allocated buffer,
      double the buffer's size.  */
@@ -9754,7 +9749,7 @@
 	 higher level than this.)  */
       if (! STRINGP (f->name)
 	  || SBYTES (f->name) != len
-	  || bcmp (title, SDATA (f->name), len) != 0)
+	  || memcmp (title, SDATA (f->name), len) != 0)
 	x_implicitly_set_name (f, make_string (title, len), Qnil);
     }
 }
@@ -16763,7 +16758,7 @@
 	  saved_pos = it->position;
 
 	  it->what = IT_CHARACTER;
-	  bzero (&it->position, sizeof it->position);
+	  memset (&it->position, 0, sizeof it->position);
 	  it->object = make_number (0);
 	  it->c = ' ';
 	  it->len = 1;
@@ -16883,7 +16878,7 @@
 		(((it->ascent + it->descent)
 		  * FONT_BASE (font)) / FONT_HEIGHT (font));
 	      saved_pos = it->position;
-	      bzero (&it->position, sizeof it->position);
+	      memset (&it->position, 0, sizeof it->position);
 	      saved_avoid_cursor = it->avoid_cursor_p;
 	      it->avoid_cursor_p = 1;
 	      saved_face_id = it->face_id;
@@ -16916,7 +16911,7 @@
       saved_pos = it->position;
 
       it->what = IT_CHARACTER;
-      bzero (&it->position, sizeof it->position);
+      memset (&it->position, 0, sizeof it->position);
       it->object = make_number (0);
       it->c = ' ';
       it->len = 1;
@@ -19259,7 +19254,7 @@
 	  eol_str = invalid_eol_type;
 	  eol_str_len = sizeof (invalid_eol_type) - 1;
 	}
-      bcopy (eol_str, buf, eol_str_len);
+      memcpy (buf, eol_str, eol_str_len);
       buf += eol_str_len;
     }
 
@@ -20397,7 +20392,7 @@
 		   XChar2b *char2b, struct window *w, struct glyph_row *row,
 		   enum glyph_row_area area, int start, enum draw_glyphs_face hl)
 {
-  bzero (s, sizeof *s);
+  memset (s, 0, sizeof *s);
   s->w = w;
   s->f = XFRAME (w->frame);
 #ifdef HAVE_NTGUI
--- a/src/xfaces.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/xfaces.c	Thu Jul 08 11:50:25 2010 +0000
@@ -764,7 +764,7 @@
 {
   GC gc = xmalloc (sizeof (*gc));
   if (gc)
-      bcopy (xgcv, gc, sizeof (XGCValues));
+    memcpy (gc, xgcv, sizeof (XGCValues));
   return gc;
 }
 
@@ -2190,8 +2190,8 @@
   lface = lface_from_face_name_no_resolve (f, face_name, signal_p);
 
   if (! NILP (lface))
-    bcopy (XVECTOR (lface)->contents, attrs,
-	   LFACE_VECTOR_SIZE * sizeof *attrs);
+    memcpy (attrs, XVECTOR (lface)->contents,
+	    LFACE_VECTOR_SIZE * sizeof *attrs);
 
   return !NILP (lface);
 }
@@ -2861,8 +2861,8 @@
       copy = Finternal_make_lisp_face (to, new_frame);
     }
 
-  bcopy (XVECTOR (lface)->contents, XVECTOR (copy)->contents,
-	 LFACE_VECTOR_SIZE * sizeof (Lisp_Object));
+  memcpy (XVECTOR (copy)->contents, XVECTOR (lface)->contents,
+	  LFACE_VECTOR_SIZE * sizeof (Lisp_Object));
 
   /* Changing a named face means that all realized faces depending on
      that face are invalid.  Since we cannot tell which realized faces
@@ -3890,9 +3890,9 @@
 	{
 	  /* Ensure that the face vector is fully specified by merging
 	     the previously-cached vector.  */
-	  bcopy (oldface->lface, attrs, sizeof attrs);
+	  memcpy (attrs, oldface->lface, sizeof attrs);
 	  merge_face_vectors (f, lvec, attrs, 0);
-	  bcopy (attrs, lvec, sizeof attrs);
+	  memcpy (lvec, attrs, sizeof attrs);
 	  newface = realize_face (c, lvec, DEFAULT_FACE_ID);
 
 	  if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX])
@@ -3997,7 +3997,7 @@
       if (SBYTES (v1) != SBYTES (v2))
 	return 0;
 
-      return bcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0;
+      return memcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0;
 
     case_Lisp_Int:
     case Lisp_Symbol:
@@ -4169,9 +4169,9 @@
 make_realized_face (Lisp_Object *attr)
 {
   struct face *face = (struct face *) xmalloc (sizeof *face);
-  bzero (face, sizeof *face);
+  memset (face, 0, sizeof *face);
   face->ascii_face = face;
-  bcopy (attr, face->lface, sizeof face->lface);
+  memcpy (face->lface, attr, sizeof face->lface);
   return face;
 }
 
@@ -4316,10 +4316,10 @@
   int size;
 
   c = (struct face_cache *) xmalloc (sizeof *c);
-  bzero (c, sizeof *c);
+  memset (c, 0, sizeof *c);
   size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
   c->buckets = (struct face **) xmalloc (size);
-  bzero (c->buckets, size);
+  memset (c->buckets, 0, size);
   c->size = 50;
   c->faces_by_id = (struct face **) xmalloc (c->size * sizeof *c->faces_by_id);
   c->f = f;
@@ -4383,7 +4383,7 @@
 
       c->used = 0;
       size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
-      bzero (c->buckets, size);
+      memset (c->buckets, 0, size);
 
       /* Must do a thorough redisplay the next time.  Mark current
 	 matrices as invalid because they will reference faces freed
@@ -4680,7 +4680,7 @@
   if (! get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
     return -1;
 
-  bcopy (default_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, default_face->lface, sizeof attrs);
   merge_face_vectors (f, symbol_attrs, attrs, 0);
 
   return lookup_face (f, attrs);
@@ -4781,7 +4781,7 @@
   steps = eabs (steps);
 
   face = FACE_FROM_ID (f, face_id);
-  bcopy (face->lface, attrs, sizeof attrs);
+  memcpy (attrs, face->lface, sizeof attrs);
   pt = last_pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]);
   new_face_id = face_id;
   last_height = FONT_HEIGHT (face->font);
@@ -4832,7 +4832,7 @@
     return face_id;
 
   face = FACE_FROM_ID (f, face_id);
-  bcopy (face->lface, attrs, sizeof attrs);
+  memcpy (attrs, face->lface, sizeof attrs);
   attrs[LFACE_HEIGHT_INDEX] = make_number (height);
   font_clear_prop (attrs, FONT_SIZE_INDEX);
   face_id = lookup_face (f, attrs);
@@ -4862,7 +4862,7 @@
   if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
     return -1;
 
-  bcopy (default_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, default_face->lface, sizeof attrs);
   merge_face_vectors (f, symbol_attrs, attrs, 0);
   return lookup_face (f, attrs);
 }
@@ -4953,7 +4953,7 @@
       Lisp_Object merged_attrs[LFACE_VECTOR_SIZE];
       int i;
 
-      bcopy (def_attrs, merged_attrs, sizeof merged_attrs);
+      memcpy (merged_attrs, def_attrs, sizeof merged_attrs);
 
       merge_face_vectors (f, attrs, merged_attrs, 0);
 
@@ -5274,7 +5274,7 @@
   int indices[DIM (font_sort_order)];
 
   CHECK_LIST (order);
-  bzero (indices, sizeof indices);
+  memset (indices, 0, sizeof indices);
   i = 0;
 
   for (list = order;
@@ -5306,9 +5306,9 @@
     if (indices[i] == 0)
       signal_error ("Invalid font sort order", order);
 
-  if (bcmp (indices, font_sort_order, sizeof indices) != 0)
-    {
-      bcopy (indices, font_sort_order, sizeof font_sort_order);
+  if (memcmp (indices, font_sort_order, sizeof indices) != 0)
+    {
+      memcpy (font_sort_order, indices, sizeof font_sort_order);
       free_all_realized_faces (Qnil);
     }
 
@@ -5553,7 +5553,7 @@
   /* Realize the face; it must be fully-specified now.  */
   xassert (lface_fully_specified_p (XVECTOR (lface)->contents));
   check_lface (lface);
-  bcopy (XVECTOR (lface)->contents, attrs, sizeof attrs);
+  memcpy (attrs, XVECTOR (lface)->contents, sizeof attrs);
   face = realize_face (c, attrs, DEFAULT_FACE_ID);
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -6074,7 +6074,7 @@
     {
       Lisp_Object attrs[LFACE_VECTOR_SIZE];
       struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
-      bcopy (default_face->lface, attrs, sizeof attrs);
+      memcpy (attrs, default_face->lface, sizeof attrs);
       merge_face_ref (f, prop, attrs, 1, 0);
       face_id = lookup_face (f, attrs);
     }
@@ -6163,7 +6163,7 @@
     return default_face->id;
 
   /* Begin with attributes from the default face.  */
-  bcopy (default_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, default_face->lface, sizeof attrs);
 
   /* Merge in attributes specified via text properties.  */
   if (!NILP (prop))
@@ -6257,7 +6257,7 @@
     return DEFAULT_FACE_ID;
 
   /* Begin with attributes from the default face.  */
-  bcopy (default_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, default_face->lface, sizeof attrs);
 
   /* Merge in attributes specified via text properties.  */
   if (!NILP (prop))
@@ -6358,7 +6358,7 @@
     return base_face->id;
 
   /* Begin with attributes from the base face.  */
-  bcopy (base_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, base_face->lface, sizeof attrs);
 
   /* Merge in attributes specified via text properties.  */
   if (!NILP (prop))
@@ -6413,7 +6413,7 @@
     }
 
   /* Begin with attributes from the base face.  */
-  bcopy (base_face->lface, attrs, sizeof attrs);
+  memcpy (attrs, base_face->lface, sizeof attrs);
 
   if (!NILP (face_name))
     {
--- a/src/xfns.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/xfns.c	Thu Jul 08 11:50:25 2010 +0000
@@ -1925,7 +1925,7 @@
     { /* There is no base font name, use the default.  */
       int len = strlen (base_fontname) + 2;
       fontsetname = xmalloc (len);
-      bzero (fontsetname, len);
+      memset (fontsetname, 0, len);
       strcpy (fontsetname, base_fontname);
     }
   else
@@ -1946,7 +1946,7 @@
 	     Use the specified font plus the default.  */
 	  int len = strlen (base_fontname) + strlen (xic_defaut_fontset) + 3;
 	  fontsetname = xmalloc (len);
-	  bzero (fontsetname, len);
+	  memset (fontsetname, 0, len);
 	  strcpy (fontsetname, base_fontname);
 	  strcat (fontsetname, sep);
 	  strcat (fontsetname, xic_defaut_fontset);
@@ -1983,7 +1983,7 @@
 	      int diff = (p2 - p3) - 2;
 
 	      base = alloca (strlen (base_fontname) + 1);
-	      bcopy (base_fontname, base, p3 - base_fontname);
+	      memcpy (base, base_fontname, p3 - base_fontname);
 	      base[p3 - base_fontname] = '*';
 	      base[(p3 - base_fontname) + 1] = '-';
 	      strcpy (base + (p3 - base_fontname) + 2, p2);
@@ -1996,33 +1996,33 @@
 	  /* Build the font spec that matches all charsets.  */
 	  len = p - base_fontname + strlen (allcs) + 1;
 	  font_allcs = (char *) alloca (len);
-	  bzero (font_allcs, len);
-	  bcopy (base_fontname, font_allcs, p - base_fontname);
+	  memset (font_allcs, 0, len);
+	  memcpy (font_allcs, base_fontname, p - base_fontname);
 	  strcat (font_allcs, allcs);
 
 	  /* Build the font spec that matches all families and
 	     add-styles.  */
 	  len = p - p1 + strlen (allcs) + strlen (allfamilies) + 1;
 	  font_allfamilies = (char *) alloca (len);
-	  bzero (font_allfamilies, len);
+	  memset (font_allfamilies, 0, len);
 	  strcpy (font_allfamilies, allfamilies);
-	  bcopy (p1, font_allfamilies + strlen (allfamilies), p - p1);
+	  memcpy (font_allfamilies + strlen (allfamilies), p1, p - p1);
 	  strcat (font_allfamilies, allcs);
 
 	  /* Build the font spec that matches all.  */
 	  len = p - p2 + strlen (allcs) + strlen (all) + strlen (allfamilies) + 1;
 	  font_all = (char *) alloca (len);
-	  bzero (font_all, len);
+	  memset (font_all, 0, len);
 	  strcpy (font_all, allfamilies);
 	  strcat (font_all, all);
-	  bcopy (p2, font_all + strlen (all) + strlen (allfamilies), p - p2);
+	  memcpy (font_all + strlen (all) + strlen (allfamilies), p2, p - p2);
 	  strcat (font_all, allcs);
 
 	  /* Build the actual font set name.  */
 	  len = strlen (base_fontname) + strlen (font_allcs)
 	    + strlen (font_allfamilies) + strlen (font_all) + 5;
 	  fontsetname = xmalloc (len);
-	  bzero (fontsetname, len);
+	  memset (fontsetname, 0, len);
 	  strcpy (fontsetname, base_fontname);
 	  strcat (fontsetname, sep);
 	  strcat (fontsetname, font_allcs);
@@ -3194,7 +3194,7 @@
 
   f->output_method = output_x_window;
   f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
-  bzero (f->output_data.x, sizeof (struct x_output));
+  memset (f->output_data.x, 0, sizeof (struct x_output));
   f->output_data.x->icon_bitmap = -1;
   FRAME_FONTSET (f) = -1;
   f->output_data.x->scroll_bar_foreground_pixel = -1;
@@ -4431,7 +4431,7 @@
              elements."
              This applies even if long is more than 32 bits, the X library
              converts from 32 bit elements received from the X server to long
-             and passes the long array to us.  Thus, for that case bcopy can not
+             and passes the long array to us.  Thus, for that case memcpy can not
              be used.  We convert to a 32 bit type here, because so much code
              assume on that.
 
@@ -4687,7 +4687,7 @@
      counts etc.  */
   f->output_method = output_x_window;
   f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
-  bzero (f->output_data.x, sizeof (struct x_output));
+  memset (f->output_data.x, 0, sizeof (struct x_output));
   f->output_data.x->icon_bitmap = -1;
   FRAME_FONTSET (f) = -1;
   f->output_data.x->scroll_bar_foreground_pixel = -1;
@@ -5729,9 +5729,9 @@
 	      /* The XKB symbolic key names can be seen most easily in
 		 the PS file generated by `xkbprint -label name
 		 $DISPLAY'.  */
-	      if (bcmp ("DELE", kb->names->keys[i].name, 4) == 0)
+	      if (memcmp ("DELE", kb->names->keys[i].name, 4) == 0)
 		delete_keycode = i;
-	      else if (bcmp ("BKSP", kb->names->keys[i].name, 4) == 0)
+	      else if (memcmp ("BKSP", kb->names->keys[i].name, 4) == 0)
 		backspace_keycode = i;
 	    }
 
--- a/src/xfont.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/xfont.c	Thu Jul 08 11:50:25 2010 +0000
@@ -562,7 +562,7 @@
       val = assq_no_quit (QCname, AREF (spec, FONT_EXTRA_INDEX));
       if (CONSP (val) && STRINGP (XCDR (val)) && SBYTES (XCDR (val)) < 512)
 	{
-	  bcopy (SDATA (XCDR (val)), name, SBYTES (XCDR (val)) + 1);
+	  memcpy (name, SDATA (XCDR (val)), SBYTES (XCDR (val)) + 1);
 	  if (xfont_encode_coding_xlfd (name) < 0)
 	    return Qnil;
 	  list = xfont_list_pattern (display, name, registry, script);
@@ -590,7 +590,7 @@
 	return Qnil;
     }
   else if (SBYTES (XCDR (val)) < 512)
-    bcopy (SDATA (XCDR (val)), name, SBYTES (XCDR (val)) + 1);
+    memcpy (name, SDATA (XCDR (val)), SBYTES (XCDR (val)) + 1);
   else
     return Qnil;
   if (xfont_encode_coding_xlfd (name) < 0)
@@ -669,7 +669,7 @@
       if (! *p1 || p1 == p0)
 	continue;
       if (last_len == p1 - p0
-	  && bcmp (last_family, p0, last_len) == 0)
+	  && memcmp (last_family, p0, last_len) == 0)
 	continue;
       last_len = p1 - p0;
       last_family = p0;
@@ -980,7 +980,7 @@
   int i, first, x;
 
   if (metrics)
-    bzero (metrics, sizeof (struct font_metrics));
+    memset (metrics, 0, sizeof (struct font_metrics));
   for (i = 0, x = 0, first = 1; i < nglyphs; i++)
     {
       XChar2b char2b;
--- a/src/xmenu.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/xmenu.c	Thu Jul 08 11:50:25 2010 +0000
@@ -1067,8 +1067,8 @@
 
       /* Save the frame's previous menu bar contents data.  */
       if (previous_menu_items_used)
-	bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items,
-	       previous_menu_items_used * sizeof (Lisp_Object));
+	memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
+		previous_menu_items_used * sizeof (Lisp_Object));
 
       /* Fill in menu_items with the current menu bar contents.
 	 This can evaluate Lisp code.  */
@@ -1282,7 +1282,9 @@
 
       /* Make menu pop down on C-g.  */
       XtOverrideTranslations (menubar_widget, override);
+#ifdef USE_LUCID
       apply_systemfont_to_menu (menubar_widget);
+#endif
     }
 
   {
@@ -1614,7 +1616,9 @@
                            popup_deactivate_callback,
                            menu_highlight_callback);
 
+#ifdef USE_LUCID
   apply_systemfont_to_menu (menu);
+#endif
 
   dummy.type = ButtonPress;
   dummy.serial = 0;
@@ -2016,7 +2020,7 @@
     abort();
 
   dialog_id = widget_id_tick++;
-#ifdef HAVE_XFT
+#ifdef USE_LUCID
   apply_systemfont_to_dialog (f->output_data.x->widget);
 #endif
   lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv,
@@ -2452,12 +2456,10 @@
 	      item_data
 		= (unsigned char *) alloca (maxwidth
 					    + SBYTES (descrip) + 1);
-	      bcopy (SDATA (item_name), item_data,
-		     SBYTES (item_name));
+	      memcpy (item_data, SDATA (item_name), SBYTES (item_name));
 	      for (j = SCHARS (item_name); j < maxwidth; j++)
 		item_data[j] = ' ';
-	      bcopy (SDATA (descrip), item_data + j,
-		     SBYTES (descrip));
+	      memcpy (item_data + j, SDATA (descrip), SBYTES (descrip));
 	      item_data[j + SBYTES (descrip)] = 0;
 	    }
 	  else
--- a/src/xrdb.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/xrdb.c	Thu Jul 08 11:50:25 2010 +0000
@@ -233,7 +233,7 @@
 	  path = (char *) realloc (path, path_size);
 	}
 
-      bcopy (next, path + path_len, next_len);
+      memcpy (path + path_len, next, next_len);
       path_len += next_len;
 
       p++;
@@ -259,7 +259,7 @@
 	  path = (char *) realloc (path, path_size);
 	}
 
-      bcopy (suffix, path + path_len, suffix_len);
+      memcpy (path + path_len, suffix, suffix_len);
       path_len += suffix_len;
     }
 
@@ -644,7 +644,7 @@
       if (type == x_rm_string)
 	ret_value->addr = (char *) value.addr;
       else
-	bcopy (value.addr, ret_value->addr, ret_value->size);
+	memcpy (ret_value->addr, value.addr, ret_value->size);
 
       return value.size;
     }
--- a/src/xselect.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/xselect.c	Thu Jul 08 11:50:25 2010 +0000
@@ -191,7 +191,7 @@
      This only happens for large requests which uses the incremental protocol.  */
   for (queue_tmp = selection_queue; queue_tmp; queue_tmp = queue_tmp->next)
     {
-      if (!bcmp (&queue_tmp->event, event, sizeof (*event)))
+      if (!memcmp (&queue_tmp->event, event, sizeof (*event)))
 	{
 	  TRACE1 ("DECLINE DUP SELECTION EVENT %08lx", (unsigned long)queue_tmp);
 	  x_decline_selection_request (event);
@@ -1534,7 +1534,7 @@
           elements."
          This applies even if long is more than 32 bits, the X library
          converts from 32 bit elements received from the X server to long
-         and passes the long array to us.  Thus, for that case bcopy can not
+         and passes the long array to us.  Thus, for that case memcpy can not
          be used.  We convert to a 32 bit type here, because so much code
          assume on that.
 
@@ -1556,7 +1556,7 @@
       else
         {
           *actual_size_ret *= *actual_format_ret / 8;
-          bcopy (tmp_data, (*data_ret) + offset, *actual_size_ret);
+          memcpy ((*data_ret) + offset, tmp_data, *actual_size_ret);
           offset += *actual_size_ret;
         }
 
@@ -1658,7 +1658,7 @@
 	  *data_ret = (unsigned char *) xrealloc (*data_ret, *size_bytes_ret);
 	}
 
-      bcopy (tmp_data, (*data_ret) + offset, tmp_size_bytes);
+      memcpy ((*data_ret) + offset, tmp_data, tmp_size_bytes);
       offset += tmp_size_bytes;
 
       /* Use xfree, not XFree, because x_get_window_property
--- a/src/xsmfns.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/xsmfns.c	Thu Jul 08 11:50:25 2010 +0000
@@ -154,7 +154,7 @@
   /* Check if smc_interact_CB was called and we shall generate a
      SAVE_SESSION_EVENT.  */
   if (emacs_event.kind != NO_EVENT)
-    bcopy (&emacs_event, bufp, sizeof (struct input_event));
+    memcpy (bufp, &emacs_event, sizeof (struct input_event));
 
   return emacs_event.kind != NO_EVENT ? 1 : 0;
 }
--- a/src/xterm.c	Wed Jul 07 12:15:48 2010 +0000
+++ b/src/xterm.c	Thu Jul 08 11:50:25 2010 +0000
@@ -4131,7 +4131,7 @@
 
       scroll_bar_windows = (struct window **) xrealloc (scroll_bar_windows,
 							nbytes);
-      bzero (&scroll_bar_windows[i], nbytes - old_nbytes);
+      memset (&scroll_bar_windows[i], 0, nbytes - old_nbytes);
       scroll_bar_windows_size = new_size;
     }
 
@@ -5608,7 +5608,7 @@
 	 if (f->output_data.x->saved_menu_event == 0)			\
            f->output_data.x->saved_menu_event				\
 	     = (XEvent *) xmalloc (sizeof (XEvent));			\
-         bcopy (&event, f->output_data.x->saved_menu_event, size);	\
+         memcpy (f->output_data.x->saved_menu_event, &event, size);	\
 	 inev.ie.kind = MENU_BAR_ACTIVATE_EVENT;			\
 	 XSETFRAME (inev.ie.frame_or_window, f);			\
        }								\
@@ -6245,7 +6245,7 @@
              this enables ComposeCharacter to work whether or
              not it is combined with Meta.  */
           if (modifiers & dpyinfo->meta_mod_mask)
-            bzero (&compose_status, sizeof (compose_status));
+            memset (&compose_status, 0, sizeof (compose_status));
 
 #ifdef HAVE_X_I18N
           if (FRAME_XIC (f))
@@ -6293,7 +6293,7 @@
           if (compose_status.chars_matched > 0 && nbytes == 0)
             break;
 
-          bzero (&compose_status, sizeof (compose_status));
+          memset (&compose_status, 0, sizeof (compose_status));
           orig_keysym = keysym;
 
  	  /* Common for all keysym input events.  */
@@ -6707,7 +6707,7 @@
            by the rest of Emacs, we put it here.  */
         int tool_bar_p = 0;
 
-        bzero (&compose_status, sizeof (compose_status));
+        memset (&compose_status, 0, sizeof (compose_status));
 	last_mouse_glyph_frame = 0;
         last_user_time = event.xbutton.time;
 
@@ -7553,7 +7553,7 @@
   if (x_error_message->string[0])
     {
       char string[X_ERROR_MESSAGE_SIZE];
-      bcopy (x_error_message->string, string, X_ERROR_MESSAGE_SIZE);
+      memcpy (string, x_error_message->string, X_ERROR_MESSAGE_SIZE);
       x_uncatch_errors ();
       error (format, string);
     }
@@ -8077,7 +8077,7 @@
       xim_inst->dpyinfo = dpyinfo;
       len = strlen (resource_name);
       xim_inst->resource_name = (char *) xmalloc (len + 1);
-      bcopy (resource_name, xim_inst->resource_name, len + 1);
+      memcpy (xim_inst->resource_name, resource_name, len + 1);
       XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb,
 				      resource_name, EMACS_CLASS,
 				      xim_instantiate_callback,
@@ -9929,7 +9929,7 @@
   /* We have definitely succeeded.  Record the new connection.  */
 
   dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info));
-  bzero (dpyinfo, sizeof *dpyinfo);
+  memset (dpyinfo, 0, sizeof *dpyinfo);
 
   terminal = x_create_terminal (dpyinfo);