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
# $Id$
# from: @(#)Makefile 8.1 (Berkeley) 6/4/93
# $Id: Makefile,v 1.7 1997/02/22 14:21:57 peter Exp $
PROG= rbootd
SRCS= bpf.c conf.c parseconf.c rbootd.c rmpproto.c utils.c
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>

View File

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

View File

@ -38,15 +38,15 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)parseconf.c 8.1 (Berkeley) 6/4/93
* $Id$
* from: @(#)parseconf.c 8.1 (Berkeley) 6/4/93
* $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
*/
#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 */
#include <sys/param.h>
@ -83,7 +83,7 @@ ParseConfig()
{
FILE *fp;
CLIENT *client;
u_char *addr;
u_int8_t *addr;
char line[C_LINELEN];
register char *cp, *bcp;
register int i, j;
@ -242,13 +242,12 @@ ParseConfig()
** Warnings:
** - The return value points to a static buffer; it must
** 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)
char *str;
{
static u_char addr[RMP_ADDRLEN];
static u_int8_t addr[RMP_ADDRLEN];
register char *cp;
register unsigned i;
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
* for Software Science (CSS).

View File

@ -37,10 +37,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)rbootd.8 8.2 (Berkeley) 12/11/93
.\" $Id: rbootd.8,v 1.5 1997/02/22 14:21:58 peter Exp $
.\" from: @(#)rbootd.8 8.2 (Berkeley) 12/11/93
.\" $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
.\"
.Dd December 11, 1993

View File

@ -38,28 +38,27 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)rbootd.c 8.2 (Berkeley) 2/22/94
* $Id: rbootd.c,v 1.5 1997/02/22 14:21:58 peter Exp $
* from: @(#)rbootd.c 8.1 (Berkeley) 6/4/93
* $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
*/
#ifndef lint
static char copyright[] =
static const char copyright[] =
"@(#) Copyright (c) 1992, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not 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 */
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
@ -70,19 +69,7 @@ static char sccsid[] = "@(#)rbootd.c 8.2 (Berkeley) 2/22/94";
#include <unistd.h>
#include "defs.h"
/* 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
extern char *__progname; /* from crt0.o */
int
main(argc, argv)
@ -92,11 +79,6 @@ main(argc, argv)
int c, fd, omask, maxfds;
fd_set rset;
/*
* Find what name we are running under.
*/
ProgName = (ProgName = rindex(argv[0],'/')) ? ++ProgName : *argv;
/*
* Close any open file descriptors.
* Temporarily leave stdin & stdout open for `-d',
@ -130,9 +112,8 @@ main(argc, argv)
if (ConfigFile == NULL)
ConfigFile = argv[optind];
else {
fprintf(stderr,
"%s: too many config files (`%s' ignored)\n",
ProgName, argv[optind]);
warnx("too many config files (`%s' ignored)\n",
argv[optind]);
}
}
@ -144,57 +125,16 @@ main(argc, argv)
(void) signal(SIGUSR1, SIG_IGN); /* dont muck w/DbgFp */
(void) signal(SIGUSR2, SIG_IGN);
(void) fclose(stderr); /* finished with it */
} else {
(void) fclose(stdin); /* dont need these */
(void) fclose(stdout);
/*
* 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);
}
}
if (daemon(0, 0))
err(1, "can't detach from terminal");
(void) signal(SIGUSR1, DebugOn);
(void) signal(SIGUSR2, DebugOff);
}
(void) fclose(stderr); /* finished with it */
#ifdef SYSLOG4_2
openlog(ProgName, LOG_PID);
#else
openlog(ProgName, LOG_PID, LOG_DAEMON);
#endif
openlog(__progname, LOG_PID, LOG_DAEMON);
/*
* If no interface was specified, get one now.
@ -238,7 +178,7 @@ main(argc, argv)
FILE *fp;
if ((fp = fopen(PidFile, "w")) != NULL) {
(void) fprintf(fp, "%d\n", MyPid);
(void) fprintf(fp, "%d\n", (int) MyPid);
(void) fclose(fp);
} else {
syslog(LOG_WARNING, "fopen: failed (%s)", PidFile);
@ -287,13 +227,11 @@ main(argc, argv)
r = rset;
if (RmpConns == NULL) { /* timeout isnt necessary */
nsel = select(maxfds, &r, (fd_set *)0, (fd_set *)0,
(struct timeval *)0);
nsel = select(maxfds, &r, NULL, NULL, NULL);
} else {
timeout.tv_sec = RMP_TIMEOUT;
timeout.tv_usec = 0;
nsel = select(maxfds, &r, (fd_set *)0, (fd_set *)0,
&timeout);
nsel = select(maxfds, &r, NULL, NULL, &timeout);
}
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
* 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
* 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
* for Software Science (CSS).
@ -41,14 +39,14 @@
* SUCH DAMAGE.
*
* from: @(#)rmpproto.c 8.1 (Berkeley) 6/4/93
* $Id$
*
* From: Utah Hdr: rmpproto.c 3.1 92/07/06
* Author: Jeff Forys, University of Utah CSS
*/
#ifndef lint
/*static 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 $";
static const char sccsid[] = "@(#)rmpproto.c 8.1 (Berkeley) 6/4/93";
#endif /* not lint */
#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
* for Software Science (CSS).
@ -41,17 +39,18 @@
* SUCH DAMAGE.
*
* from: @(#)utils.c 8.1 (Berkeley) 6/4/93
* $Id$
*
* From: Utah Hdr: utils.c 3.1 92/07/06
* Author: Jeff Forys, University of Utah CSS
*/
#ifndef lint
/*static 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 $";
static const char sccsid[] = "@(#)utils.c 8.1 (Berkeley) 6/4/93";
#endif /* not lint */
#include <sys/param.h>
#include <sys/time.h>
#include <fcntl.h>
#include <signal.h>