]> arthur.barton.de Git - netatalk.git/commitdiff
This patch adds function prototypes, fixes a few argument count bugs for
authorsamnoble <samnoble>
Wed, 23 May 2001 23:48:34 +0000 (23:48 +0000)
committersamnoble <samnoble>
Wed, 23 May 2001 23:48:34 +0000 (23:48 +0000)
a couple of calls to syslog/printf, explicity adds return()'s for functions
which are supposed to return a value, and a few other generic code-cleaning
things which enabled atalkd to run on AlphaLinux again (it hasn't run properly
in about a year).

etc/atalkd/config.c
etc/atalkd/main.c
etc/atalkd/main.h [new file with mode: 0644]
etc/atalkd/multicast.c
etc/atalkd/route.c
etc/atalkd/route.h [new file with mode: 0644]
etc/atalkd/rtmp.c
etc/atalkd/rtmp.h
etc/atalkd/zip.c
etc/atalkd/zip.h

index 83ab824b892be9b56f586b6fddabb17649b87f3d..42a64856a6144c6d9e7d330213eea27f05719631 100644 (file)
@@ -105,7 +105,7 @@ parseline( line )
     return( argv );
 }
 
-writeconf( cf )
+int writeconf( cf )
     char       *cf;
 {
     struct stat                st;
@@ -134,7 +134,7 @@ writeconf( cf )
     if (( p = strrchr( path, '/' )) == NULL ) {
        strcpy( newpath, _PATH_ATALKDTMP );
     } else {
-       sprintf( newpath, "%.*s/%s", p - path, path, _PATH_ATALKDTMP );
+       sprintf( newpath, "%.*s/%s", (int)(p - path), path, _PATH_ATALKDTMP );
     }
     if (( fd = open( newpath, O_WRONLY|O_CREAT|O_TRUNC, mode )) < 0 ) {
        syslog( LOG_ERR, "%s: %m", newpath );
@@ -229,7 +229,7 @@ writeconf( cf )
  * zone for an interface is the first zone encountered for that
  * interface.
  */
-readconf( cf )
+int readconf( cf )
     char               *cf;
 {
     struct ifreq       ifr;
@@ -372,7 +372,7 @@ read_conf_err:
 }
 
 /*ARGSUSED*/
-router( iface, av )
+int router( iface, av )
     struct interface   *iface;
     char               **av;
 {
@@ -396,7 +396,7 @@ router( iface, av )
 }
 
 /*ARGSUSED*/
-dontroute( iface, av )
+int dontroute( iface, av )
     struct interface   *iface;
     char               **av;
 {
@@ -411,7 +411,7 @@ dontroute( iface, av )
 }
 
 /*ARGSUSED*/
-seed( iface, av )
+int seed( iface, av )
     struct interface   *iface;
     char               **av;
 {
@@ -429,7 +429,7 @@ seed( iface, av )
     return( 1 );
 }
 
-phase( iface, av )
+int phase( iface, av )
     struct interface   *iface;
     char               **av;
 {
@@ -457,7 +457,7 @@ phase( iface, av )
     return( 2 );
 }
 
-net( iface, av )
+int net( iface, av )
     struct interface   *iface;
     char               **av;
 {
@@ -475,7 +475,7 @@ net( iface, av )
     }
     net = atoi( nrange );
     if ( net < 0 || net >= 0xffff ) {
-       fprintf( stderr, "Bad network: %d\n" );
+       fprintf( stderr, "Bad network: %d\n", net );
        return -1;
     }
 
@@ -501,7 +501,7 @@ net( iface, av )
        if ( stop != 0 ) {
            net = atoi( stop );
            if ( net < 0 || net >= 0xffff ) {
-               fprintf( stderr, "Bad network: %d\n" );
+               fprintf( stderr, "Bad network: %d\n", net );
                return -1;
            }
        }
@@ -527,7 +527,7 @@ net( iface, av )
     return( 2 );
 }
 
-addr( iface, av )
+int addr( iface, av )
     struct interface   *iface;
     char               **av;
 {
@@ -563,7 +563,7 @@ addr( iface, av )
     return( 2 );
 }
 
-zone( iface, av )
+int zone( iface, av )
     struct interface   *iface;
     char               **av;
 {
@@ -603,7 +603,7 @@ zone( iface, av )
  * Get the configuration from the kernel. Only called if there's no
  * configuration.
  */
-getifconf()
+int getifconf()
 {
     struct interface   *iface, *niface;
     struct ifreq        ifr;
@@ -682,8 +682,8 @@ getifconf()
  * Allocate a new interface structure.  Centralized here so we can change
  * the interface structure and have it updated nicely.
  */
-    struct interface *
-newiface( name )
+
+struct interface *newiface( name )
     const char         *name;
 {
     struct interface   *niface;
@@ -705,8 +705,7 @@ newiface( name )
 }
 
 #ifdef __svr4__
-    int
-plumb()
+int plumb()
 {
     struct interface   *iface;
     char               device[ MAXPATHLEN + 1], *p;
index c1af5e261de2e69fe022d34fbf8401bcbb188eca..30a2bc0654a4c943b4e7e0e4c58d4fa105e42e2e 100644 (file)
@@ -53,6 +53,7 @@
 #include "rtmp.h"
 #include "zip.h"
 #include "atserv.h"
+#include "main.h"
 
 /* FIXME/SOCKLEN_T: socklen_t is a unix98 feature */
 #ifndef SOCKLEN_T
@@ -105,6 +106,12 @@ char               *version = VERSION;
 static char     *pidfile = _PATH_ATALKDLOCK;
 
 
+/* from config.c */
+
+int readconf( char * );
+int getifconf( void );
+int writeconf( char * );
+
 /* this is the messiest of the bunch as atalkd can exit pretty much
  * everywhere. we delete interfaces here instead of in as_down. */
 static void atalkd_exit(const int i)
@@ -816,7 +823,7 @@ as_down()
     atalkd_exit( 0 );
 }
 
-main( ac, av )
+int main( ac, av )
     int                ac;
     char       **av;
 {
@@ -1181,7 +1188,7 @@ main( ac, av )
  * and rtmp_packet()) to set the initial "bootstrapping" address
  * on an interface.
  */
-bootaddr( iface )
+void bootaddr( iface )
     struct interface   *iface;
 {
     if ( iface == 0 ) {
@@ -1237,7 +1244,7 @@ bootaddr( iface )
  * Change setaddr()
  * to manage the i_ports field and the fds for select().
  */
-setaddr( iface, phase, net, node, first, last )
+void setaddr( iface, phase, net, node, first, last )
     struct interface   *iface;
     u_int8_t           phase;
     u_int16_t          net;
@@ -1356,7 +1363,7 @@ smaller net range.", iface->i_name, ntohs(first), ntohs(last));
     nfds++;
 }
 
-ifconfig( iname, cmd, sa )
+int ifconfig( iname, cmd, sa )
     char               *iname;
     unsigned long      cmd;
     struct sockaddr_at *sa;
@@ -1382,7 +1389,7 @@ ifconfig( iname, cmd, sa )
     return( 0 );
 }
 
-dumpconfig( iface )
+void dumpconfig( iface )
     struct interface   *iface;
 {
     struct list                *l;
@@ -1419,7 +1426,7 @@ dumpconfig( iface )
 }
 
 #ifdef DEBUG
-dumproutes()
+void dumproutes()
 {
     struct interface   *iface;
     struct rtmptab     *rtmp;
@@ -1467,7 +1474,7 @@ dumproutes()
     fflush( stdout );
 }
 
-dumpzones()
+void dumpzones()
 {
     struct interface   *iface;
     struct rtmptab     *rtmp;
diff --git a/etc/atalkd/main.h b/etc/atalkd/main.h
new file mode 100644 (file)
index 0000000..913f594
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef ATALKD_MAIN_H
+#define ATALKD_MAIN_H
+
+#include <sys/cdefs.h>
+
+int ifconfig __P(( char *, unsigned long, struct sockaddr_at * ));
+void setaddr __P(( struct interface *, u_int8_t, u_int16_t,
+        u_int8_t, u_int16_t, u_int16_t ));
+void bootaddr __P(( struct interface * ));
+void dumpconfig __P(( struct interface * ));
+
+#endif /* ATALKD_MAIN_H */
index 4f43038aaa076eab155cd572f204418a96c53f0d..9b689d5ec90c1430046d00e6010202317dc2787d 100644 (file)
 
 #include <atalk/util.h>
 #include <netatalk/endian.h>
+#include "rtmp.h"
 #include "zip.h"
+#include "main.h"
+
 
 static const unsigned char     ethermulti[ 6 ] = {
     0x09, 0x00, 0x07, 0xff, 0xff, 0xff,
index 2b20c107f92172cc4fe1b9948603fe7f8609df05..0a7a512285c0e69a46abf154c2913aef30db5fa5 100644 (file)
@@ -7,17 +7,20 @@
 #include "config.h"
 #endif
 
+#include <string.h>
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <net/route.h>
+#include <sys/ioctl.h>
 
 #include <netatalk/at.h>
 
 #include "rtmp.h"
+#include "route.h"
 
 #ifndef BSD4_4
-route( message, dst, gate, flags )
+int route( message, dst, gate, flags )
     int                        message;
     struct sockaddr    *dst, *gate;
     int                        flags;
@@ -28,7 +31,7 @@ route( message, dst, gate, flags )
     struct rtentry     rtent;
 #endif
 
-    bzero( &rtent, sizeof( struct rtentry ));
+    memset( &rtent, 0, sizeof( struct rtentry ));
     rtent.rt_dst = *dst;
     rtent.rt_gateway = *gate;
     rtent.rt_flags = flags;
@@ -58,7 +61,7 @@ route( message, dst, gate, flags )
 {
     int                        rc;
 
-    bzero( &rtma, sizeof( struct rt_msg_at ));
+    memset( &rtma, 0, sizeof( struct rt_msg_at ));
     rtma.rtma_rtm.rtm_msglen = sizeof( struct rt_msg_at );
     rtma.rtma_rtm.rtm_version = RTM_VERSION;
     rtma.rtma_rtm.rtm_type = message;
diff --git a/etc/atalkd/route.h b/etc/atalkd/route.h
new file mode 100644 (file)
index 0000000..989c52a
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef ATALKD_ROUTE_H
+#define ATALKD_ROUTE_H 1
+
+#include <sys/cdefs.h>
+
+int route __P(( int, struct sockaddr *, struct sockaddr *, int ));
+
+#endif /* ATALKD_ROUTE_H */
index f8e05a1f2d9dd26f999136c52c8984c768296614..b227e3a9e9aaaa6c18c1441d794ae08dc0a07ada 100644 (file)
@@ -8,6 +8,7 @@
 #endif
 
 #include <stdlib.h>
+#include <string.h>
 #include <sys/syslog.h>
 #include <sys/types.h>
 #include <sys/param.h>
@@ -32,7 +33,8 @@
 #include "zip.h"
 #include "list.h"
 #include "atserv.h"
-
+#include "route.h"
+#include "main.h"
 
 void rtmp_delzonemap(rtmp)
     struct rtmptab *rtmp;
@@ -431,7 +433,7 @@ int rtmp_packet( ap, from, data, len )
            syslog( LOG_INFO, "rtmp_packet no data header" );
            return 1;
        }
-       bcopy( data, &rh, sizeof( struct rtmprdhdr ));
+       memcpy( &rh, data, sizeof( struct rtmprdhdr ));
        data += sizeof( struct rtmprdhdr );
 
        /* check rh address against from address */
@@ -484,7 +486,7 @@ int rtmp_packet( ap, from, data, len )
            syslog( LOG_INFO, "rtmp_packet missing first tuple" );
            return 1;
        }
-       bcopy( data, &rt, SZ_RTMPTUPLE );
+       memcpy( &rt, data, SZ_RTMPTUPLE );
        data += SZ_RTMPTUPLE;
 
        if ( rt.rt_net == 0 ) {
@@ -502,14 +504,14 @@ int rtmp_packet( ap, from, data, len )
                syslog( LOG_INFO, "rtmp_packet missing second tuple" );
                return 1;
            }
-           bcopy( data, &rt, SZ_RTMPTUPLE );
+           memcpy( &rt, data, SZ_RTMPTUPLE );
            data += SZ_RTMPTUPLE;
        } else if ( rt.rt_dist & 0x80 ) {
            if ( data + SZ_RTMPTUPLE > end ) {
                syslog( LOG_INFO, "rtmp_packet missing first range-end" );
                return 1;
            }
-           bcopy( data, &xrt, SZ_RTMPTUPLE );
+           memcpy( &xrt, data, SZ_RTMPTUPLE );
            data += SZ_RTMPTUPLE;
 
            if ( xrt.rt_dist != 0x82 ) {
@@ -728,14 +730,14 @@ int rtmp_packet( ap, from, data, len )
            if ( data + SZ_RTMPTUPLE > end ) {
                break;
            }
-           bcopy( data, &rt, SZ_RTMPTUPLE );
+           memcpy( &rt, data, SZ_RTMPTUPLE );
            data += SZ_RTMPTUPLE;
            if ( rt.rt_dist & 0x80 ) {
                if ( data + SZ_RTMPTUPLE > end ) {
                    syslog( LOG_INFO, "rtmp_packet missing range-end" );
                    return 1;
                }
-               bcopy( data, &xrt, SZ_RTMPTUPLE );
+               memcpy( &xrt, data, SZ_RTMPTUPLE );
                data += SZ_RTMPTUPLE;
            }
        }
@@ -763,18 +765,18 @@ int rtmp_packet( ap, from, data, len )
            rh.rh_net = iface->i_addr.sat_addr.s_net;
            rh.rh_nodelen = 8;
            rh.rh_node = iface->i_addr.sat_addr.s_node;
-           bcopy( &rh, data, sizeof( struct rtmp_head ));
+           memcpy( data, &rh, sizeof( struct rtmp_head ));
            data += sizeof( struct rtmp_head );
 
            if ( iface->i_flags & IFACE_PHASE2 ) {
                rt.rt_net = iface->i_rt->rt_firstnet;
                rt.rt_dist = 0x80;
-               bcopy( &rt, data, SZ_RTMPTUPLE );
+               memcpy( data, &rt, SZ_RTMPTUPLE );
                data += SZ_RTMPTUPLE;
 
                rt.rt_net = iface->i_rt->rt_lastnet;
                rt.rt_dist = 0x82;
-               bcopy( &rt, data, SZ_RTMPTUPLE );
+               memcpy( data, &rt, SZ_RTMPTUPLE );
                data += SZ_RTMPTUPLE;
            }
            if ( sendto( ap->ap_fd, packet, data - packet, 0,
@@ -829,7 +831,7 @@ int rtmp_request( iface )
     /*
      * There is a problem with the net zero "hint" hack.
      */
-    bzero( &sat, sizeof( struct sockaddr_at ));
+    memset( &sat, 0, sizeof( struct sockaddr_at ));
 #ifdef BSD4_4
     sat.sat_len = sizeof( struct sockaddr_at );
 #endif BSD4_4
@@ -862,14 +864,14 @@ int looproute( iface, cmd )
        return -1;
     }
 
-    bzero( &dst, sizeof( struct sockaddr_at ));
+    memset( &dst, 0, sizeof( struct sockaddr_at ));
 #ifdef BSD4_4
     dst.sat_len = sizeof( struct sockaddr_at );
 #endif BSD4_4
     dst.sat_family = AF_APPLETALK;
     dst.sat_addr.s_net = iface->i_addr.sat_addr.s_net;
     dst.sat_addr.s_node = iface->i_addr.sat_addr.s_node;
-    bzero( &loop, sizeof( struct sockaddr_at ));
+    memset( &loop, 0, sizeof( struct sockaddr_at ));
 #ifdef BSD4_4
     loop.sat_len = sizeof( struct sockaddr_at );
 #endif BSD4_4
@@ -910,7 +912,7 @@ int gateroute( command, rtmp )
      * the kernel.  Otherwise, we'll get a bunch of routes to the loop
      * back interface, and who wants that?
      */
-    bzero( &gate, sizeof( struct sockaddr_at ));
+    memset( &gate, 0, sizeof( struct sockaddr_at ));
 #ifdef BSD4_4
     gate.sat_len = sizeof( struct sockaddr_at );
 #endif BSD4_4
@@ -921,7 +923,7 @@ int gateroute( command, rtmp )
        gate.sat_addr.s_net = net;
     }
 
-    bzero( &dst, sizeof( struct sockaddr_at ));
+    memset( &dst, 0, sizeof( struct sockaddr_at ));
 #ifdef BSD4_4
     dst.sat_len = sizeof( struct sockaddr_at );
 #endif BSD4_4
index edc3e743b58975eb8b9e582d02b6eedc091b83d1..bf2be9a58b6e2e1fe83f3fd08bdba04ad4c10608 100644 (file)
@@ -82,4 +82,10 @@ extern int   rtfd;
 struct rtmptab *newrt __P((const struct interface *));
 void rtmp_delzonemap  __P((struct rtmptab *));
 
+int rtmp_request __P(( struct interface * ));
+void rtmp_free __P(( struct rtmptab * ));
+int rtmp_replace __P(( struct rtmptab * ));
+int looproute __P(( struct interface *, int ));
+int gateroute __P(( int, struct rtmptab * ));
+
 #endif /* atalkd/rtmp.h */
index 3e2f715331cc4c09cf1b3979af616f57875260d7..0cd751caf2d4984f0396860ab7276c795dca01db 100644 (file)
 #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;
@@ -1050,4 +1052,5 @@ int addzone( rt, len, zone )
        syslog( LOG_ERR, "addzone corrupted zone/route mapping" );
        return -1;
     }
+    return 0;
 }
index dacba24b008dea4f123d0a638176de0d1ee415e6..386317dca68eac303cc94b2e0484f3a3982cbe1d 100644 (file)
@@ -20,4 +20,7 @@ struct ziptab {
 extern struct ziptab   *ziptab, *ziplast;
 struct ziptab  *newzt __P((const int, const char *));
 
+int addzone __P(( struct rtmptab *, int, char * ));
+int zip_getnetinfo __P(( struct interface * ));
+
 #endif /* atalkd/zip.h */