Welcome to the Wonderful World of ANSI C!
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 24 Jul 1992 07:42:23 +0000 (23:42 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 24 Jul 1992 07:42:23 +0000 (23:42 -0800)
SCCS-vsn: libexec/rbootd/bpf.c 5.2
SCCS-vsn: libexec/rbootd/conf.c 5.2
SCCS-vsn: libexec/rbootd/defs.h 5.2
SCCS-vsn: libexec/rbootd/parseconf.c 5.2
SCCS-vsn: libexec/rbootd/rbootd.c 5.2
SCCS-vsn: libexec/rbootd/rmpproto.c 5.2
SCCS-vsn: libexec/rbootd/utils.c 5.2

usr/src/libexec/rbootd/bpf.c
usr/src/libexec/rbootd/conf.c
usr/src/libexec/rbootd/defs.h
usr/src/libexec/rbootd/parseconf.c
usr/src/libexec/rbootd/rbootd.c
usr/src/libexec/rbootd/rmpproto.c
usr/src/libexec/rbootd/utils.c

index b982f3c..6a495c2 100644 (file)
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)bpf.c       5.1 (Berkeley) %G%
+ *     @(#)bpf.c       5.2 (Berkeley) %G%
  *
  * Utah $Hdr: bpf.c 3.1 92/07/06$
  * Author: Jeff Forys, University of Utah CSS
  */
 
 #ifndef lint
  *
  * Utah $Hdr: bpf.c 3.1 92/07/06$
  * Author: Jeff Forys, University of Utah CSS
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)bpf.c      5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)bpf.c      5.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "defs.h"
-
-#include <ctype.h>
-#include <syslog.h>
-#include <strings.h>
-
+#include <sys/param.h>
 #include <sys/ioctl.h>
 #include <sys/ioctl.h>
-#include <sys/file.h>
-#include <sys/errno.h>
+#include <sys/socket.h>
 
 #include <net/if.h>
 #include <net/bpf.h>
 
 
 #include <net/if.h>
 #include <net/bpf.h>
 
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <unistd.h>
+#include "defs.h"
 #include "pathnames.h"
 
 #include "pathnames.h"
 
-extern int errno;
-
 static int BpfFd = -1;
 static unsigned BpfLen = 0;
 static u_char *BpfPkt = NULL;
 static int BpfFd = -1;
 static unsigned BpfLen = 0;
 static u_char *BpfPkt = NULL;
@@ -55,7 +56,6 @@ static u_char *BpfPkt = NULL;
 **     Side Effects:
 **             If an error is encountered, the program terminates here.
 */
 **     Side Effects:
 **             If an error is encountered, the program terminates here.
 */
