--- libatalk/atp/atp_rsel.c.orig	Thu Oct  2 17:32:56 1997
+++ libatalk/atp/atp_rsel.c	Thu Nov 18 15:57:44 1999
@@ -8,7 +8,9 @@
 #include <sys/time.h>
 #include <sys/errno.h>
 #include <sys/uio.h>
-#include <signal.h>
+#include <string.h>
+#include <stdio.h>
+#include <unistd.h>
 
 #include <netatalk/endian.h>
 #include <netatalk/at.h>
@@ -41,10 +43,10 @@
 	    ah->atph_reqpkt->atpbuf_dlen );
 #endif
 
-    bcopy( ah->atph_reqpkt->atpbuf_info.atpbuf_data + 1, (char *)&req_hdr,
+    memcpy( (char *)&req_hdr, ah->atph_reqpkt->atpbuf_info.atpbuf_data + 1,
 	sizeof( struct atphdr ));
     req_hdr.atphd_bitmap = ah->atph_rbitmap;
-    bcopy( (char *)&req_hdr, ah->atph_reqpkt->atpbuf_info.atpbuf_data + 1,
+    memcpy( ah->atph_reqpkt->atpbuf_info.atpbuf_data + 1, (char *)&req_hdr,
 	    sizeof( struct atphdr ));
 
     gettimeofday( &ah->atph_reqtv, (struct timezone *)0 );
@@ -74,8 +76,8 @@
     struct atphdr	req_hdr, resp_hdr;
     fd_set		fds;
     int			i, recvlen, requesting, mask, c;
-    u_char		rfunc;
-    u_short		tid;
+    u_int8_t		rfunc;
+    u_int16_t		tid;
     struct timeval	tv;
     struct sockaddr_at	saddr;
 
@@ -131,7 +133,7 @@
 		goto timeout;
 	    }
 	}
-	bcopy( (char *)faddr, (char *)&saddr, sizeof( struct sockaddr_at ));
+	memcpy( (char *)&saddr, (char *)faddr, sizeof( struct sockaddr_at ));
 #ifdef EBUG
 	printf( "<%d> atp_rsel calling recv_atp,", getpid());
 	print_addr( " accepting from: ", &saddr );
@@ -171,7 +173,7 @@
 #endif
 
     abuf->atpbuf_dlen = recvlen;
-    bcopy( abuf->atpbuf_info.atpbuf_data + 1, (char *)&resp_hdr,
+    memcpy( (char *)&resp_hdr, abuf->atpbuf_info.atpbuf_data + 1,
 	    sizeof( struct atphdr ));
 
     if ( rfunc == ATP_TREQ ) {
@@ -179,7 +181,7 @@
 	 * we got a request: check to see if it is a duplicate (XO)
 	 * while we are at it, we expire old XO responses from sent list
 	 */
-	bcopy( abuf->atpbuf_info.atpbuf_data + 1, (char *)&req_hdr,
+	memcpy( (char *)&req_hdr, abuf->atpbuf_info.atpbuf_data + 1,
 		sizeof( struct atphdr ));
 	tid = ntohs( req_hdr.atphd_tid );
 	gettimeofday( &tv, (struct timezone *)0 );
@@ -244,9 +246,9 @@
 
 	if ( cb == NULL ) {
 	    /* new request -- queue it and return */
-	    bcopy( (char *)&saddr, (char *)&abuf->atpbuf_addr,
+	    memcpy( (char *)&abuf->atpbuf_addr, (char *)&saddr,
 		    sizeof( struct sockaddr_at ));
-	    bcopy( (char *)&saddr, (char *)faddr,
+	    memcpy( (char *)faddr, (char *)&saddr,
 		    sizeof( struct sockaddr_at ));
 	    abuf->atpbuf_next = ah->atph_queue;
 	    ah->atph_queue = abuf;
@@ -260,7 +262,7 @@
     /*
      * we got a response: update bitmap
      */
-    bcopy( ah->atph_reqpkt->atpbuf_info.atpbuf_data + 1, (char *)&req_hdr,
+    memcpy( (char *)&req_hdr, ah->atph_reqpkt->atpbuf_info.atpbuf_data + 1,
 	    sizeof( struct atphdr ));
     if ( requesting && ah->atph_rbitmap & ( 1<<resp_hdr.atphd_bitmap )
 		&& req_hdr.atphd_tid == resp_hdr.atphd_tid ) {
@@ -279,7 +281,7 @@
 		getpid(), resp_hdr.atphd_bitmap, ah->atph_rbitmap );
 #endif
 	    mask = 1 << resp_hdr.atphd_bitmap;
-	    ah->atph_rbitmap &= ( mask | mask-1 );
+	    ah->atph_rbitmap &= ( mask | (mask -1) );
 	}
 
 	/* if Send Trans. Status, send updated request
@@ -289,9 +291,8 @@
 	    puts( "STS" );
 #endif
 	    req_hdr.atphd_bitmap = ah->atph_rbitmap;
-	    bcopy( (char *)&req_hdr,
-		ah->atph_reqpkt->atpbuf_info.atpbuf_data + 1,
-		sizeof( struct atphdr ));
+	    memcpy( ah->atph_reqpkt->atpbuf_info.atpbuf_data + 1,
+			(char *)&req_hdr, sizeof( struct atphdr ));
 	    if ( sendto( ah->atph_socket,
 		    ah->atph_reqpkt->atpbuf_info.atpbuf_data,
 		    ah->atph_reqpkt->atpbuf_dlen, 0,
@@ -320,9 +321,9 @@
 	 * the release consists of DDP type byte + ATP header + 4 user bytes
 	 */
 	req_hdr.atphd_ctrlinfo = ATP_TREL;
-	bcopy( (char *)&req_hdr, ah->atph_reqpkt->atpbuf_info.atpbuf_data + 1,
-	    sizeof( struct atphdr ));
-	bzero( ah->atph_reqpkt->atpbuf_info.atpbuf_data + ATP_HDRSIZE, 4 );
+	memcpy( ah->atph_reqpkt->atpbuf_info.atpbuf_data + 1,
+	    	(char *)&req_hdr, sizeof( struct atphdr ));
+	memset( ah->atph_reqpkt->atpbuf_info.atpbuf_data + ATP_HDRSIZE, 0, 4 );
 	ah->atph_reqpkt->atpbuf_dlen = sizeof( struct atphdr ) + ATP_HDRSIZE;
 #ifdef EBUG
 	printf( "<%d> sending TREL", getpid() );
@@ -351,6 +352,6 @@
 	}
     }
 
-    bcopy( (char *)&saddr, (char *)faddr, sizeof( struct sockaddr_at ));
+    memcpy( (char *)faddr, (char *)&saddr, sizeof( struct sockaddr_at ));
     return( ATP_TRESP );
 }
