Merge conflicts and make this compile -Wall clean.

This commit is contained in:
Steve Price 1997-06-29 19:00:29 +00:00
parent 6bc912a9a4
commit 5c8709fd6d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=27077
12 changed files with 45 additions and 131 deletions

View File

@ -1,13 +1,8 @@
# @(#)Makefile 8.1 (Berkeley) 6/4/93 # from: @(#)Makefile 8.1 (Berkeley) 6/4/93
# $Id$ # $Id: Makefile,v 1.7 1997/02/22 14:21:57 peter Exp $
PROG= rbootd PROG= rbootd
SRCS= bpf.c conf.c parseconf.c rbootd.c rmpproto.c utils.c SRCS= bpf.c conf.c parseconf.c rbootd.c rmpproto.c utils.c
MAN8= rbootd.8 MAN8= rbootd.8
# XXX BROKEN: afterinstall:
XXXafterinstall:
(cd ${.CURDIR}/bootdir && ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} \
-m 444 * ${DESTDIR}/usr/mdec/)
.include <bsd.prog.mk> .include <bsd.prog.mk>

View File

@ -38,15 +38,15 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)bpf.c 8.1 (Berkeley) 6/4/93 * from: @(#)bpf.c 8.1 (Berkeley) 6/4/93
* $Id$ * $Id: bpf.c,v 1.6 1997/02/22 14:21:57 peter Exp $
* *
* Utah $Hdr: bpf.c 3.1 92/07/06$ * From: Utah Hdr: bpf.c 3.1 92/07/06
* Author: Jeff Forys, University of Utah CSS * Author: Jeff Forys, University of Utah CSS
*/ */
#ifndef lint #ifndef lint
static char sccsid[] = "@(#)bpf.c 8.1 (Berkeley) 6/4/93"; static const char sccsid[] = "@(#)bpf.c 8.1 (Berkeley) 6/4/93";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -70,7 +70,7 @@ static char sccsid[] = "@(#)bpf.c 8.1 (Berkeley) 6/4/93";
static int BpfFd = -1; static int BpfFd = -1;
static unsigned BpfLen = 0; static unsigned BpfLen = 0;
static u_char *BpfPkt = NULL; static u_int8_t *BpfPkt = NULL;
/* /*
** BpfOpen -- Open and initialize a BPF device. ** BpfOpen -- Open and initialize a BPF device.
@ -147,14 +147,9 @@ BpfOpen()
#endif #endif
ifr.ifr_addr.sa_family = AF_UNSPEC; ifr.ifr_addr.sa_family = AF_UNSPEC;
bcopy(&RmpMcastAddr[0], (char *)&ifr.ifr_addr.sa_data[0], RMP_ADDRLEN); bcopy(&RmpMcastAddr[0], (char *)&ifr.ifr_addr.sa_data[0], RMP_ADDRLEN);
if (ioctl(BpfFd, SIOCADDMULTI, (caddr_t)&ifr) < 0) { if (ioctl(BpfFd, BIOCPROMISC, (caddr_t)0) < 0) {
syslog(LOG_WARNING, syslog(LOG_ERR, "bpf: can't set promiscuous mode: %m");
"bpf: can't add mcast addr (%m), setting promiscuous mode"); Exit(0);
if (ioctl(BpfFd, BIOCPROMISC, (caddr_t)0) < 0) {
syslog(LOG_ERR, "bpf: can't set promiscuous mode: %m");
Exit(0);
}
} }
/* /*
@ -165,7 +160,7 @@ BpfOpen()
Exit(0); Exit(0);
} }
if (BpfPkt == NULL) if (BpfPkt == NULL)
BpfPkt = (u_char *)malloc(BpfLen); BpfPkt = (u_int8_t *)malloc(BpfLen);
if (BpfPkt == NULL) { if (BpfPkt == NULL) {
syslog(LOG_ERR, "bpf: out of memory (%u bytes for bpfpkt)", syslog(LOG_ERR, "bpf: out of memory (%u bytes for bpfpkt)",
@ -314,7 +309,7 @@ BpfRead(rconn, doread)
int doread; int doread;
{ {
register int datlen, caplen, hdrlen; register int datlen, caplen, hdrlen;
static u_char *bp = NULL, *ep = NULL; static u_int8_t *bp = NULL, *ep = NULL;
int cc; int cc;
/* /*

View File

@ -1,5 +1,3 @@
/* $NetBSD: conf.c,v 1.5 1995/10/06 05:12:13 thorpej Exp $ */
/* /*
* Copyright (c) 1988, 1992 The University of Utah and the Center * Copyright (c) 1988, 1992 The University of Utah and the Center
* for Software Science (CSS). * for Software Science (CSS).
@ -41,14 +39,14 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)conf.c 8.1 (Berkeley) 6/4/93 * from: @(#)conf.c 8.1 (Berkeley) 6/4/93
* $Id$
* *
* From: Utah Hdr: conf.c 3.1 92/07/06 * From: Utah Hdr: conf.c 3.1 92/07/06
* Author: Jeff Forys, University of Utah CSS * Author: Jeff Forys, University of Utah CSS
*/ */
#ifndef lint #ifndef lint
/*static char sccsid[] = "@(#)conf.c 8.1 (Berkeley) 6/4/93";*/ static const char sccsid[] = "@(#)conf.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "$NetBSD: conf.c,v 1.5 1995/10/06 05:12:13 thorpej Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>

View File

@ -1,5 +1,3 @@
/* $NetBSD: defs.h,v 1.5 1995/10/06 05:12:14 thorpej Exp $ */
/* /*
* Copyright (c) 1988, 1992 The University of Utah and the Center * Copyright (c) 1988, 1992 The University of Utah and the Center
* for Software Science (CSS). * for Software Science (CSS).

View File

@ -38,15 +38,15 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)parseconf.c 8.1 (Berkeley) 6/4/93 * from: @(#)parseconf.c 8.1 (Berkeley) 6/4/93
* $Id$ * $Id: parseconf.c,v 1.5 1997/02/22 14:21:57 peter Exp $
* *
* Utah $Hdr: parseconf.c 3.1 92/07/06$ * From: Utah Hdr: parseconf.c 3.1 92/07/06
* Author: Jeff Forys, University of Utah CSS * Author: Jeff Forys, University of Utah CSS
*/ */
#ifndef lint #ifndef lint
static char sccsid[] = "@(#)parseconf.c 8.1 (Berkeley) 6/4/93"; static const char sccsid[] = "@(#)parseconf.c 8.1 (Berkeley) 6/4/93";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -83,7 +83,7 @@ ParseConfig()
{ {
FILE *fp; FILE *fp;
CLIENT *client; CLIENT *client;
u_char *addr; u_int8_t *addr;
char line[C_LINELEN]; char line[C_LINELEN];
register char *cp, *bcp; register char *cp, *bcp;
register int i, j; register int i, j;
@ -242,13 +242,12 @@ ParseConfig()
** Warnings: ** Warnings:
** - The return value points to a static buffer; it must ** - The return value points to a static buffer; it must
** be copied if it's to be saved. ** be copied if it's to be saved.
** - For speed, we assume a u_char consists of 8 bits.
*/ */
u_char * u_int8_t *
ParseAddr(str) ParseAddr(str)
char *str; char *str;
{ {
static u_char addr[RMP_ADDRLEN]; static u_int8_t addr[RMP_ADDRLEN];
register char *cp; register char *cp;
register unsigned i; register unsigned i;
register int part, subpart; register int part, subpart;

View File

@ -1,5 +1,3 @@
/* $NetBSD: pathnames.h,v 1.3 1995/08/21 17:05:15 thorpej Exp $ */
/* /*
* Copyright (c) 1988, 1992 The University of Utah and the Center * Copyright (c) 1988, 1992 The University of Utah and the Center
* for Software Science (CSS). * for Software Science (CSS).

View File

@ -37,10 +37,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" @(#)rbootd.8 8.2 (Berkeley) 12/11/93 .\" from: @(#)rbootd.8 8.2 (Berkeley) 12/11/93
.\" $Id: rbootd.8,v 1.5 1997/02/22 14:21:58 peter Exp $ .\" $Id: rbootd.8,v 1.6 1997/06/23 04:02:13 steve Exp $
.\" .\"
.\" Utah $Hdr: rbootd.man 3.1 92/07/06$ .\" Utah Hdr: rbootd.man 3.1 92/07/06
.\" Author: Jeff Forys, University of Utah CSS .\" Author: Jeff Forys, University of Utah CSS
.\" .\"
.Dd December 11, 1993 .Dd December 11, 1993

View File

@ -38,28 +38,27 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)rbootd.c 8.2 (Berkeley) 2/22/94 * from: @(#)rbootd.c 8.1 (Berkeley) 6/4/93
* $Id: rbootd.c,v 1.5 1997/02/22 14:21:58 peter Exp $ * $Id: rbootd.c,v 1.6 1997/03/28 15:48:14 imp Exp $
* *
* Utah $Hdr: rbootd.c 3.1 92/07/06$ * From: Utah Hdr: rbootd.c 3.1 92/07/06
* Author: Jeff Forys, University of Utah CSS * Author: Jeff Forys, University of Utah CSS
*/ */
#ifndef lint #ifndef lint
static char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1992, 1993\n\ "@(#) Copyright (c) 1992, 1993\n\
The Regents of the University of California. All rights reserved.\n"; The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#ifndef lint #ifndef lint
static char sccsid[] = "@(#)rbootd.c 8.2 (Berkeley) 2/22/94"; static const char sccsid[] = "@(#)rbootd.c 8.1 (Berkeley) 6/4/93";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/time.h> #include <sys/time.h>
#include <ctype.h> #include <ctype.h>
#include <err.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <signal.h> #include <signal.h>
@ -70,19 +69,7 @@ static char sccsid[] = "@(#)rbootd.c 8.2 (Berkeley) 2/22/94";
#include <unistd.h> #include <unistd.h>
#include "defs.h" #include "defs.h"
extern char *__progname; /* from crt0.o */
/* fd mask macros (backward compatibility with 4.2BSD) */
#ifndef FD_SET
#ifdef notdef
typedef struct fd_set { /* this should already be in 4.2 */
int fds_bits[1];
} fd_set;
#endif
#define FD_ZERO(p) ((p)->fds_bits[0] = 0)
#define FD_SET(n, p) ((p)->fds_bits[0] |= (1 << (n)))
#define FD_CLR(n, p) ((p)->fds_bits[0] &= ~(1 << (n)))
#define FD_ISSET(n, p) ((p)->fds_bits[0] & (1 << (n)))
#endif
int int
main(argc, argv) main(argc, argv)
@ -92,11 +79,6 @@ main(argc, argv)
int c, fd, omask, maxfds; int c, fd, omask, maxfds;
fd_set rset; fd_set rset;
/*
* Find what name we are running under.
*/
ProgName = (ProgName = rindex(argv[0],'/')) ? ++ProgName : *argv;
/* /*
* Close any open file descriptors. * Close any open file descriptors.
* Temporarily leave stdin & stdout open for `-d', * Temporarily leave stdin & stdout open for `-d',
@ -130,9 +112,8 @@ main(argc, argv)
if (ConfigFile == NULL) if (ConfigFile == NULL)
ConfigFile = argv[optind]; ConfigFile = argv[optind];
else { else {
fprintf(stderr, warnx("too many config files (`%s' ignored)\n",
"%s: too many config files (`%s' ignored)\n", argv[optind]);
ProgName, argv[optind]);
} }
} }
@ -144,57 +125,16 @@ main(argc, argv)
(void) signal(SIGUSR1, SIG_IGN); /* dont muck w/DbgFp */ (void) signal(SIGUSR1, SIG_IGN); /* dont muck w/DbgFp */
(void) signal(SIGUSR2, SIG_IGN); (void) signal(SIGUSR2, SIG_IGN);
(void) fclose(stderr); /* finished with it */
} else { } else {
(void) fclose(stdin); /* dont need these */ if (daemon(0, 0))
(void) fclose(stdout); err(1, "can't detach from terminal");
/*
* Fork off a child to do the work & exit.
*/
switch(fork()) {
case -1: /* fork failed */
fprintf(stderr, "%s: ", ProgName);
perror("fork");
Exit(0);
case 0: /* this is the CHILD */
break;
default: /* this is the PARENT */
_exit(0);
}
/*
* Try to disassociate from the current tty.
*/
{
char *devtty = "/dev/tty";
int i;
if ((i = open(devtty, O_RDWR)) < 0) {
/* probably already disassociated */
if (setpgrp(0, 0) < 0) {
fprintf(stderr, "%s: ", ProgName);
perror("setpgrp");
}
} else {
if (ioctl(i, (u_long)TIOCNOTTY, (char *)0) < 0){
fprintf(stderr, "%s: ", ProgName);
perror("ioctl");
}
(void) close(i);
}
}
(void) signal(SIGUSR1, DebugOn); (void) signal(SIGUSR1, DebugOn);
(void) signal(SIGUSR2, DebugOff); (void) signal(SIGUSR2, DebugOff);
} }
(void) fclose(stderr); /* finished with it */ openlog(__progname, LOG_PID, LOG_DAEMON);
#ifdef SYSLOG4_2
openlog(ProgName, LOG_PID);
#else
openlog(ProgName, LOG_PID, LOG_DAEMON);
#endif
/* /*
* If no interface was specified, get one now. * If no interface was specified, get one now.
@ -238,7 +178,7 @@ main(argc, argv)
FILE *fp; FILE *fp;
if ((fp = fopen(PidFile, "w")) != NULL) { if ((fp = fopen(PidFile, "w")) != NULL) {
(void) fprintf(fp, "%d\n", MyPid); (void) fprintf(fp, "%d\n", (int) MyPid);
(void) fclose(fp); (void) fclose(fp);
} else { } else {
syslog(LOG_WARNING, "fopen: failed (%s)", PidFile); syslog(LOG_WARNING, "fopen: failed (%s)", PidFile);
@ -287,13 +227,11 @@ main(argc, argv)
r = rset; r = rset;
if (RmpConns == NULL) { /* timeout isnt necessary */ if (RmpConns == NULL) { /* timeout isnt necessary */
nsel = select(maxfds, &r, (fd_set *)0, (fd_set *)0, nsel = select(maxfds, &r, NULL, NULL, NULL);
(struct timeval *)0);
} else { } else {
timeout.tv_sec = RMP_TIMEOUT; timeout.tv_sec = RMP_TIMEOUT;
timeout.tv_usec = 0; timeout.tv_usec = 0;
nsel = select(maxfds, &r, (fd_set *)0, (fd_set *)0, nsel = select(maxfds, &r, NULL, NULL, &timeout);
&timeout);
} }
if (nsel < 0) { if (nsel < 0) {

View File

@ -1,5 +1,3 @@
/* $NetBSD: rmp.h,v 1.4 1995/10/06 05:12:18 thorpej Exp $ */
/* /*
* Copyright (c) 1988, 1992 The University of Utah and the Center * Copyright (c) 1988, 1992 The University of Utah and the Center
* for Software Science (CSS). * for Software Science (CSS).

View File

@ -1,5 +1,3 @@
/* $NetBSD: rmp_var.h,v 1.8 1995/11/14 08:41:44 thorpej Exp $ */
/* /*
* Copyright (c) 1988, 1992 The University of Utah and the Center * Copyright (c) 1988, 1992 The University of Utah and the Center
* for Software Science (CSS). * for Software Science (CSS).

View File

@ -1,5 +1,3 @@
/* $NetBSD: rmpproto.c,v 1.7 1996/02/01 21:27:46 mycroft Exp $ */
/* /*
* Copyright (c) 1988, 1992 The University of Utah and the Center * Copyright (c) 1988, 1992 The University of Utah and the Center
* for Software Science (CSS). * for Software Science (CSS).
@ -41,14 +39,14 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)rmpproto.c 8.1 (Berkeley) 6/4/93 * from: @(#)rmpproto.c 8.1 (Berkeley) 6/4/93
* $Id$
* *
* From: Utah Hdr: rmpproto.c 3.1 92/07/06 * From: Utah Hdr: rmpproto.c 3.1 92/07/06
* Author: Jeff Forys, University of Utah CSS * Author: Jeff Forys, University of Utah CSS
*/ */
#ifndef lint #ifndef lint
/*static char sccsid[] = "@(#)rmpproto.c 8.1 (Berkeley) 6/4/93";*/ static const char sccsid[] = "@(#)rmpproto.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "$NetBSD: rmpproto.c,v 1.7 1996/02/01 21:27:46 mycroft Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>

View File

@ -1,5 +1,3 @@
/* $NetBSD: utils.c,v 1.6 1995/11/14 08:41:47 thorpej Exp $ */
/* /*
* Copyright (c) 1988, 1992 The University of Utah and the Center * Copyright (c) 1988, 1992 The University of Utah and the Center
* for Software Science (CSS). * for Software Science (CSS).
@ -41,17 +39,18 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)utils.c 8.1 (Berkeley) 6/4/93 * from: @(#)utils.c 8.1 (Berkeley) 6/4/93
* $Id$
* *
* From: Utah Hdr: utils.c 3.1 92/07/06 * From: Utah Hdr: utils.c 3.1 92/07/06
* Author: Jeff Forys, University of Utah CSS * Author: Jeff Forys, University of Utah CSS
*/ */
#ifndef lint #ifndef lint
/*static char sccsid[] = "@(#)utils.c 8.1 (Berkeley) 6/4/93";*/ static const char sccsid[] = "@(#)utils.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "$NetBSD: utils.c,v 1.6 1995/11/14 08:41:47 thorpej Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
#include <sys/time.h>
#include <fcntl.h> #include <fcntl.h>
#include <signal.h> #include <signal.h>