-
 int
 BpfOpen()
 {
 int
 BpfOpen()
 {
@@ -190,7 +190,6 @@ BpfOpen()
 **     Side Effects:
 **             None.
 */
 **     Side Effects:
 **             None.
 */
-
 char *
 BpfGetIntfName(errmsg)
        char **errmsg;
 char *
 BpfGetIntfName(errmsg)
        char **errmsg;
@@ -281,7 +280,6 @@ BpfGetIntfName(errmsg)
 **     Side Effects:
 **             None.
 */
 **     Side Effects:
 **             None.
 */
-
 int
 BpfRead(rconn, doread)
        RMPCONN *rconn;
 int
 BpfRead(rconn, doread)
        RMPCONN *rconn;
@@ -348,7 +346,7 @@ BpfRead(rconn, doread)
 **     Side Effects:
 **             None.
 */
 **     Side Effects:
 **             None.
 */
-
+int
 BpfWrite(rconn)
        RMPCONN *rconn;
 {
 BpfWrite(rconn)
        RMPCONN *rconn;
 {
@@ -361,7 +359,7 @@ BpfWrite(rconn)
 }
 
 /*
 }
 
 /*
-**  BpfOpen -- Close a BPF device.
+**  BpfClose -- Close a BPF device.
 **
 **     Parameters:
 **             None.
 **
 **     Parameters:
 **             None.
@@ -372,7 +370,7 @@ BpfWrite(rconn)
 **     Side Effects:
 **             None.
 */
 **     Side Effects:
 **             None.
 */
-
+void
 BpfClose()
 {
        struct ifreq ifr;
 BpfClose()
 {
        struct ifreq ifr;
index cb3a563..4b0d9f1 100644 (file)
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)conf.c      5.1 (Berkeley) %G%
+ *     @(#)conf.c      5.2 (Berkeley) %G%
  *
  * Utah $Hdr: conf.c 3.1 92/07/06$
  * Author: Jeff Forys, University of Utah CSS
  */
 
 #ifndef lint
  *
  * Utah $Hdr: conf.c 3.1 92/07/06$
  * Author: Jeff Forys, University of Utah CSS
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)conf.c     5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c     5.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
+#include <sys/param.h>
+#include <sys/time.h>
+
+#include <stdio.h>
 #include "defs.h"
 #include "pathnames.h"
 
 #include "defs.h"
 #include "pathnames.h"
 
index 912a97b..52e5900 100644 (file)
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)defs.h      5.1 (Berkeley) %G%
+ *     @(#)defs.h      5.2 (Berkeley) %G%
  *
  * Utah $Hdr: defs.h 3.1 92/07/06$
  * Author: Jeff Forys, University of Utah CSS
  */
 
  *
  * Utah $Hdr: defs.h 3.1 92/07/06$
  * Author: Jeff Forys, University of Utah CSS
  */
 
-#include <stdio.h>
-#include <signal.h>
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-
 #include "rmp.h"
 #include "rmp_var.h"
 
 #include "rmp.h"
 #include "rmp_var.h"
 
@@ -73,8 +65,8 @@
 /*
  *  These need not be functions, so...
  */
 /*
  *  These need not be functions, so...
  */
-#define        FreeStr(str)    free((char *) str)
-#define        FreeClient(cli) free((char *) cli)
+#define        FreeStr(str)    free(str)
+#define        FreeClient(cli) free(cli)
 #define        GenSessID()     (++SessionID ? SessionID: ++SessionID)
 
 /*
 #define        GenSessID()     (++SessionID ? SessionID: ++SessionID)
 
 /*
@@ -82,7 +74,6 @@
  *  Using `rmp.hp_hdr.saddr' works because this field is *never* changed;
  *  it will *always* contain the source address of the packet.
  */
  *  Using `rmp.hp_hdr.saddr' works because this field is *never* changed;
  *  it will *always* contain the source address of the packet.
  */
-extern char *GetEtherAddr();
 #define        EnetStr(rptr)   GetEtherAddr(&(rptr)->rmp.hp_hdr.saddr[0])
 
 /*
 #define        EnetStr(rptr)   GetEtherAddr(&(rptr)->rmp.hp_hdr.saddr[0])
 
 /*
@@ -133,9 +124,36 @@ extern     RMPCONN *RmpConns;              /* list of active connections */
 
 extern char    RmpMcastAddr[];         /* RMP multicast address */
 
 
 extern char    RmpMcastAddr[];         /* RMP multicast address */
 
-/*
- * Some common routines that generally cause lint to complain.
- */
-#if defined(lint) && !defined(BSD4_4)
-extern char    *malloc();
-#endif
+void    AddConn __P((RMPCONN *));
+int     BootDone __P((RMPCONN *));
+void    BpfClose __P((void));
+char   *BpfGetIntfName __P((char **));
+int     BpfOpen __P((void));
+int     BpfRead __P((RMPCONN *, int));
+int     BpfWrite __P((RMPCONN *));
+void    DebugOff __P((int));
+void    DebugOn __P((int));
+void    DispPkt __P((RMPCONN *, int));
+void    DoTimeout __P((void));
+void    DspFlnm __P((u_int, char *));
+void    Exit __P((int));
+CLIENT *FindClient __P((RMPCONN *));
+RMPCONN        *FindConn __P((RMPCONN *));
+void    FreeClients __P((void));
+void    FreeConn __P((RMPCONN *));
+void    FreeConns __P((void));
+int     GetBootFiles __P((void));
+char   *GetEtherAddr __P((u_char *));
+CLIENT *NewClient __P((u_char *));
+RMPCONN        *NewConn __P((RMPCONN *));
+char   *NewStr __P((char *));
+u_char *ParseAddr __P((char *));
+int     ParseConfig __P((void));
+void    ProcessPacket __P((RMPCONN *, CLIENT *));
+void    ReConfig __P((int));
+void    RemoveConn __P((RMPCONN *));
+int     SendBootRepl __P((struct rmp_packet *, RMPCONN *, char *[]));
+int     SendFileNo __P((struct rmp_packet *, RMPCONN *, char *[]));
+int     SendPacket __P((RMPCONN *));
+int     SendReadRepl __P((RMPCONN *));
+int     SendServerID __P((RMPCONN *));
index 24d06b8..1d83545 100644 (file)
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)parseconf.c 5.1 (Berkeley) %G%
+ *     @(#)parseconf.c 5.2 (Berkeley) %G%
  *
  * Utah $Hdr: parseconf.c 3.1 92/07/06$
  * Author: Jeff Forys, University of Utah CSS
  */
 
 #ifndef lint
  *
  * Utah $Hdr: parseconf.c 3.1 92/07/06$
  * Author: Jeff Forys, University of Utah CSS
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)parseconf.c        5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)parseconf.c        5.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "defs.h"
-
+#include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
-#include <sys/dir.h>
-#include <sys/file.h>
 
 
-#include <syslog.h>
-#include <strings.h>
 #include <ctype.h>
 #include <ctype.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include "defs.h"
 
 /*
 **  ParseConfig -- parse the config file into linked list of clients.
 
 /*
 **  ParseConfig -- parse the config file into linked list of clients.
@@ -48,14 +51,13 @@ static char sccsid[] = "@(#)parseconf.c     5.1 (Berkeley) %G%";
 **             - GetBootFiles() must be called before this routine
 **               to create a linked list of default boot files.
 */
 **             - GetBootFiles() must be called before this routine
 **               to create a linked list of default boot files.
 */
-
 int
 ParseConfig()
 {
        FILE *fp;
 int
 ParseConfig()
 {
        FILE *fp;
-       CLIENT *client, *NewClient();
-       u_char *addr, *ParseAddr();
-       char *NewStr(), line[C_LINELEN];
+       CLIENT *client;
+       u_char *addr;
+       char line[C_LINELEN];
        register char *cp, *bcp;
        register int i, j;
        int omask, linecnt = 0;
        register char *cp, *bcp;
        register int i, j;
        int omask, linecnt = 0;
@@ -215,10 +217,9 @@ ParseConfig()
 **               be copied if it's to be saved.
 **             - For speed, we assume a u_char consists of 8 bits.
 */
 **               be copied if it's to be saved.
 **             - For speed, we assume a u_char consists of 8 bits.
 */
-
 u_char *
 ParseAddr(str)
 u_char *
 ParseAddr(str)
-char *str;
+       char *str;
 {
        static u_char addr[RMP_ADDRLEN];
        register char *cp;
 {
        static u_char addr[RMP_ADDRLEN];
        register char *cp;
@@ -280,15 +281,13 @@ char *str;
 **             - After this routine is called, ParseConfig() must be
 **               called to re-order it's list of boot file pointers.
 */
 **             - After this routine is called, ParseConfig() must be
 **               called to re-order it's list of boot file pointers.
 */
-
 int
 GetBootFiles()
 {
        DIR *dfd;
        struct stat statb;
 int
 GetBootFiles()
 {
        DIR *dfd;
        struct stat statb;
-       register struct direct *dp;
+       register struct dirent *dp;
        register int i;
        register int i;
-       char *NewStr();
 
        /*
         *  Free the current list of boot files.
 
        /*
         *  Free the current list of boot files.
index 9a64d97..d9a5149 100644 (file)
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)rbootd.c    5.1 (Berkeley) %G%
+ *     @(#)rbootd.c    5.2 (Berkeley) %G%
  *
  * Utah $Hdr: rbootd.c 3.1 92/07/06$
  * Author: Jeff Forys, University of Utah CSS
  */
 
 #ifndef lint
  *
  * Utah $Hdr: rbootd.c 3.1 92/07/06$
  * Author: Jeff Forys, University of Utah CSS
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)rbootd.c   5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)rbootd.c   5.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "defs.h"
-
+#include <sys/param.h>
 #include <sys/ioctl.h>
 #include <sys/ioctl.h>
-#include <sys/file.h>
 
 
-#include <errno.h>
 #include <ctype.h>
 #include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <syslog.h>
 #include <syslog.h>
-#include <strings.h>
+#include <unistd.h>
+#include "defs.h"
+
 
 /* fd mask macros (backward compatibility with 4.2BSD) */
 #ifndef        FD_SET
 
 /* fd mask macros (backward compatibility with 4.2BSD) */
 #ifndef        FD_SET
@@ -45,18 +50,13 @@ typedef     struct fd_set {         /* this should already be in 4.2 */
 #define        FD_ISSET(n, p)  ((p)->fds_bits[0] & (1 << (n)))
 #endif
 
 #define        FD_ISSET(n, p)  ((p)->fds_bits[0] & (1 << (n)))
 #endif
 
-extern int errno;
-
+int
 main(argc, argv)
 main(argc, argv)
-int argc;
-char *argv[];
+       int argc;
+       char *argv[];
 {
 {
-       int Exit(), ReConfig(), DebugOn(), DebugOff();
-       int GetBootFiles(), ParseConfig();
        int c, fd, omask, maxfds;
        fd_set rset;
        int c, fd, omask, maxfds;
        fd_set rset;
-       extern int optind;
-       extern char *optarg;
 
        /*
         *  Find what name we are running under.
 
        /*
         *  Find what name we are running under.
@@ -171,7 +171,7 @@ char *argv[];
         *  (in `errmsg') which will be displayed here.
         */
        if (IntfName == NULL) {
         *  (in `errmsg') which will be displayed here.
         */
        if (IntfName == NULL) {
-               char *errmsg, *BpfGetIntfName();
+               char *errmsg;
 
                if ((IntfName = BpfGetIntfName(&errmsg)) == NULL) {
                        syslog(LOG_NOTICE, "restarted (??)");
 
                if ((IntfName = BpfGetIntfName(&errmsg)) == NULL) {
                        syslog(LOG_NOTICE, "restarted (??)");
@@ -322,7 +322,7 @@ char *argv[];
 **     Side Effects:
 **             - Timed out connections in `RmpConns' will be freed.
 */
 **     Side Effects:
 **             - Timed out connections in `RmpConns' will be freed.
 */
-
+void
 DoTimeout()
 {
        register RMPCONN *rtmp;
 DoTimeout()
 {
        register RMPCONN *rtmp;
@@ -361,7 +361,7 @@ DoTimeout()
 
 CLIENT *
 FindClient(rconn)
 
 CLIENT *
 FindClient(rconn)
-register RMPCONN *rconn;
+       register RMPCONN *rconn;
 {
        register CLIENT *ctmp;
 
 {
        register CLIENT *ctmp;
 
@@ -385,8 +385,7 @@ register RMPCONN *rconn;
 **     Side Effects:
 **             - This process ceases to exist.
 */
 **     Side Effects:
 **             - This process ceases to exist.
 */
-
-int
+void
 Exit(sig)
        int sig;
 {
 Exit(sig)
        int sig;
 {
@@ -415,12 +414,10 @@ Exit(sig)
 **     Warnings:
 **             - This routine must be called with SIGHUP blocked.
 */
 **     Warnings:
 **             - This routine must be called with SIGHUP blocked.
 */
-
-int
-ReConfig()
+void
+ReConfig(signo)
+       int signo;
 {
 {
-       int GetBootFiles(), ParseConfig();
-
        syslog(LOG_NOTICE, "reconfiguring boot server");
 
        FreeConns();
        syslog(LOG_NOTICE, "reconfiguring boot server");
 
        FreeConns();
@@ -444,9 +441,9 @@ ReConfig()
 **     Side Effects:
 **             - Debug file is closed.
 */
 **     Side Effects:
 **             - Debug file is closed.
 */
-
-int
-DebugOff()
+void
+DebugOff(signo)
+       int signo;
 {
        if (DbgFp != NULL)
                (void) fclose(DbgFp);
 {
        if (DbgFp != NULL)
                (void) fclose(DbgFp);
@@ -467,9 +464,9 @@ DebugOff()
 **             - Debug file is opened/truncated if not already opened,
 **               otherwise do nothing.
 */
 **             - Debug file is opened/truncated if not already opened,
 **               otherwise do nothing.
 */
-
-int
-DebugOn()
+void
+DebugOn(signo)
+       int signo;
 {
        if (DbgFp == NULL) {
                if ((DbgFp = fopen(DbgFile, "w")) == NULL)
 {
        if (DbgFp == NULL) {
                if ((DbgFp = fopen(DbgFile, "w")) == NULL)
index dc795b0..3c308a1 100644 (file)
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)rmpproto.c  5.1 (Berkeley) %G%
+ *     @(#)rmpproto.c  5.2 (Berkeley) %G%
  *
  * Utah $Hdr: rmpproto.c 3.1 92/07/06$
  * Author: Jeff Forys, University of Utah CSS
  */
 
 #ifndef lint
  *
  * Utah $Hdr: rmpproto.c 3.1 92/07/06$
  * Author: Jeff Forys, University of Utah CSS
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)rmpproto.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)rmpproto.c 5.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "defs.h"
-
-#include <sys/file.h>
+#include <sys/param.h>
+#include <sys/time.h>
 
 
-#include <strings.h>
-#include <syslog.h>
 #include <errno.h>
 #include <errno.h>
-
-extern int errno;
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <syslog.h>
+#include <unistd.h>
+#include "defs.h"
 
 /*
 **  ProcessPacket -- determine packet type and do what's required.
 
 /*
 **  ProcessPacket -- determine packet type and do what's required.
@@ -54,15 +55,13 @@ extern int errno;
 **             - Also, unless we run out of memory, a reply will be
 **               sent to the host that sent the packet.
 */
 **             - Also, unless we run out of memory, a reply will be
 **               sent to the host that sent the packet.
 */
-
+void
 ProcessPacket(rconn, client)
 ProcessPacket(rconn, client)
-RMPCONN *rconn;
-CLIENT *client;
+       RMPCONN *rconn;
+       CLIENT *client;
 {
 {
-       int SendServerID(), SendFileNo(), SendBootRepl();
-       int SendReadRepl(), BootDone();
-       RMPCONN *rconnout, *NewConn();
        struct rmp_packet *rmp;
        struct rmp_packet *rmp;
+       RMPCONN *rconnout;
 
        rmp = &rconn->rmp;              /* cache pointer to RMP packet */
 
 
        rmp = &rconn->rmp;              /* cache pointer to RMP packet */
 
@@ -146,12 +145,10 @@ CLIENT *client;
 **     Side Effects:
 **             none.
 */
 **     Side Effects:
 **             none.
 */
-
 int
 SendServerID(rconn)
 int
 SendServerID(rconn)
-RMPCONN *rconn;
+       RMPCONN *rconn;
 {
 {
-       int SendPacket();
        register struct rmp_packet *rpl;
        register char *src, *dst;
        register u_char *size;
        register struct rmp_packet *rpl;
        register char *src, *dst;
        register u_char *size;
@@ -200,14 +197,12 @@ RMPCONN *rconn;
 **     Side Effects:
 **             none.
 */
 **     Side Effects:
 **             none.
 */
-
 int
 int
-SendFileNo(req,rconn,filelist)
-struct rmp_packet *req;
-RMPCONN *rconn;
-char *filelist[];
+SendFileNo(req, rconn, filelist)
+       struct rmp_packet *req;
+       RMPCONN *rconn;
+       char *filelist[];
 {
 {
-       int SendPacket();
        register struct rmp_packet *rpl;
        register char *src, *dst;
        register u_char *size, i;
        register struct rmp_packet *rpl;
        register char *src, *dst;
        register u_char *size, i;
@@ -264,15 +259,15 @@ char *filelist[];
 **     Side Effects:
 **             none.
 */
 **     Side Effects:
 **             none.
 */
-
-SendBootRepl(req,rconn,filelist)
-struct rmp_packet *req;
-RMPCONN *rconn;
-char *filelist[];
+int
+SendBootRepl(req, rconn, filelist)
+       struct rmp_packet *req;
+       RMPCONN *rconn;
+       char *filelist[];
 {
 {
-       int retval, SendPacket();
+       int retval;
        char *filename, filepath[RMPBOOTDATA+1];
        char *filename, filepath[RMPBOOTDATA+1];
-       RMPCONN *oldconn, *FindConn();
+       RMPCONN *oldconn;
        register struct rmp_packet *rpl;
        register char *src, *dst1, *dst2;
        register u_char i;
        register struct rmp_packet *rpl;
        register char *src, *dst1, *dst2;
        register u_char i;
@@ -373,14 +368,12 @@ sendpkt:
 **     Side Effects:
 **             none.
 */
 **     Side Effects:
 **             none.
 */
-
 int
 SendReadRepl(rconn)
 int
 SendReadRepl(rconn)
-RMPCONN *rconn;
+       RMPCONN *rconn;
 {
 {
-       off_t lseek();
-       int retval, SendPacket();
-       RMPCONN *oldconn, *FindConn(), *NewConn();
+       int retval;
+       RMPCONN *oldconn;
        register struct rmp_packet *rpl, *req;
        register int size = 0;
        int madeconn = 0;
        register struct rmp_packet *rpl, *req;
        register int size = 0;
        int madeconn = 0;
@@ -493,12 +486,11 @@ sendpkt:
 **     Side Effects:
 **             none.
 */
 **     Side Effects:
 **             none.
 */
-
 int
 BootDone(rconn)
 int
 BootDone(rconn)
-RMPCONN *rconn;
+       RMPCONN *rconn;
 {
 {
-       RMPCONN *oldconn, *FindConn();
+       RMPCONN *oldconn;
        struct rmp_packet *rpl;
 
        /*
        struct rmp_packet *rpl;
 
        /*
@@ -542,10 +534,9 @@ RMPCONN *rconn;
 **     Side Effects:
 **             none.
 */
 **     Side Effects:
 **             none.
 */
-
 int
 SendPacket(rconn)
 int
 SendPacket(rconn)
-register RMPCONN *rconn;
+       register RMPCONN *rconn;
 {
        /*
         *  Set Ethernet Destination address to Source (BPF and the enet
 {
        /*
         *  Set Ethernet Destination address to Source (BPF and the enet
index fcb9015..85619a8 100644 (file)
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)utils.c     5.1 (Berkeley) %G%
+ *     @(#)utils.c     5.2 (Berkeley) %G%
  *
  * Utah $Hdr: utils.c 3.1 92/07/06$
  * Author: Jeff Forys, University of Utah CSS
  */
 
 #ifndef lint
  *
  * Utah $Hdr: utils.c 3.1 92/07/06$
  * Author: Jeff Forys, University of Utah CSS
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)utils.c    5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)utils.c    5.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "defs.h"
-
-#include <sys/file.h>
+#include <sys/param.h>
 
 
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <syslog.h>
 #include <syslog.h>
-#include <strings.h>
-
+#include <time.h>
+#include <unistd.h>
+#include "defs.h"
 
 /*
 **  DispPkt -- Display the contents of an RMPCONN packet.
 
 /*
 **  DispPkt -- Display the contents of an RMPCONN packet.
@@ -43,10 +47,10 @@ static char sccsid[] = "@(#)utils.c 5.1 (Berkeley) %G%";
 **     Side Effects:
 **             None.
 */
 **     Side Effects:
 **             None.
 */
-
+void
 DispPkt(rconn, direct)
 DispPkt(rconn, direct)
-RMPCONN *rconn;
-int direct;
+       RMPCONN *rconn;
+       int direct;
 {
        static char BootFmt[] = "\t\tRetCode:%u SeqNo:%lx SessID:%x Vers:%u";
        static char ReadFmt[] = "\t\tRetCode:%u Offset:%lx SessID:%x\n";
 {
        static char BootFmt[] = "\t\tRetCode:%u SeqNo:%lx SessID:%x Vers:%u";
        static char ReadFmt[] = "\t\tRetCode:%u Offset:%lx SessID:%x\n";
@@ -173,10 +177,9 @@ int direct;
 **               be copied if it's to be saved.
 **             - For speed, we assume a u_char consists of 8 bits.
 */
 **               be copied if it's to be saved.
 **             - For speed, we assume a u_char consists of 8 bits.
 */
-
 char *
 GetEtherAddr(addr)
 char *
 GetEtherAddr(addr)
-u_char *addr;
+       u_char *addr;
 {
        static char Hex[] = "0123456789abcdef";
        static char etherstr[RMP_ADDRLEN*3];
 {
        static char Hex[] = "0123456789abcdef";
        static char etherstr[RMP_ADDRLEN*3];
@@ -216,10 +219,10 @@ u_char *addr;
 **     Side Effects:
 **             - Characters are sent to `DbgFp'.
 */
 **     Side Effects:
 **             - Characters are sent to `DbgFp'.
 */
-
+void
 DspFlnm(size, flnm)
 DspFlnm(size, flnm)
-register u_char size;
-register char *flnm;
+       register u_int size;
+       register char *flnm;
 {
        register int i;
 
 {
        register int i;
 
@@ -243,10 +246,9 @@ register char *flnm;
 **             - Memory will be malloc'd for the new CLIENT.
 **             - If malloc() fails, a log message will be generated.
 */
 **             - Memory will be malloc'd for the new CLIENT.
 **             - If malloc() fails, a log message will be generated.
 */
-
 CLIENT *
 NewClient(addr)
 CLIENT *
 NewClient(addr)
-u_char *addr;
+       u_char *addr;
 {
        CLIENT *ctmp;
 
 {
        CLIENT *ctmp;
 
@@ -256,8 +258,8 @@ u_char *addr;
                return(NULL);
        }
 
                return(NULL);
        }
 
-       bzero((char *)ctmp, sizeof(CLIENT));
-       bcopy((char *)addr, (char *)&ctmp->addr[0], RMP_ADDRLEN);
+       bzero(ctmp, sizeof(CLIENT));
+       bcopy(addr, &ctmp->addr[0], RMP_ADDRLEN);
        return(ctmp);
 }
 
        return(ctmp);
 }
 
@@ -277,7 +279,7 @@ u_char *addr;
 **     Warnings:
 **             - This routine must be called with SIGHUP blocked.
 */
 **     Warnings:
 **             - This routine must be called with SIGHUP blocked.
 */
-
+void
 FreeClients()
 {
        register CLIENT *ctmp;
 FreeClients()
 {
        register CLIENT *ctmp;
@@ -302,10 +304,9 @@ FreeClients()
 **             - Memory will be malloc'd for the new character array.
 **             - If malloc() fails, a log message will be generated.
 */
 **             - Memory will be malloc'd for the new character array.
 **             - If malloc() fails, a log message will be generated.
 */
-
 char *
 NewStr(str)
 char *
 NewStr(str)
-char *str;
+       char *str;
 {
        char *stmp;
 
 {
        char *stmp;
 
@@ -338,10 +339,9 @@ static RMPCONN *LastFree = NULL;
 **             - Memory may be malloc'd for the new RMPCONN (if not cached).
 **             - If malloc() fails, a log message will be generated.
 */
 **             - Memory may be malloc'd for the new RMPCONN (if not cached).
 **             - If malloc() fails, a log message will be generated.
 */
-
 RMPCONN *
 NewConn(rconn)
 RMPCONN *
 NewConn(rconn)
-RMPCONN *rconn;
+       RMPCONN *rconn;
 {
        RMPCONN *rtmp;
 
 {
        RMPCONN *rtmp;
 
@@ -380,9 +380,9 @@ RMPCONN *rconn;
 **             - Memory associated with `rtmp' may be free'd (or cached).
 **             - File desc associated with `rtmp->bootfd' will be closed.
 */
 **             - Memory associated with `rtmp' may be free'd (or cached).
 **             - File desc associated with `rtmp->bootfd' will be closed.
 */
-
+void
 FreeConn(rtmp)
 FreeConn(rtmp)
-register RMPCONN *rtmp;
+       register RMPCONN *rtmp;
 {
        /*
         *  If the file descriptor is in use, close the file.
 {
        /*
         *  If the file descriptor is in use, close the file.
@@ -415,7 +415,7 @@ register RMPCONN *rtmp;
 **     Warnings:
 **             - This routine must be called with SIGHUP blocked.
 */
 **     Warnings:
 **             - This routine must be called with SIGHUP blocked.
 */
-
+void
 FreeConns()
 {
        register RMPCONN *rtmp;
 FreeConns()
 {
        register RMPCONN *rtmp;
@@ -447,9 +447,9 @@ FreeConns()
 **     Warnings:
 **             - This routine must be called with SIGHUP blocked.
 */
 **     Warnings:
 **             - This routine must be called with SIGHUP blocked.
 */
-
+void
 AddConn(rconn)
 AddConn(rconn)
-register RMPCONN *rconn;
+       register RMPCONN *rconn;
 {
        if (RmpConns != NULL)
                rconn->next = RmpConns;
 {
        if (RmpConns != NULL)
                rconn->next = RmpConns;
@@ -475,10 +475,9 @@ register RMPCONN *rconn;
 **     Warnings:
 **             - This routine must be called with SIGHUP blocked.
 */
 **     Warnings:
 **             - This routine must be called with SIGHUP blocked.
 */
-
 RMPCONN *
 FindConn(rconn)
 RMPCONN *
 FindConn(rconn)
-register RMPCONN *rconn;
+       register RMPCONN *rconn;
 {
        register RMPCONN *rtmp;
 
 {
        register RMPCONN *rtmp;
 
@@ -506,9 +505,9 @@ register RMPCONN *rconn;
 **     Warnings:
 **             - This routine must be called with SIGHUP blocked.
 */
 **     Warnings:
 **             - This routine must be called with SIGHUP blocked.
 */
-
+void
 RemoveConn(rconn)
 RemoveConn(rconn)
-register RMPCONN *rconn;
+       register RMPCONN *rconn;
 {
        register RMPCONN *thisrconn, *lastrconn;
 
 {
        register RMPCONN *thisrconn, *lastrconn;