Barney Wolff wrote:
This is an example of what I was pointing out:

On Sun, Mar 02, 2003 at 01:53:33AM +0100, Jens Rehsack wrote:
 ...

@@ -1444,22 +1420,19 @@
 *      none    - response sent
 *
 */
-void
-send_resp ( intf, Hdr, resp )
-       int             intf;
-       Snmp_Header     *Hdr;
-       u_char          *resp;
+static void
+send_resp ( const int intf, Snmp_Header *Hdr, char *resp )
{
        int     n;

-       if ( ilmi_fd[intf] > 0 ) {
-           n = write ( ilmi_fd[intf], (caddr_t)&resp[1], resp[0] );
+       if ( ilmi_fd[intf] > 0 ) { /* FIXME: does ilmi_fd[intf] exists? out of range? 
*/
+           n = write ( ilmi_fd[intf], resp+1, resp[0] );

...


Here's a case where it matters whether something is u_char or char.
write(2) takes a size_t as its third arg, and extension of a char to
that may not be the same as for u_char, for example on Sparc.  If the
response is ever >127 bytes, this will fail.  You're going to have to
look carefully at how things are used to see when char is appropriate
and when u_char is necessary.


Fixed, thanks.


Jens
--- sbin/atm/ilmid/ilmid.c.orig Sun Mar  2 00:30:57 2003
+++ sbin/atm/ilmid/ilmid.c      Sun Mar  2 01:45:06 2003
@@ -92,7 +92,8 @@
 #define        ASN_IPADDR      0x40
 #define        ASN_TIMESTAMP   0x43
 
-static char *Var_Types[] = { "", "", "ASN_INTEGER", "", "ASN_OCTET", "ASN_NULL", 
"ASN_OBJID" };
+static const char * const Var_Types[] = { "", "", "ASN_INTEGER", "", "ASN_OCTET",
+               "ASN_NULL", "ASN_OBJID" };
 
 /*
  * Define SNMP PDU types
@@ -103,8 +104,8 @@
 #define        PDU_TYPE_SET            0xA3
 #define        PDU_TYPE_TRAP           0xA4
 
-static char *PDU_Types[] = { "GET REQUEST", "GETNEXT REQUEST", "GET RESPONSE", "SET 
REQUEST",
-       "TRAP" };
+static const char * const PDU_Types[] = { "GET REQUEST", "GETNEXT REQUEST",
+               "GET RESPONSE", "SET REQUEST", "TRAP" };
 
 /*
  * Define TRAP codes
@@ -162,7 +163,7 @@
        union {
                int             ival;           /* INTEGER/TIMESTAMP */
                Objid           oval;           /* OBJID */
-               long            aval;           /* IPADDR */
+               uint32_t        aval;           /* IPADDR */
                char            sval[STRLEN];   /* OCTET */
        } var;
        Variable        *next;
@@ -173,10 +174,10 @@
  * which doesn't have the last three fields is the TRAP type.
  */
 struct snmp_header {
-       int             pdulen;
-       int             version;
+       uint32_t        pdulen;
+       uint32_t        version;
        char            community[64];
-       int             pdutype;
+       uint32_t        pdutype;
 
        /* GET/GETNEXT/GETRESP/SET */
        int             reqid;
@@ -185,11 +186,11 @@
 
        /* TRAP */
        Objid           enterprise;
-       int             ipaddr;
+       uint32_t        ipaddr;
        int             generic_trap;
        int             specific_trap;
 
-       int             varlen;
+       uint32_t        varlen;
        Variable        *head,
                        *tail;
 };
@@ -210,7 +211,7 @@
  * foresiggrp: FORE specific Objid we see alot of (being connected to FORE
  *                     switches...)
  */
-Objid  Objids[] = {
+const Objid    Objids[] = {
 #define        SYS_OBJID       0
        {{  8, 43, 6, 1, 2, 1, 1, 2, 0 }},
 #define        UPTIME_OBJID    1
@@ -279,7 +280,7 @@
  * Temporary buffer for building response packets. Should help ensure
  * that we aren't accidently overwriting some other memory.
  */
-u_char Resp_Buf[1024];
+char   Resp_Buf[1024];
 
 /*
  * Copy the reponse into a buffer we can modify without
@@ -291,8 +292,8 @@
 /*
  * TRAP generic trap types
  */
-char   *Traps[] = { "coldStart", "warmStart", "linkDown", "linkUp",
-               "authenticationFailure", "egpNeighborLoss",
+const char     *Traps[] = { "coldStart", "warmStart", "linkDown", "linkUp",
+                       "authenticationFailure", "egpNeighborLoss",
                        "enterpriseSpecific" };
 
 
@@ -320,6 +321,9 @@
  */
 Objid                  addressEntry[MAX_UNITS + 1];
 
+static const char      ilmi_ident_str[] = "ILMI";
+static const size_t    ilmi_ident_str_len = strlen("ILMI");
+
 /*
  * When this daemon started
  */
@@ -335,11 +339,11 @@
 #define        LOG_FILE        "/var/log/ilmid"
 FILE   *Log;                   /* File descriptor for log messages */
 
-void   set_reqid( u_char *, int );
-void   Increment_DL( int );
-void   Decrement_DL( int );
+static void    set_reqid( char *, uint32_t );
+static void    Increment_DL( int );
+static void    Decrement_DL( int );
 
-static char    *Months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+static const char      *Months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
                             "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
 
 /*
@@ -355,14 +359,14 @@
  *     none
  *
  */
-void
-write_timestamp()
+static void
+write_timestamp(void)
 {
-       time_t          clock;
+       time_t          cur_clock;
        struct tm       *tm;
 
-       clock = time ( (time_t)NULL );
-       tm = localtime ( &clock );
+       cur_clock = time ( NULL );
+       tm = localtime ( &cur_clock );
 
        if ( Log && Debug_Level > 1 )
            if ( Log != stderr )
@@ -385,12 +389,10 @@
  *     none
  *
  */
-void
-hexdump ( bp, len )
-       u_char  *bp;
-       int     len;
+static void
+hexdump ( const char *bp, const uint32_t len )
 {
-       int     i, j;
+       uint32_t        i, j;
 
        /*
         * Print as 4 groups of four bytes. Each byte is separated
@@ -449,23 +451,21 @@
  *     <len>   - decoded length
  *
  */
-int
-asn_get_pdu_len ( bufp, plen )
-       u_char  **bufp;
-       int     *plen;
-{
-       u_char  *bp = *bufp;
-       int     len = 0;
-       int     i, b;
+static int
+asn_get_pdu_len ( const char ** const bufp, uint32_t * const plen )
+{
+       const char *bp =        *bufp;
+       uint32_t        len = 0;
+       uint32_t        i, b;
 
        b = *bp++;
        if ( plen )
-               (*plen)--;
-        if ( b & 0x80 ) {
-               for ( i = 0; i < (b & ~0x80); i++ ) {
+               --(*plen);
+       if ( b & 0x80 ) {
+               for ( i = 0; i < (b & ~0x80); ++i ) {
                        len = len * 256 + *bp++;
                        if ( plen )
-                               (*plen)--;
+                               --(*plen);
                }
        } else
                len = b;
@@ -490,14 +490,12 @@
  *     <val>   - value encoding represented
  *
  */
-int
-asn_get_encoded ( bufp, len )
-       u_char  **bufp;
-       int     *len;
-{
-       u_char  *bp = *bufp;
-       int     val = 0;
-       int     l = *len;
+static int
+asn_get_encoded ( const char ** const bufp, uint32_t * const len )
+{
+       const char      *bp = *bufp;
+       int             val = 0; /* FIXME: signed? sure? */
+       uint32_t        l = *len;
 
        /*
         * Keep going while high bit is set
@@ -507,7 +505,7 @@
                 * Each byte can represent 7 bits
                 */
                val = ( val << 7 ) + ( *bp & ~0x80 );
-               l--;
+               --l;
        } while ( *bp++ & 0x80 );
 
        *bufp = bp;             /* update buffer pointer */
@@ -531,23 +529,21 @@
  *     <val>   - value of encoded integer
  *
  */
-int
-asn_get_int ( bufp, plen )
-       u_char  **bufp;
-       int     *plen;
+static int
+asn_get_int ( const char ** const bufp, uint32_t * const plen )
 {
-       int     i;
-       int     len;
-       int     v = 0;
-       u_char  *bp = *bufp;
+       uint32_t        i;
+       uint32_t        len;
+       int             v = 0;
+       const char      *bp = *bufp;
 
        len = *bp++;
        if ( plen )
-               (*plen)--;
-       for ( i = 0; i < len; i++ ) {
+               --(*plen);
+       for ( i = 0; i < len; ++i ) {
                v = (v * 256) + *bp++;
                if ( plen )
-                       (*plen)--;
+                       --(*plen);
        }
        *bufp = bp;
        return ( v );
@@ -565,18 +561,16 @@
  *     <bufp>  - updated buffer pointer
  *
  */
-void
-asn_set_int ( bufp, val )
-       u_char  **bufp;
-       int     val;
+static void
+asn_set_int ( char **bufp, const uint32_t val )
 {
        union {
-               int     i;
-               u_char  c[4];
+               uint32_t        i;
+               u_char  c[sizeof(uint32_t)];
        } u;
-       int     len = sizeof(int);
-       int     i = 0;
-       u_char  *bp = *bufp;
+       uint32_t        len = sizeof(uint32_t);
+       uint32_t        i = 0;
+       char *bp = *bufp;
 
        /* Check for special case where val == 0 */
        if ( val == 0 ) {
@@ -588,16 +582,16 @@
 
        u.i = htonl ( val );
 
-       while ( u.c[i] == 0  && i++ < sizeof(int) )
-               len--;
+       while ( u.c[i] == 0 && ++i < sizeof(u.i) ) /* 'i++ < x' increases x even if 
increase break bounds */
+               --len;
 
        if ( u.c[i] > 0x7f ) {
-               i--;
-               len++;
+               --i;
+               ++len;
        }
 
-       *bp++ = len;
-       bcopy ( (caddr_t)&u.c[sizeof(int)-len], bp, len );
+       *bp++ = (char)len;
+       bcopy ( &u.c[sizeof(u.i)-len], bp, len );
        bp += len;
        *bufp = bp;
 
@@ -614,11 +608,10 @@
  *     none
  *
  */
-void
-print_objid ( objid )
-       Objid   *objid;
+static void
+print_objid ( const Objid * const objid )
 {
-       int     i;
+       uint32_t        i, cmp = objid->oid[0];
 
        /*
         * First oid coded as 40 * X + Y
@@ -628,7 +621,7 @@
            fprintf ( Log, ".%d.%d", objid->oid[1] / 40,
                objid->oid[1] % 40 );
        }
-       for ( i = 2; i <= objid->oid[0]; i++ )
+       for ( i = 2; i <= cmp; ++i )
            if ( Log )
                fprintf ( Log, ".%d", objid->oid[i] );
        if ( Log )
@@ -651,25 +644,22 @@
  *     plen    - (possibly) adjusted PDU length
  *
  */
-void
-asn_get_objid ( bufp, objid, plen )
-       u_char  **bufp;
-       Objid   *objid;
-       int     *plen;
-{
-       int     len;
-       u_char  *bp = *bufp;
-       int     *ip = (int *)objid + 1; /* First byte will contain length */
-       int     oidlen = 0;
+static void
+asn_get_objid ( const char **bufp, Objid * const objid, uint32_t * const plen )
+{
+       uint32_t        len;
+       const char      *bp = *bufp;
+       int             *ip = (int *)objid + 1; /* First byte will contain length */ 
/* FIXME: first byte or first word? */
+       uint32_t        oidlen = 0;
 
        len = *bp++;
        if ( plen )
-               (*plen)--;
+               --(*plen);
        while ( len ) {
                *ip++ = asn_get_encoded ( &bp, &len );
                if ( plen )
-                       (*plen)--;
-               oidlen++;
+                       --(*plen);
+               ++oidlen;
        }
        objid->oid[0] = oidlen;
        *bufp = bp;
@@ -681,30 +671,29 @@
  * Put OBJID - assumes elements <= 16383 for two byte coding
  *
  */
-int
-asn_put_objid ( bufp, objid )
-       u_char  **bufp;
-       Objid   *objid;
-{
-       int     len = 0;
-       u_char  *bp = *bufp;
-       u_char  *cpp;
-       int     i;
+static int
+asn_put_objid ( char **bufp, const Objid * const objid )
+{
+       uint32_t        len = 0;
+       char            *bp = *bufp;
+       char            *cpp;
+       uint32_t        i;
+       const uint32_t  oidlen = objid->oid[0];
 
        cpp = bp;
        *bp++ = objid->oid[0];
-       len++;
-       for ( i = 1; i <= objid->oid[0]; i++ ) {
-               u_int   c = objid->oid[i];
+       ++len;
+       for ( i = 1; i <= oidlen; ++i ) { /* FIXME: objid->oid[0] can be greater than 
128 which is sizeof(objid->oid) */
+               unsigned char   c = objid->oid[i];
 
                while ( c > 127 ) {
                        *bp++ = ( ( c >> 7 ) & 0x7f ) | 0x80;
-                       len++;
+                       ++len;
                        c &= 0x7f;              /* XXX - assumption of two bytes */
-                       (*cpp)++;
+                       ++(*cpp);
                }
                *bp++ = c;
-               len++;
+               ++len;
        }
 
        *bufp = bp;
@@ -729,26 +718,23 @@
  *     plen    - (possibly) adjusted PDU length
  *
  */
-void
-asn_get_octet ( bufp, octet, plen )
-       u_char  **bufp;
-       char    *octet;
-       int     *plen;
-{
-       u_char  *bp = *bufp;
-       int     i = 0;
-       int     len = 0;
+static void
+asn_get_octet ( const char ** const bufp, char *octet, uint32_t        * const plen )
+{
+       const char      *bp = *bufp;
+       uint32_t        i = 0;
+       uint32_t        len = 0;
 
        /*
         * &i is really a dummy value here as we don't keep track
         * of the ongoing buffer length
         */
-       len = asn_get_encoded ( &bp, &i, plen );
+       len = (uint32_t)asn_get_encoded ( &bp, &i /* FIXME: what's that? , plen */ );
 
-       for ( i = 0; i < len; i++ ) {
+       for ( i = 0; i < len; ++i ) {
                *octet++ = *bp++;
                if ( plen )
-                       (*plen)--;
+                       --(*plen);
        }
 
        *bufp = bp;
@@ -767,11 +753,10 @@
  *     none
  *
  */
-void
-print_header ( Hdr )
-       Snmp_Header *Hdr;
+static void
+print_header ( const Snmp_Header * const Hdr )
 {
-       Variable        *var;
+       const Variable  *var;
 
        if ( Log ) {
            write_timestamp();
@@ -826,27 +811,25 @@
  *     none
  *
  */
-void
-parse_oids ( h, bp )
-       Snmp_Header     *h;
-       caddr_t         *bp;
+static void
+parse_oids ( Snmp_Header * const h, const char ** const bp )
 {
-       int             len = h->varlen;
-       int             sublen;
+       uint32_t        len = h->varlen;
+       uint32_t        sublen;
        Variable        *var;
-       caddr_t         bufp = *bp;
+       const char      *bufp = *bp;
 
        while ( len > 0 ) {
            if ( *bufp++ == ASN_SEQUENCE ) {
-               len--;
+               --len;
 
                /* Create new Variable instance */
-               if ( ( var = (Variable *)malloc(sizeof(Variable)) ) == NULL )
+               if ( ( var = malloc(sizeof(*var)) ) == NULL )
                {
                        *bp = bufp;
                        return;
                }
-               bzero(var, sizeof(Variable));
+               bzero(var, sizeof(*var));
                /* Link to tail */
                if ( h->tail )
                        h->tail->next = var;
@@ -872,8 +855,8 @@
                        var->var.ival = asn_get_int ( &bufp, &len );
                        break;
                case ASN_NULL:
-                       bufp++;
-                       len--;
+                       ++bufp;
+                       --len;
                        break;
                case ASN_OBJID:
                        asn_get_objid ( &bufp, &var->var.oval, &len );
@@ -913,25 +896,26 @@
  *             - generated SNMP header
  *
  */
-Snmp_Header *
-asn_get_header ( bufp )
-       u_char **bufp;
+static Snmp_Header *
+asn_get_header ( const char **bufp )
 {
        Snmp_Header     *h;
-       u_char          *bp = *bufp;
-       int             len = 0;
-       int             dummy = 0;
+       const char      *bp = *bufp;
+       uint32_t        len = 0;
+       /*
+       uint32_t        dummy = 0;
+       */
 
        /*
         * Allocate memory to hold the SNMP header
         */
-       if ( ( h = (Snmp_Header *)malloc(sizeof(Snmp_Header)) ) == NULL )
+       if ( ( h = malloc(sizeof(*h)) ) == NULL ) /* void * matches any pointer type */
                return ( (Snmp_Header *)NULL );
 
        /*
         * Ensure that we wipe the slate clean
         */
-       bzero(h, sizeof(Snmp_Header));
+       bzero(h, sizeof(*h));
 
        /*
         * PDU has to start as SEQUENCE OF
@@ -970,7 +954,7 @@
         */
        if ( h->pdutype != PDU_TYPE_TRAP ) {    /* TRAP uses different format */
 
-               (void) asn_get_pdu_len ( &bp, &dummy );
+               (void) asn_get_pdu_len ( &bp, NULL ); /* &dummy -> NULL */
 
                /* Request ID */
                if ( *bp++ != ASN_INTEGER ) {
@@ -1025,17 +1009,16 @@
  *     1       - Objid's don't match
  *
  */
-int
-oid_cmp ( oid1, oid2 )
-       Objid *oid1, *oid2;
+static int
+oid_cmp ( const Objid * const oid1, const Objid * const oid2 )
 {
-       int     i;
-       int     len;
+       uint32_t        i;
+       uint32_t        len;
 
        /*
         * Compare lengths
         */
-       if ( !(oid1->oid[0] == oid2->oid[0] ) )
+       if ( !(oid1->oid[0] == oid2->oid[0] ) ) /* FIXME: how about if( oid1->oid[0] 
!= oid2->oid[0] ) */
                /* Different lengths */
                return ( 1 );
 
@@ -1067,12 +1050,10 @@
  *     1       - Objid's don't match
  *
  */
-int
-oid_ncmp ( oid1, oid2, len )
-       Objid *oid1, *oid2;
-       int     len;
+static int
+oid_ncmp ( const Objid * const oid1, const Objid * const oid2, const uint32_t len )
 {
-       int     i;
+       uint32_t        i;
 
        /*
         * value by value compare
@@ -1098,11 +1079,10 @@
  *     -1      - no matching Variable found
  *
  */
-int
-find_var ( var )
-       Variable        *var;
+static int
+find_var ( const Variable * const var )
 {
-       int     i;
+       size_t          i;
 
        for ( i = 0; i < NUM_OIDS; i++ )
                if ( oid_cmp ( &var->oid, &Objids[i] ) == 0 ) {
@@ -1167,19 +1147,17 @@
  *     none
  *
  */
-void
-build_pdu ( hdr, type )
-       Snmp_Header     *hdr;
-       int             type;
+static void
+build_pdu ( Snmp_Header * const hdr, const int type )
 {
-       u_char          *bp = Resp_Buf;
-       u_char          *vpp;
-       u_char          *ppp;
+       char            *bp = Resp_Buf;
+       char            *vpp;
+       char            *ppp;
        int             erridx = 0;
        int             varidx = 1;
-       int             varlen = 0;
-       int             pdulen = 0;
-       int             traplen = 0;
+       uint32_t        varlen = 0;
+       uint32_t        pdulen = 0;
+       uint32_t        traplen = 0;
        Variable        *var;
 
        /*
@@ -1188,14 +1166,14 @@
        bzero ( Resp_Buf, sizeof(Resp_Buf) );
 
        /* [0] is reserved for overall length */
-       bp++;
+       ++bp;
 
        /* Start with SEQUENCE OF */
        *bp++ = ASN_SEQUENCE;
        /* - assume we can code length in two octets */
-       *bp++ = 0x82;
-       bp++;
-       bp++;
+       *bp++ = (unsigned char)0x82;
+       ++bp;
+       ++bp;
        /* Version */
        *bp++ = ASN_INTEGER;
        asn_set_int ( &bp, hdr->version );
@@ -1208,7 +1186,7 @@
        *bp++ = type;
        ppp = bp;
        /* Length of OID data - assume it'll fit in one octet */
-       bp++;
+       ++bp;
 
        if ( type != PDU_TYPE_TRAP ) {
            /* Sequence ID */
@@ -1250,7 +1228,7 @@
                /* Fill in IP address */
                *bp++ = ASN_IPADDR;
                *bp++ = sizeof ( hdr->ipaddr );
-               bcopy ( (caddr_t)&hdr->ipaddr, bp, sizeof(hdr->ipaddr) );
+               bcopy ( &hdr->ipaddr, bp, sizeof(hdr->ipaddr) );
                bp += sizeof(hdr->ipaddr);
 
                /* Fill in generic and specific trap types */
@@ -1271,44 +1249,44 @@
 
        /* SEQUENCE OF */
        *bp++ = ASN_SEQUENCE;
-       *bp++ = 0x82;
+       *bp++ = (unsigned char)0x82;
        /* - assume we can code length in two octets */
        vpp = bp;
        varlen = 0;
-       bp++;
-       bp++;
+       ++bp;
+       ++bp;
 
        /* Install Variables */
        var = hdr->head;
        varidx = 1;
        while ( var ) {
-               u_char *bpp;
-               int     len = 0;
+               char            *bpp;
+               uint32_t        len = 0;
 
                /* SEQUENCE OF */
                *bp++ = ASN_SEQUENCE;
-               *bp++ = 0x82;
+               *bp++ = (unsigned char)0x82;
                /* - assume we can code length in two octets */
                bpp = bp;
-               bp++;
-               bp++;
+               ++bp;
+               ++bp;
                /* OBJID */
                *bp++ = ASN_OBJID;
-               len++;
+               ++len;
 
                len += asn_put_objid ( &bp, &var->oid );
 
                if ( erridx && varidx >= erridx ) {
                        /* Code this variable as NULL */
                        *bp++ = ASN_NULL;
-                       len++;
-                       bp++;
-                       len++;
+                       ++len;
+                       ++bp;
+                       ++len;
                } else {
-                       u_char *lpp;
+                       char    *lpp;
                        /* Variable type */
                        *bp++ = var->type;
-                       len++;
+                       ++len;
                        lpp = bp;
                        switch ( var->type ) {
                        case ASN_INTEGER:
@@ -1317,15 +1295,15 @@
                                break;
                        case ASN_OCTET:
                                *bp++ = var->var.sval[0];
-                               len++;
-                               bcopy ( (caddr_t)&var->var.sval[1],
+                               ++len;
+                               bcopy ( &var->var.sval[1],
                                        bp, var->var.sval[0] );
                                len += var->var.sval[0];
                                bp += var->var.sval[0];
                                break;
                        case ASN_NULL:
                                *bp++ = 0x00;
-                               len++;
+                               ++len;
                                break;
                        case ASN_OBJID:
                                len += asn_put_objid ( &bp, &var->var.oval );
@@ -1333,11 +1311,11 @@
                        case ASN_SEQUENCE:
                                break;
                        case ASN_IPADDR:
-                               *bp++ = 4;
-                               len++;
-                               bcopy ( (caddr_t)&var->var.aval, bp, 4 );
-                               len += 4;
-                               bp += 4;
+                               *bp++ = sizeof(var->var.aval);
+                               ++len;
+                               bcopy ( &var->var.aval, bp, sizeof(var->var.aval) );
+                               len += sizeof(var->var.aval);
+                               bp += sizeof(var->var.aval);
                                break;
                        case ASN_TIMESTAMP:
                                asn_set_int ( &bp, var->var.ival );
@@ -1349,7 +1327,7 @@
                }
 
                /* Accumulate total Variable sequence length */
-               varlen += (len + 4);
+               varlen += (len + 4); /* FIXME: why 4? is it sizeof(var->var.aval) */
 
                /* Fill in length of this sequence */
                bpp[1] = len & 0xff;
@@ -1385,18 +1363,18 @@
        return;
 }
 
-void
-free_pdu ( hdr )
-Snmp_Header *hdr;
+static void
+free_pdu ( Snmp_Header *hdr )
 {
-       Variable        *var;
+       Variable        *var = hdr->head, *var_next;
 
-       while ( hdr->head ) {
-               var = hdr->head->next;          /* Save next link */
-               free ( hdr->head );             /* Free current var */
-               hdr->head = var;                /* Set head to next link */
+       while ( var ) {
+               var_next = var->next;           /* Save next link */
+               free ( var );                   /* Free current var */
+               var_next = var;                 /* Set head to saved next link */
        }
 
+       hdr->head = NULL;
        free ( hdr );                           /* Free fixed portion */
 }
 
@@ -1411,29 +1389,27 @@
  *     none    - request id may/may not be set
  *
  */
-void
-set_reqid ( resp, reqid )
-       u_char  *resp;
-       int     reqid;
+static void
+set_reqid ( char *resp, uint32_t reqid )
 {
-       u_char          *bp = (u_char *)&resp[18];
+       char    *bp = resp+18;
        union {
-               int     i;
-               u_char  c[4];
+               uint32_t        i;
+               char            c[sizeof(uint32_t)];
        } u;
 
-       u.i = htonl(reqid);
+       u.i = htonl( reqid );
 
        /*
         * Replace the current Request ID with the supplied value
         */
-       bcopy ( (caddr_t)&u.c[4-resp[17]], bp, resp[17] );
+       bcopy ( &u.c[4-resp[17]], bp, resp[17] );
 
        return;
 }
 
 /*
- * Send a generic response packet
+ * Send a generic response packet - FIXME: documentation doesn't match declaration
  *
  * Arguments:
  *     sd      - socket to send the reply on
@@ -1444,22 +1420,19 @@
  *     none    - response sent
  *
  */
-void
-send_resp ( intf, Hdr, resp )
-       int             intf;
-       Snmp_Header     *Hdr;
-       u_char          *resp;
+static void
+send_resp ( const int intf, Snmp_Header *Hdr, unsigned char *resp )
 {
        int     n;
 
-       if ( ilmi_fd[intf] > 0 ) {
-           n = write ( ilmi_fd[intf], (caddr_t)&resp[1], resp[0] );
+       if ( ilmi_fd[intf] > 0 ) { /* FIXME: does ilmi_fd[intf] exists? out of range? 
*/
+           n = write ( ilmi_fd[intf], resp+1, resp[0] );
            if ( Log && Debug_Level > 1 ) {
                write_timestamp();
                fprintf ( Log, "===== Sent %d of %d bytes (%d) =====\n", n, resp[0], 
ilmi_fd[intf] );
                print_header ( Hdr );
                if ( Debug_Level > 2 )
-                       hexdump ( (u_char *)&resp[1], resp[0] );
+                       hexdump ( &resp[1], resp[0] );
            }
        }
 
@@ -1471,39 +1444,40 @@
  * Build a COLD_START TRAP PDU
  *
  */
-Snmp_Header *
-build_cold_start()
+static Snmp_Header *
+build_cold_start(void)
 {
        Snmp_Header     *hdr;
        Variable        *var;
 
-       hdr = (Snmp_Header *)malloc(sizeof(Snmp_Header));
+       hdr = malloc(sizeof(*hdr));
        if (hdr == NULL) {
-               fprintf(stderr, "malloc() failed in %s()\n", __func__);
+               fprintf(stderr, "malloc() failed in %s() line %d\n", __func__, 
__LINE__);
                exit(1);
        }
-       bzero(hdr, sizeof(Snmp_Header));
+       bzero(hdr, sizeof(*hdr));
 
+       /* FIXME: bzero has done that
        hdr->pdulen = 0;
+       */
        hdr->version = SNMP_VERSION_1 - 1;
-       snprintf ( hdr->community, sizeof(hdr->community), "ILMI" );
+       snprintf ( hdr->community, ilmi_ident_str_len, ilmi_ident_str );
 
-       hdr->ipaddr = 0x0;      /* 0.0.0.0 */
+       /* FIXME: bzero: hdr->ipaddr = 0x0;     */ /* 0.0.0.0 */
        hdr->generic_trap = TRAP_COLDSTART;
-       hdr->specific_trap = 0;
-       bcopy ( (caddr_t)&Objids[ENTERPRISE_OBJID], (caddr_t)&hdr->enterprise,
+       /* FIXME: bzero: hdr->specific_trap = 0; */
+       bcopy ( &Objids[ENTERPRISE_OBJID], &hdr->enterprise,
                sizeof(Objid) );
 
-       hdr->head = (Variable *)malloc(sizeof(Variable));
-       if (hdr == NULL) {
-               fprintf(stderr, "malloc() failed in %s()\n", __func__);
+       hdr->head = malloc(sizeof(*hdr->head));
+       if (hdr->head == NULL) {
+               fprintf(stderr, "malloc() failed in %s() line %d\n", __func__, 
__LINE__);
                exit(1);
        }
-       bzero(hdr->head, sizeof(Variable));
+       bzero(hdr->head, sizeof(*hdr->head));
 
        var = hdr->head;
-       bcopy ( (caddr_t)&Objids[UPTIME_OBJID], (caddr_t)&var->oid,
-               sizeof(Objid) );
+       bcopy ( &Objids[UPTIME_OBJID], &var->oid, sizeof(var->oid) );
        var->type = ASN_NULL;
 
        return ( hdr );
@@ -1513,21 +1487,21 @@
  * Build a Generic PDU Header
  *
  */
-Snmp_Header *
-build_generic_header()
+static Snmp_Header *
+build_generic_header( void )
 {
        Snmp_Header     *hdr;
 
-       hdr = (Snmp_Header *)malloc(sizeof(Snmp_Header));
+       hdr = malloc(sizeof(*hdr));
        if (hdr == NULL) {
                fprintf(stderr, "malloc() failed in %s()\n", __func__);
                exit(1);
        }
-       bzero(hdr, sizeof(Snmp_Header));
+       bzero(hdr, sizeof(*hdr));
 
-       hdr->pdulen = 0;
+       /* FIXME: bzero: hdr->pdulen = 0; */
        hdr->version = SNMP_VERSION_1 - 1;
-       snprintf ( hdr->community, sizeof(hdr->community), "ILMI" );
+       snprintf ( hdr->community, ilmi_ident_str_len, ilmi_ident_str );
 
        return ( hdr );
 }
@@ -1546,12 +1520,12 @@
  *      none            Information from HARP available
  *
  */
-void
-init_ilmi()
+static void
+init_ilmi(void)
 {
-        struct  air_cfg_rsp     *cfg_info = NULL;
-        struct  air_int_rsp    *intf_info = NULL;
-        int                     buf_len;
+        struct  air_cfg_rsp    *cfg_info = NULL;
+        struct  air_int_rsp    *intf_info = NULL;
+        int                    buf_len;
 
        /*
         * Get configuration info - what's available with 'atm sh config'
@@ -1562,7 +1536,7 @@
         */
        if ( buf_len <= 0 ) {
                bzero ( Cfg, sizeof(Cfg) );
-               bzero( Intf, sizeof(Intf) );
+               bzero ( Intf, sizeof(Intf) );
                NUnits = 0;
                return;
        }
@@ -1570,11 +1544,11 @@
        /*
         * Move to local storage
         */
-        bcopy ( cfg_info, (caddr_t)Cfg, buf_len );
+        bcopy ( cfg_info, Cfg, buf_len );
        /*
         * Compute how many units information was returned for
         */
-        NUnits = buf_len / sizeof(struct air_cfg_rsp);
+        NUnits = buf_len / sizeof(*cfg_info);
        /* Housecleaning */
         free ( cfg_info );
         cfg_info = NULL;
@@ -1593,7 +1567,7 @@
        /*
         * Move to local storage
         */
-        bcopy ( intf_info, (caddr_t)Intf, buf_len );
+        bcopy ( intf_info, Intf, buf_len );
        /* Housecleaning */
         free ( intf_info );
         intf_info = NULL;
@@ -1617,31 +1591,31 @@
  *      none
  *
  */
-void
-ilmi_open ()
+static void
+ilmi_open (void)
 {
-        struct sockaddr_atm     satm;
-        struct t_atm_aal5       aal5;
-        struct t_atm_traffic    traffic;
-        struct t_atm_bearer     bearer;
-        struct t_atm_qos        qos;
+        struct sockaddr_atm    satm;
+        struct t_atm_aal5      aal5;
+        struct t_atm_traffic   traffic;
+        struct t_atm_bearer    bearer;
+        struct t_atm_qos       qos;
        struct t_atm_app_name   appname;
-        Atm_addr                subaddr;
-        char                    nifname[IFNAMSIZ];
-        int                     optlen;
-        int                     unit = 0;
+        Atm_addr               subaddr;
+        char                   nifname[IFNAMSIZ];
+        socklen_t              optlen;
+        int                    unit = 0;
        u_char                  sig_proto;
 
         init_ilmi();
 
-       for ( unit = 0; unit < NUnits; unit++ ) {
+       for ( unit = 0; unit < NUnits; ++unit ) {
 
            /*
             * ILMI only makes sense for UNI signalling protocols
             */
            sig_proto = Intf[unit].anp_sig_proto;
            if ( sig_proto != ATM_SIG_UNI30 && sig_proto != ATM_SIG_UNI31 &&
-               sig_proto != ATM_SIG_UNI40 )
+                sig_proto != ATM_SIG_UNI40 )
                    continue;
 
                    if ( ilmi_fd[unit] == -1 ) {
@@ -1668,7 +1642,7 @@
                 sprintf ( nifname, "%s0", Intf[unit].anp_nif_pref );
                 optlen = sizeof ( nifname );
                 if ( setsockopt ( ilmi_fd[unit], T_ATM_SIGNALING,
-                   T_ATM_NET_INTF, (caddr_t)nifname, optlen ) < 0 ) {
+                   T_ATM_NET_INTF, (char *)nifname, optlen ) < 0 ) {
                                perror ( "setsockopt" );
                        if ( Log ) {
                            write_timestamp();
@@ -1688,7 +1662,7 @@
                 /*
                  * Set up destination SAP
                  */
-                bzero ( (caddr_t) &satm, sizeof(satm) );
+                bzero ( &satm, sizeof(satm) );
                 satm.satm_family = AF_ATM;
 #if (defined(BSD) && (BSD >= 199103))
                 satm.satm_len = sizeof(satm);
@@ -1719,7 +1693,7 @@
                 aal5.SSCS_type = T_ATM_NULL;
                 optlen = sizeof(aal5);
                 if ( setsockopt ( ilmi_fd[unit], T_ATM_SIGNALING, T_ATM_AAL5,
-                (caddr_t) &aal5, optlen ) < 0 ) {
+                (char *) &aal5, optlen ) < 0 ) {
                     perror ( "setsockopt(aal5)" );
                    if ( Debug_Level > 1 && Log ) {
                        write_timestamp();
@@ -1747,7 +1721,7 @@
                 traffic.best_effort = T_YES;
                 optlen = sizeof(traffic);
                 if (setsockopt(ilmi_fd[unit], T_ATM_SIGNALING, T_ATM_TRAFFIC,
-                        (caddr_t)&traffic, optlen) < 0) {
+                        &traffic, optlen) < 0) {
                     perror("setsockopt(traffic)");
                 }
                 bearer.bearer_class = T_ATM_CLASS_X;
@@ -1757,7 +1731,7 @@
                 bearer.connection_configuration = T_ATM_1_TO_1;
                 optlen = sizeof(bearer);
                 if (setsockopt(ilmi_fd[unit], T_ATM_SIGNALING, T_ATM_BEARER_CAP,
-                        (caddr_t)&bearer, optlen) < 0) {
+                        &bearer, optlen) < 0) {
                     perror("setsockopt(bearer)");
                 }
 
@@ -1765,7 +1739,7 @@
                 qos.forward.qos_class = T_ATM_QOS_CLASS_0;
                 qos.backward.qos_class = T_ATM_QOS_CLASS_0;
                 optlen = sizeof(qos);
-                if (setsockopt(ilmi_fd[unit], T_ATM_SIGNALING, T_ATM_QOS, 
(caddr_t)&qos,
+                if (setsockopt(ilmi_fd[unit], T_ATM_SIGNALING, T_ATM_QOS, &qos,
                         optlen) < 0) {
                     perror("setsockopt(qos)");
                 }
@@ -1774,14 +1748,14 @@
                 subaddr.address_length = 0;
                 optlen = sizeof(subaddr);
                 if (setsockopt(ilmi_fd[unit], T_ATM_SIGNALING, T_ATM_DEST_SUB,
-                        (caddr_t)&subaddr, optlen) < 0) {
+                        &subaddr, optlen) < 0) {
                     perror("setsockopt(dest_sub)");
                 }
 
                strncpy(appname.app_name, "ILMI", T_ATM_APP_NAME_LEN);
                optlen = sizeof(appname);
                if (setsockopt(ilmi_fd[unit], T_ATM_SIGNALING, T_ATM_APP_NAME,
-                       (caddr_t)&appname, optlen) < 0) {
+                       &appname, optlen) < 0) {
                    perror("setsockopt(appname)");
                }
 
@@ -1826,21 +1800,19 @@
  *     none
  *
  */
-void
-get_local_ip ( s, aval )
-       int     s;
-       long    *aval;
+static void
+get_local_ip ( int s, uint32_t *aval )
 {
        char                    intf_name[IFNAMSIZ];
-       int                     namelen = IFNAMSIZ;
+       socklen_t               namelen = IFNAMSIZ;
        struct air_netif_rsp    *net_info = NULL;
-       struct sockaddr_in      *sin;
+       struct sockaddr_in      *s_in;
 
        /*
         * Get physical interface name
         */
        if ( getsockopt ( s, T_ATM_SIGNALING, T_ATM_NET_INTF,
-           (caddr_t) intf_name, &namelen ) )
+                         intf_name, &namelen ) )
                return;
 
        /*
@@ -1850,12 +1822,12 @@
        if ( net_info == NULL )
                return;
 
-       sin = (struct sockaddr_in *)&net_info->anp_proto_addr;
+       s_in = (struct sockaddr_in *)&net_info->anp_proto_addr;
 
        /*
         * Fill in answer
         */
-       bcopy ( (caddr_t)&sin->sin_addr.s_addr, aval, 4 );
+       bcopy ( &s_in->sin_addr.s_addr, aval, sizeof(*aval) );
 
        free ( net_info );
 
@@ -1872,7 +1844,7 @@
  *
  * Arguments:
  *     oid     - objid from SET message
- *     hdr     - pointer to internal SNMP header
+ *     hdr     - pointer to internal SNMP header - unused
  *     buf     - pointer to SET buffer
  *     s       - socket to send messages on
  *
@@ -1880,17 +1852,16 @@
  *     none
  *
  */
-void
-set_prefix ( oid, hdr, intf )
-       Objid           *oid;
-       Snmp_Header     *hdr;
-       int             intf;
+static void
+set_prefix ( const Objid * const oid, const Snmp_Header * const hdr, const int intf )
 {
        struct atmsetreq        asr;
        Atm_addr                *aa;
        int                     fd;
        int                     i;
 
+       (void)hdr; /* to make the ansi compiler happy */
+
        /*
         * Build IOCTL request to set prefix
         */
@@ -1901,7 +1872,7 @@
         * Pull prefix out of received Objid
         *      save in set_prefix IOCTL and addressEntry table
         */
-       for ( i = 0; i < oid->oid[13]; i++ ) {
+       for ( i = 0; i < oid->oid[13]; ++i ) {
                asr.asr_prf_pref[i] = oid->oid[i + 14];
        }
 
@@ -1911,7 +1882,7 @@
        fd = socket ( AF_ATM, SOCK_DGRAM, 0 );
        if ( fd < 0 )
                return;
-       if ( ioctl ( fd, AIOCSET, (caddr_t)&asr ) < 0 ) {
+       if ( ioctl ( fd, AIOCSET, (char *)&asr ) < 0 ) {
                if ( errno != EALREADY ) {
                    syslog ( LOG_ERR, "ilmid: error setting prefix: %m" );
                    if ( Log ) {
@@ -1947,27 +1918,27 @@
 
 }
 
-void
-set_address ( hdr, intf )
-       Snmp_Header     *hdr;
-       int             intf;
+static void
+set_address ( const Snmp_Header * const hdr, const int intf )
 {
        Variable        *var;
        int             i, j;
 
+       (void)hdr; /* to make ansi compiler happy */
+
        PDU_Header = build_generic_header();
 
-       PDU_Header->head = (Variable *)malloc(sizeof(Variable));
+       PDU_Header->head = malloc(sizeof(*PDU_Header->head));
        if (PDU_Header->head == NULL) {
-               fprintf(stderr, "malloc() failed in %s()\n", __func__);
+               fprintf(stderr, "malloc() failed in %s() line %d\n", __func__, 
__LINE__);
                exit(1);
        }
-       bzero(PDU_Header->head, sizeof(Variable));
+       bzero(PDU_Header->head, sizeof(*PDU_Header->head));
 
        var = PDU_Header->head;
        /* Copy generic addressEntry OBJID */
-       bcopy ( (caddr_t)&Objids[ADDRESS_OBJID], (caddr_t)&var->oid,
-               sizeof(Objid) );
+       bcopy ( &Objids[ADDRESS_OBJID], &var->oid,
+               sizeof(var->oid) );
        /* Set specific instance */
        i = var->oid.oid[0] + 1;                /* Get length */
        var->oid.oid[i++] = 1;
@@ -2001,16 +1972,15 @@
  *      fname           striped filename
  *
  */
-char *
-basename ( path )
-        char *path;
+static char *
+basename ( const char *path )
 {
         char *fname;
 
-        if ( ( fname = (char *)strrchr ( path, '/' ) ) != NULL )
-                fname++;
+        if ( ( fname = strrchr ( path, '/' ) ) != NULL )
+                ++fname;
         else
-                fname = path;
+                fname = (char *)path;
 
         return ( fname );
 }
@@ -2027,10 +1997,10 @@
  *     none    - Debug_Level incremented
  *
  */
-void
-Increment_DL ( sig )
-       int     sig;
+static void
+Increment_DL ( int sig )
 {
+       (void)sig; /* make the ansi compiler happy */
        Debug_Level++;
        if ( Debug_Level && Log == (FILE *)NULL ) {
            if ( foregnd ) {
@@ -2061,10 +2031,10 @@
  *     none    - Debug_Level decremented
  *
  */
-void
-Decrement_DL ( sig )
-       int     sig;
+static void
+Decrement_DL ( int sig )
 {
+       (void)sig; /* make the ansi compiler happy */
        Debug_Level--;
        if ( Debug_Level <= 0 ) {
            Debug_Level = 0;
@@ -2084,10 +2054,8 @@
  * Loop through GET variable list looking for matches
  *
  */
-void
-process_get ( hdr, intf )
-       Snmp_Header     *hdr;
-       int             intf;
+static void
+process_get ( Snmp_Header * const hdr, const int intf )
 {
        Variable        *var;
        int             idx;
@@ -2098,9 +2066,9 @@
                switch ( idx ) {
                case SYS_OBJID:
                        var->type = ASN_OBJID;
-                       bcopy ( (caddr_t)&Objids[MY_OBJID],
-                           (caddr_t)&var->var.oval,
-                               sizeof(Objid) );
+                       bcopy ( &Objids[MY_OBJID],
+                               &var->var.oval,
+                               sizeof(var->var.oval) );
                        break;
                case UPTIME_OBJID:
                        var->type = ASN_TIMESTAMP;
@@ -2142,7 +2110,7 @@
                case IPNM_OBJID:
                        var->type = ASN_IPADDR;
                        get_local_ip ( ilmi_fd[intf],
-                           &var->var.ival );
+                           &var->var.aval );
                        break;
                case ADDRESS_OBJID:
                        break;
@@ -2152,9 +2120,9 @@
                        break;
                case ATMF_SYSID:
                        var->type = ASN_OCTET;
-                       var->var.sval[0] = 6;
-                       bcopy ( (caddr_t)&Cfg[intf].acp_macaddr,
-                           (caddr_t)&var->var.sval[1], 6 );
+                       var->var.sval[0] = sizeof(Cfg[intf].acp_macaddr);
+                       bcopy ( &Cfg[intf].acp_macaddr,
+                               &var->var.sval[1], sizeof(Cfg[intf].acp_macaddr) );
                        break;
                default:
                        /* NO_SUCH */
@@ -2172,12 +2140,12 @@
  *
  *
  */
-void
-ilmi_do_state ()
+static void
+ilmi_do_state (void)
 {
        struct timeval  tvp;
        fd_set          rfd;
-       u_char          buf[1024];
+       char            buf[1024];
        Variable        *var;
        int             intf;
        int             maxfd = 0;
@@ -2188,7 +2156,7 @@
        for ( ; ; ) {
            int         count;
            int         n;
-           caddr_t     bpp;
+           char        *bpp;
            Snmp_Header *Hdr;
 
            /*
@@ -2222,7 +2190,7 @@
                        /*
                         * Clear addressTable
                         */
-                       bzero ( (caddr_t)&addressEntry[intf], sizeof(Objid) );
+                       bzero ( &addressEntry[intf], sizeof(Objid) );
 
                        /*
                         * Start by sending a COLD_START trap. This should cause the
@@ -2252,16 +2220,16 @@
                         */
                        PDU_Header = build_generic_header();
 
-                       PDU_Header->head = (Variable *)malloc(sizeof(Variable));
+                       PDU_Header->head = malloc(sizeof(*PDU_Header->head));
                        if (PDU_Header->head == NULL) {
-                               fprintf(stderr, "malloc() failed in %s()\n", __func__);
+                               fprintf(stderr, "malloc() failed in %s() line %d\n", 
__func__, __LINE__);
                                exit(1);
                        }
-                       bzero(PDU_Header->head, sizeof(Variable));
+                       bzero(PDU_Header->head, sizeof(*PDU_Header->head));
 
                        var = PDU_Header->head;
-                       bcopy ( (caddr_t)&Objids[ADDRESS_OBJID], (caddr_t)&var->oid,
-                           sizeof(Objid) );
+                       bcopy ( &Objids[ADDRESS_OBJID], &var->oid,
+                           sizeof(var->oid) );
                        var->type = ASN_NULL;
                        var->next = NULL;
 
@@ -2296,7 +2264,7 @@
                 */
                if ( ilmi_fd[intf] > 0 && FD_ISSET ( ilmi_fd[intf], & rfd ) ) {
 
-                   n = read ( ilmi_fd[intf], (caddr_t)&buf[1], sizeof(buf) - 1 );
+                   n = read ( ilmi_fd[intf], &buf[1], sizeof(buf) - 1 );
                    if ( n == -1 && ( errno == ECONNRESET || errno == EBADF ) ) {
                        ilmi_state[intf] = ILMI_COLDSTART;
                        close ( ilmi_fd[intf] );
@@ -2305,10 +2273,10 @@
                        if ( Log && Debug_Level > 1 ) fprintf ( Log, "***** state %d 
***** read %d bytes from %d (%d) ***** %s *****\n",
                            ilmi_state[intf], n, intf, ilmi_fd[intf], 
PDU_Types[buf[14] - 0xA0] ); {
                                if ( Debug_Level > 2 )
-                                   hexdump ( (caddr_t)&buf[1], n );
+                                   hexdump ( &buf[1], n );
                        }
-                       bpp = (caddr_t)&buf[1];
-                       if ( ( Hdr = asn_get_header ( &bpp ) ) == NULL )
+                       bpp = &buf[1];
+                       if ( ( Hdr = asn_get_header ( (const char **)&bpp ) ) == NULL )
                            continue;
 
                        /* What we do with this messages depends upon the state we're 
in */
@@ -2325,9 +2293,9 @@
                                 * Should be because the remote side is attempting
                                 * to verify that our table is empty
                                 */
-                               if ( oid_ncmp ( (caddr_t)&Hdr->head->oid,
-                                   (caddr_t)&Objids[ADDRESS_OBJID],
-                                       Objids[ADDRESS_OBJID].oid[0] ) == 0 ) {
+                               if ( oid_ncmp ( &Hdr->head->oid,
+                                               &Objids[ADDRESS_OBJID],
+                                               Objids[ADDRESS_OBJID].oid[0] ) == 0 ) {
                                        if ( addressEntry[intf].oid[0] ) {
                                            /* XXX - FIXME */
                                            /* Our table is not empty - return address 
*/
@@ -2381,12 +2349,12 @@
                                break;
                            case PDU_TYPE_SET:
                                /* Look for SET_PREFIX Objid */
-                               if ( oid_ncmp ( (caddr_t)&Hdr->head->oid,
-                                   (caddr_t)&Objids[SETPFX_OBJID],
-                                       Objids[SETPFX_OBJID].oid[0] ) == 0 ) {
+                               if ( oid_ncmp ( &Hdr->head->oid,
+                                               &Objids[SETPFX_OBJID],
+                                               Objids[SETPFX_OBJID].oid[0] ) == 0 ) {
                                            set_prefix ( &Hdr->head->oid, Hdr, intf );
                                            /* Reply to SET before sending our ADDRESS 
*/
-                                           build_pdu(Hdr, PDU_TYPE_GETRESP);
+                                           build_pdu( Hdr, PDU_TYPE_GETRESP );
                                            send_resp( intf, Hdr, Resp_Buf );
                                            set_address ( Hdr, intf );
                                } else {
@@ -2422,9 +2390,9 @@
                                break;
                            case PDU_TYPE_SET:
                                /* Look for SET_PREFIX Objid */
-                               if ( oid_ncmp ( (caddr_t)&Hdr->head->oid,
-                                   (caddr_t)&Objids[SETPFX_OBJID],
-                                       Objids[SETPFX_OBJID].oid[0] ) == 0 ) {
+                               if ( oid_ncmp ( &Hdr->head->oid,
+                                               &Objids[SETPFX_OBJID],
+                                               Objids[SETPFX_OBJID].oid[0] ) == 0 ) {
                                            set_prefix ( &Hdr->head->oid, Hdr, intf );
                                            /* Reply to SET before sending our ADDRESS 
*/
                                            build_pdu(Hdr, PDU_TYPE_GETRESP);
@@ -2453,9 +2421,7 @@
 }
 
 int
-main ( argc, argv )
-       int     argc;
-       char    *argv[];
+main ( int argc, char *argv[] )
 {
        int     c;
        int     i;
@@ -2507,7 +2473,7 @@
                if ( daemon ( 0, 0 ) )
                        err ( 1, "Can't fork" );
        } else
-               ; /* setbuf ( stdout, NULL ); */
+               (void)0; /* setbuf ( stdout, NULL ); */
 
        signal ( SIGUSR1, Increment_DL );
        signal ( SIGUSR2, Decrement_DL );

Reply via email to