]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/atp/atp_sresp.c
Remove bdb env on exit
[netatalk.git] / libatalk / atp / atp_sresp.c
index 532e111cf24401d84dbd33726dd464314441e6c9..781760bb8731a6fd02052e774c0d860c4e43f321 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * $Id: atp_sresp.c,v 1.6 2009-10-13 22:55:37 didg Exp $
+ *
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
  * All Rights Reserved.
  *
@@ -23,7 +25,7 @@
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
+#endif /* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <string.h>
@@ -31,6 +33,7 @@
 #include <errno.h>
 #include <sys/uio.h>
 #include <sys/time.h>
+#include <sys/socket.h>
 
 #include <netatalk/at.h>
 #include <netatalk/endian.h>
 
 /* send a transaction response
 */
-int atp_sresp( ah, atpb )
-    ATP                        ah;             /* open atp handle */
-    struct atp_block   *atpb;          /* parameter block */
+int atp_sresp(
+    ATP                        ah,             /* open atp handle */
+    struct atp_block   *atpb)          /* parameter block */
 {
     int                        i;
     u_int8_t           ctrlinfo;
     struct atpbuf      *resp_buf;
-    struct atpbuf      *save_buf;
+    struct atpbuf      *save_buf; /* uninitialized, OK 310105 */
 
 #ifdef EBUG
     atp_print_bufuse( ah, "atp_sresp" );
-#endif
+#endif /* EBUG */
 
     /* check parameters
     */
@@ -81,7 +84,7 @@ int atp_sresp( ah, atpb )
            ah->atph_rxo ? "XO" : "", ah->atph_rtid );
     atp_print_addr( " to", atpb->atp_saddr );
     putchar( '\n' );
-#endif
+#endif /* EBUG */
     if ( ah->atph_rxo ) {
        if (( save_buf = atp_alloc_buf()) == NULL ) {
            return -1;
@@ -93,7 +96,7 @@ int atp_sresp( ah, atpb )
        ctrlinfo = ATP_TRESP;
 #ifdef STS_RESPONSES
        ctrlinfo |= ATP_STS;
-#endif STS_RESPONSES
+#endif /* STS_RESPONSES */
        if ( i == atpb->atp_sresiovcnt-1 ) {
            ctrlinfo |= ATP_EOM;
        }
@@ -104,12 +107,12 @@ int atp_sresp( ah, atpb )
        }
 #ifdef DROPPACKETS
 if (( random() % 3 ) != 2 ) {
-#endif
+#endif /* DROPPACKETS */
 #ifdef EBUG
 printf( "<%d> sending packet tid=%hu serial no.=%d\n", getpid(),
   ah->atph_rtid, i );
 bprint( resp_buf->atpbuf_info.atpbuf_data, resp_buf->atpbuf_dlen );
-#endif
+#endif /* EBUG */
        if ( netddp_sendto( ah->atph_socket, resp_buf->atpbuf_info.atpbuf_data,
          resp_buf->atpbuf_dlen, 0, (struct sockaddr *) atpb->atp_saddr,
          sizeof( struct sockaddr_at )) != resp_buf->atpbuf_dlen ) {
@@ -123,7 +126,7 @@ bprint( resp_buf->atpbuf_info.atpbuf_data, resp_buf->atpbuf_dlen );
        }
 #ifdef DROPPACKETS
 } else printf( "<%d> atp_sresp: dropped serial no. %d\n", getpid(),  i );
-#endif
+#endif /* DROPPACKETS */
        /* allocate a buffer for next packet (if XO mode)
        */
        if ( ah->atph_rxo && ( resp_buf = atp_alloc_buf()) == NULL ) {
@@ -147,7 +150,7 @@ bprint( resp_buf->atpbuf_info.atpbuf_data, resp_buf->atpbuf_dlen );
        ah->atph_sent = save_buf;
 #ifdef EBUG
 printf( "<%d> saved XO response\n", getpid());
-#endif
+#endif /* EBUG */
     }
     return 0;
 }