]> arthur.barton.de Git - netatalk.git/blobdiff - etc/atalkd/zip.c
replaced all #include <sys/syslog.h> with #include <syslog.h>
[netatalk.git] / etc / atalkd / zip.c
index 3e2f715331cc4c09cf1b3979af616f57875260d7..b27607bae1c2ab52554c563e56aa4e99c26165ea 100644 (file)
@@ -1,20 +1,27 @@
 /*
+ * $Id: zip.c,v 1.9 2002-01-03 17:49:39 sibaz Exp $
+ *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved. See COPYRIGHT.
  */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
+#endif /* HAVE_CONFIG_H */
 
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 #include <sys/param.h>
 #include <sys/types.h>
-#include <sys/syslog.h>
+#include <syslog.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
+#ifdef TRU64
+#include <sys/mbuf.h>
+#include <net/route.h>
+#endif /* TRU64 */
 #include <net/if.h>
 #include <net/route.h>
 #include <netatalk/endian.h>
@@ -22,7 +29,7 @@
 
 #ifdef __svr4__
 #include <sys/sockio.h>
-#endif __svr4__
+#endif /* __svr4__ */
 
 #include <atalk/ddp.h>
 #include <atalk/zip.h>
 #include "rtmp.h"
 #include "list.h"
 #include "multicast.h"
+#include "main.h"
 
 struct ziptab  *ziptab = NULL, *ziplast = NULL;
 
+
 static int zonecheck( rtmp, iface )
     struct rtmptab     *rtmp;
     struct interface   *iface;
@@ -96,7 +105,7 @@ int zip_packet( ap, from, data, len )
     char               *end, zname[ 32 ], packet[ ATP_BUFSIZ ], *nzones, *lastflag;
     char               *reply, *rend, *ziphdr;
     int                        zlen, n, zipop, rcnt, qcnt, zcnt, zsz;
-    extern int         debug, stabletimer;
+    extern int         stabletimer;
 
     end = data + len;
 
@@ -173,7 +182,8 @@ int zip_packet( ap, from, data, len )
                        if ( sendto( ap->ap_fd, packet, reply - packet, 0,
                                (struct sockaddr *)from,
                                sizeof( struct sockaddr_at )) < 0 ) {
-                           syslog( LOG_ERR, "zip reply sendto: %m" );
+                           syslog( LOG_ERR, "zip reply sendto: %s",
+                                   strerror(errno) );
                        }
 
                        reply = packet + 3;
@@ -192,7 +202,8 @@ int zip_packet( ap, from, data, len )
                                if ( sendto( ap->ap_fd, packet, reply - packet,
                                        0, (struct sockaddr *)from,
                                        sizeof( struct sockaddr_at )) < 0 ) {
-                                   syslog( LOG_ERR, "zip reply sendto: %m" );
+                                   syslog( LOG_ERR, "zip reply sendto: %s",
+                                           strerror(errno) );
                                }
 
                                reply = packet + 3;
@@ -213,7 +224,8 @@ int zip_packet( ap, from, data, len )
                            if ( sendto( ap->ap_fd, packet, reply - packet, 0,
                                    (struct sockaddr *)from,
                                    sizeof( struct sockaddr_at )) < 0 ) {
-                               syslog( LOG_ERR, "zip reply sendto: %m" );
+                               syslog( LOG_ERR, "zip reply sendto: %s",
+                                       strerror(errno) );
                            }
 
                            reply = packet + 3;
@@ -240,7 +252,8 @@ int zip_packet( ap, from, data, len )
                if ( sendto( ap->ap_fd, packet, reply - packet, 0,
                        (struct sockaddr *)from,
                        sizeof( struct sockaddr_at )) < 0 ) {
-                   syslog( LOG_ERR, "zip reply sendto: %m" );
+                   syslog( LOG_ERR, "zip reply sendto: %s",
+                           strerror(errno) );
                }
            }
            break;
@@ -590,8 +603,9 @@ int zip_packet( ap, from, data, len )
            if ( sendto( ap->ap_fd, packet, data - packet, 0,
                    (struct sockaddr *)from,
                    sizeof( struct sockaddr_at )) < 0 ) {
-               syslog( LOG_ERR, "zip gni sendto %u.%u: %m",
-                       ntohs( from->sat_addr.s_net ), from->sat_addr.s_node );
+               syslog( LOG_ERR, "zip gni sendto %u.%u: %s",
+                       ntohs( from->sat_addr.s_net ), from->sat_addr.s_node,
+                       strerror(errno) );
                return 1;
            }
            break;
@@ -714,9 +728,10 @@ int zip_packet( ap, from, data, len )
            /* add addr to loopback route */
            if ( looproute( iface, RTMP_ADD )) { /* -1 or 1 */
                syslog( LOG_ERR,
-                       "zip_packet: can't route %u.%u to loopback: %m",
+                       "zip_packet: can't route %u.%u to loopback: %s",
                        ntohs( iface->i_addr.sat_addr.s_net ),
-                       iface->i_addr.sat_addr.s_node );
+                       iface->i_addr.sat_addr.s_node,
+                       strerror(errno) );
                return -1;
            }
 
@@ -734,7 +749,7 @@ int zip_packet( ap, from, data, len )
 #ifdef DEBUG
            printf( "zip notify from %u.%u\n", ntohs( from->sat_addr.s_net ),
                    from->sat_addr.s_node );
-#endif DEBUG
+#endif /* DEBUG */
            break;
 
        default :
@@ -866,8 +881,9 @@ int zip_packet( ap, from, data, len )
            if ( sendto( ap->ap_fd, packet, data - packet, 0,
                    (struct sockaddr *)from,
                    sizeof( struct sockaddr_at )) < 0 ) {
-               syslog( LOG_ERR, "zip atp sendto %u.%u: %m",
-                       ntohs( from->sat_addr.s_net ), from->sat_addr.s_node );
+               syslog( LOG_ERR, "zip atp sendto %u.%u: %s",
+                       ntohs( from->sat_addr.s_net ), from->sat_addr.s_node,
+                       strerror(errno) );
                return 1;
            }
        }
@@ -925,7 +941,7 @@ int zip_getnetinfo( iface )
 
 #ifdef BSD4_4
     sat.sat_len = sizeof( struct sockaddr_at );
-#endif BSD4_4
+#endif /* BSD4_4 */
     sat.sat_family = AF_APPLETALK;
     sat.sat_addr.s_net = 0;
     sat.sat_addr.s_node = ATADDR_BCAST;
@@ -933,7 +949,7 @@ int zip_getnetinfo( iface )
 
     if ( sendto( ap->ap_fd, packet, data - packet, 0, (struct sockaddr *)&sat,
            sizeof( struct sockaddr_at )) < 0 ) {
-       syslog( LOG_ERR, "zip_getnetinfo sendto: %m" );
+       syslog( LOG_ERR, "zip_getnetinfo sendto: %s", strerror(errno) );
        return -1;
     }
     return 0;
@@ -977,7 +993,7 @@ static int add_list( head, data )
        }
     }
     if (( l = (struct list *)malloc( sizeof( struct list ))) == NULL ) {
-       syslog( LOG_ERR, "add_list malloc: %m" );
+       syslog( LOG_ERR, "add_list malloc: %s", strerror(errno) );
        return -1;
     }
 
@@ -1012,7 +1028,7 @@ int addzone( rt, len, zone )
     }
     if ( zt == NULL ) {
        if (( zt = newzt( len, zone )) == NULL ) {
-           syslog( LOG_ERR, "addzone newzt: %m" );
+           syslog( LOG_ERR, "addzone newzt: %s", strerror(errno) );
            return -1;
        }
        if ( ziptab == NULL ) {
@@ -1050,4 +1066,5 @@ int addzone( rt, len, zone )
        syslog( LOG_ERR, "addzone corrupted zone/route mapping" );
        return -1;
     }
+    return 0;
 }